随笔分类 -  Solidity

摘要:Sending Ether (transfer, send, call) How to send Ether? You can send Ether to other contracts by transfer (2300 gas, throws error) send (2300 gas, ret 阅读全文 »
posted @ 2022-08-16 00:53 ZaleSwfit 阅读(24) 评论(0) 推荐(0) 编辑
摘要:github网址:https://github.com/ethereum/solc.js 知乎大佬小结:solc编译器分析 - 粒子区块链的文章 - 知乎 https://zhuanlan.zhihu.com/p/164633644 腾讯云大佬总结 https://cloud.tencent.com 阅读全文 »
posted @ 2022-08-10 22:09 ZaleSwfit 阅读(281) 评论(0) 推荐(1) 编辑
摘要:Events allow logging to the Ethereum blockchain. Some use cases for events are: Listening for events and updating user interface A cheap form of stora 阅读全文 »
posted @ 2022-08-02 12:10 ZaleSwfit 阅读(19) 评论(0) 推荐(0) 编辑
摘要:Libraries are similar to contracts, but you can't declare any state variable and you can't send ether. A library is embedded into the contract if all 阅读全文 »
posted @ 2022-08-01 00:29 ZaleSwfit 阅读(17) 评论(0) 推荐(0) 编辑
摘要:Ether WalletAn example of a basic wallet. Anyone can send ETH.Only the owner can withdraw. // SPDX-License-Identifier: MITpragma solidity ^0.8.13; con 阅读全文 »
posted @ 2022-08-01 00:26 ZaleSwfit 阅读(16) 评论(0) 推荐(0) 编辑
摘要:Modifiers are code that can be run before and / or after a function call. Modifiers can be used to: Restrict access Validate inputs Guard against reen 阅读全文 »
posted @ 2022-08-01 00:26 ZaleSwfit 阅读(27) 评论(0) 推荐(0) 编辑
摘要:There are several ways to return outputs from a function. Public functions cannot accept certain data types as inputs or outputs // SPDX-License-Ident 阅读全文 »
posted @ 2022-07-31 22:35 ZaleSwfit 阅读(17) 评论(0) 推荐(0) 编辑
摘要:Getter functions can be declared view or pure. View function declares that no state will be changed. Pure function declares that no state variable wil 阅读全文 »
posted @ 2022-07-31 22:34 ZaleSwfit 阅读(15) 评论(0) 推荐(0) 编辑
摘要:A constructor is an optional function that is executed upon contract creation. Here are examples of how to pass arguments to constructors. // SPDX-Lic 阅读全文 »
posted @ 2022-07-31 22:33 ZaleSwfit 阅读(67) 评论(0) 推荐(0) 编辑
摘要:An error will undo all changes made to the state during a transaction. You can throw an error by calling require, revert or assert. require is used to 阅读全文 »
posted @ 2022-07-31 22:20 ZaleSwfit 阅读(38) 评论(0) 推荐(0) 编辑
摘要:When a function is called, the first 4 bytes of calldata specifies which function to call. This 4 bytes is called a function selector. Take for exampl 阅读全文 »
posted @ 2022-07-31 22:17 ZaleSwfit 阅读(29) 评论(0) 推荐(0) 编辑
摘要: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 阅读(20) 评论(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 阅读(20) 评论(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 阅读(75) 评论(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 阅读(17) 评论(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 阅读(23) 评论(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 阅读(151) 评论(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 阅读(85) 评论(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 阅读(116) 评论(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 阅读(50) 评论(0) 推荐(0) 编辑

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