摘要:
Solidity supports multiple inheritance. Contracts can inherit other contract by using the is keyword. Function that is going to be overridden by a chi 阅读全文
posted @ 2022-07-31 22:53
ZaleSwfit
阅读(30)
评论(0)
推荐(0)
摘要:
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
阅读(18)
评论(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
阅读(29)
评论(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
阅读(27)
评论(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
阅读(78)
评论(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
阅读(46)
评论(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
阅读(32)
评论(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
阅读(38)
评论(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
阅读(20)
评论(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
阅读(39)
评论(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
阅读(63)
评论(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
阅读(31)
评论(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
阅读(41)
评论(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
阅读(30)
评论(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
阅读(94)
评论(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
阅读(26)
评论(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
阅读(37)
评论(0)
推荐(0)

浙公网安备 33010602011771号