摘要: Functions and state variables have to declare whether they are accessible by other contracts. Functions can be declared as public - any contract and a 阅读全文
posted @ 2022-07-31 21:58 ZaleSwfit 阅读(19) 评论(0) 推荐(0) 编辑
摘要: Parent contracts can be called directly, or by using the keyword super. By using the keyword super, all of the immediate parent contracts will be call 阅读全文
posted @ 2022-07-31 21:57 ZaleSwfit 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 原文网址:https://solidity-by-example.org/new-contract/ Contracts can be created by other contracts using the new keyword. Since 0.8.0, new keyword support 阅读全文
posted @ 2022-07-31 21:56 ZaleSwfit 阅读(18) 评论(0) 推荐(0) 编辑
摘要: try / catch can only catch errors from external function calls and contract creation. // SPDX-License-Identifier: MIT pragma solidity ^0.8.13; // Exte 阅读全文
posted @ 2022-07-31 21:55 ZaleSwfit 阅读(71) 评论(0) 推荐(0) 编辑
摘要: You can import local and external files in Solidity. Local Here is our folder structure. ├── Import.sol └── Foo.sol Foo.sol // SPDX-License-Identifier 阅读全文
posted @ 2022-07-31 21:54 ZaleSwfit 阅读(14) 评论(0) 推荐(0) 编辑
摘要: Contract can call other contracts in 2 ways. The easiest way to is to just call it, like A.foo(x, y, z). Another way to call other contracts is to use 阅读全文
posted @ 2022-07-31 21:54 ZaleSwfit 阅读(22) 评论(0) 推荐(0) 编辑
摘要: // SPDX-License-Identifier: GPL-3.0//通过合约部署合约,通过代理合约去部署, pragma solidity ^0.8.3; contract TestContract1 { address public owner = msg.sender; function 阅读全文
posted @ 2022-07-29 18:39 ZaleSwfit 阅读(146) 评论(0) 推荐(0) 编辑
摘要: // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.3; contract Enum { enum Status {//枚举和结构体都是一种类型 None, Pending, Shipped, Completed, Rejected, C 阅读全文
posted @ 2022-07-29 17:26 ZaleSwfit 阅读(79) 评论(0) 推荐(0) 编辑
摘要: // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.3; contract Structs {//结构体是能够将多种变量格式打包一起的数据格式,以一种类型的形式存在 struct Car { string model;//默认值字符串 u 阅读全文
posted @ 2022-07-29 16:01 ZaleSwfit 阅读(101) 评论(0) 推荐(0) 编辑
摘要: // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; contract IterableMapping { mapping(address => uint) public balances;//地址对应余额映射 mapping(add 阅读全文
posted @ 2022-07-29 12:27 ZaleSwfit 阅读(45) 评论(0) 推荐(0) 编辑