摘要:
Constants are variables that cannot be modified. Their value is hard coded and using constants can save gas cost. // SPDX-License-Identifier: MIT prag 阅读全文
摘要:
There are several ways to return outputs from a function. Public functions cannot accept certain data types as inputs or outputs // SPDX-License-Ident 阅读全文
摘要:
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 阅读全文
摘要:
A constructor is an optional function that is executed upon contract creation. Here are examples of how to pass arguments to constructors. // SPDX-Lic 阅读全文
摘要:
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 阅读全文
摘要:
Unlike functions, state variables cannot be overridden by re-declaring it in the child contract. Let's learn how to correctly override inherited state 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
You can interact with other contracts by declaring an Interface. Interface cannot have any functions implemented can inherit from other interfaces all 阅读全文
摘要:
Functions and addresses declared payable can receive ether into the contract. // SPDX-License-Identifier: MIT pragma solidity ^0.8.13; contract Payabl 阅读全文