-
学习 Solidity——智能合约开发Solidity 是一种受 C++、JavaScript 和 Python 影响的面向对象的编程语言。区分变量作用域:状态变量通常位于智能合约内部,但位于函数外部。局部变量位于函数内部,不能从该函数之外访问。全局变量不是由你声明的,当时它们“神奇地”可供你使用。// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol"; contract PriceConsumerV3 { AggregatorV3Interface internal priceFeed; // priceFeed is a public variable of type AggregatorV3Interface constructor() { // _priceFeed is the address of the contract that implements the AggregatorV3Interface priceFeed = AggregatorV3Interface(0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e); // priceFeed is set to the address of the contract that implements the AggregatorV3Interface } function getLatestPrice() public view returns(int) { ( /*uint80 roundID*/, int price, // price is the price of the asset in the chainlink oracle /*uint startedAt*/, /*uint timeStamp*/, /*uint80 answeredInRound*/ ) = priceFeed.latestRoundData(); // Call the latestRoundData() function on the priceFeed contract return price; // Return the price of the asset in the chainlink oracle } }参考cid:link_0
推荐直播
-
开发者玩转DeepSeek
2025/02/20 周四 16:30-17:30
Thomas – 华为云DTSE技术布道师
双擎驱动优势——华为云CodeArts IDE全栈能力与DeepSeek认知智能深度融合,打造智能编码助手。如何利用DeepSeek的能力,进一步强化业务。
回顾中 -
探秘仓颉编程语言:华为开发者空间的创新利器
2025/02/22 周六 15:00-16:30
华为云讲师团
本期直播将与您一起探秘颉编程语言上线华为开发者空间后,显著提升开发效率,在智能化开发支持、全场景跨平台适配能力、工具链与生态完备性、语言简洁与高性能特性等方面展现出的独特优势。直播看点: 1.java转仓颉的小工具 2.仓颉动画三方库lottie 3.开发者空间介绍及如何在空间用仓颉编程语言开发
即将直播 -
大模型Prompt工程深度实践
2025/02/24 周一 16:00-17:30
盖伦 华为云学堂技术讲师
如何让大模型精准理解开发需求并生成可靠输出?本期直播聚焦大模型Prompt工程核心技术:理解大模型推理基础原理,关键采样参数定义,提示词撰写关键策略及Prompt工程技巧分享。
去报名
热门标签