solidity 

66175
单词释义
n.固态,坚固性,可靠性
词根词缀记忆/谐音联想记忆 补充/纠错
谐音记忆舍利的… * → solidity n.坚固,稳健,固态,确实
对比记忆
以“soli”开头的考纲词:
… * → solidity n.坚固,稳健,固态,确实
词性拓展记忆 / 词形拓展记忆
单词例句
You should trust the solidity of the pound.
你们应该相信英镑的稳定性。
Mary's writings have extraordinary depth and solidity.
玛丽写的东西立意极深,内容特别充实。
But there was a solidity to Lisa's coming moves.
但丽萨一开局便稳住阵脚。
`pragma solidity ^0.8.0;`
**中文释义:** 指定Solidity编译器的版本,该例中要求使用0.8.0或更高,但低于1.0的版本。
`contract MyContract { function foo() public { } }`
**中文释义:** 定义一个名为MyContract的智能合约,其中包含一个公开(public)函数foo。
`mapping(uint256 => address) public balances;`
**中文释义:** 声明一个公有(public)的映射,它将无符号256位整数映射到以太坊地址上,常用于表示账户余额。
`function withdraw(uint amount) public { require(balances[msg.sender] >= amount, "Insufficient balance."); balances[msg.sender] -= amount; payable(msg.sender).transfer(amount); }`
**中文释义:** 定义一个公开函数withdraw,允许用户提取金额。首先检查发送者余额是否充足,然后减少余额,并通过转账发送相应金额。
`event Transfer(address indexed from, address indexed to, uint256 value);`
**中文释义:** 声明一个事件Transfer,当发生代币转移时触发,记录转出地址、转入地址和转移金额,两者地址都是可索引的,方便日志查询。
`modifier onlyOwner() { require(msg.sender == owner, "Only owner can call this function."); _; }`
**中文释义:** 定义一个修饰符onlyOwner,确保只有合约所有者可以调用被该修饰符保护的函数。
`address payable recipient = payable("0x1234567890123456789012345678901234567890");`
**中文释义:** 初始化一个可支付的(payable)地址变量recipient,用于接收以太币转账。
`function () external payable {}`
**中文释义:** 定义一个默认的fallback函数,当接收到没有对应函数签名的交易或Ether时会被执行,此例中允许合约接收Ether。
`struct User { string name; uint age; } mapping(address => User) public users;`
**中文释义:** 定义一个结构体User,包含姓名(name)和年龄(age)。然后声明一个映射,将每个以太坊地址映射到一个User结构体上,用于存储用户信息。
`function setItem(string memory _itemName, uint _itemPrice) public { itemName = _itemName; itemPrice = _itemPrice; }`
**中文释义:** 定义一个公共函数setItem,允许外部调用来设置itemName(字符串类型)和itemPrice(无符号整数类型)的值,其中使用memory关键字指示参数是内存中的临时变量。
未经许可,严禁转发。QQ交流群:688169419
0
0