05 2022 档案

摘要:Solidity 语法里面用到的两种变量类型 Memory 和 Storage 的关系就像电脑的内存和硬盘的,memory 是和内存一样是暂时存储,storage 像硬盘一样是永久存储。 memory 是值传递,storage 是引用类型 在合约里面,函数外的变量默认通过 storage 存储,函数 阅读全文
posted @ 2022-05-13 21:57 apeNote 阅读(524) 评论(0) 推荐(0) 编辑
摘要:Map 例子 contract MapTest { mapping(address => uint256) public account; function getAccount(address _addr) public view returns (uint256){ return account 阅读全文
posted @ 2022-05-09 22:31 apeNote 阅读(285) 评论(0) 推荐(0) 编辑
摘要:数组 例子 contract ArrayTest { uint256[] public array01; uint256[] public array02=[1,2,3]; function push(uint256 i) public{ array01.push(i); } function po 阅读全文
posted @ 2022-05-09 22:18 apeNote 阅读(118) 评论(0) 推荐(0) 编辑
摘要:循环代码 contract LoopTest { uint256 public counter; function loopTest(uint n) public { for(uint i=0; i<n; i++){ counter += 1; } } } 输出 阅读全文
posted @ 2022-05-05 08:59 apeNote 阅读(64) 评论(0) 推荐(0) 编辑
摘要:assert contract ErrorTest { uint256 public balance; function deposit(uint256 _amount) public{ balance = balance + _amount; } function withdraw(uint256 阅读全文
posted @ 2022-05-05 08:54 apeNote 阅读(10) 评论(0) 推荐(0) 编辑
摘要:test contract EventTest { event Log1(address sender, uint256 val); string log; function test() external{ emit Log1(msg.sender, 100); log = 'logTest'; 阅读全文
posted @ 2022-05-05 00:41 apeNote 阅读(26) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示