摘要: Constants are variables that cannot be modified. Their value is hard coded and using constants can save gas cost. // SPDX-License-Identifier: MIT prag 阅读全文
posted @ 2022-07-31 22:52 ZaleSwfit 阅读(11) 评论(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 阅读(15) 评论(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 阅读(13) 评论(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 阅读(63) 评论(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 阅读(34) 评论(0) 推荐(0) 编辑
摘要: Unlike functions, state variables cannot be overridden by re-declaring it in the child contract. Let's learn how to correctly override inherited state 阅读全文
posted @ 2022-07-31 22:19 ZaleSwfit 阅读(19) 评论(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 阅读(24) 评论(0) 推荐(0) 编辑
摘要: fallback is a function that does not take any arguments and does not return anything. It is executed either when a function that does not exist is cal 阅读全文
posted @ 2022-07-31 22:16 ZaleSwfit 阅读(8) 评论(0) 推荐(0) 编辑
摘要: You can interact with other contracts by declaring an Interface. Interface cannot have any functions implemented can inherit from other interfaces all 阅读全文
posted @ 2022-07-31 22:02 ZaleSwfit 阅读(35) 评论(0) 推荐(0) 编辑
摘要: Functions and addresses declared payable can receive ether into the contract. // SPDX-License-Identifier: MIT pragma solidity ^0.8.13; contract Payabl 阅读全文
posted @ 2022-07-31 22:02 ZaleSwfit 阅读(33) 评论(0) 推荐(0) 编辑