Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Tutorials #243

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,19 @@ docs/ethers-101/01_HelloVitalik/HelloVitalik.js docs/ethers-101/02_Provider/Prov
Changes in docs/solidity-104:
docs/ethers-101/01_HelloVitalik/HelloVitalik.js docs/ethers-101/02_Provider/Provider.js docs/ethers-101/03_ReadContract/ReadContract.js docs/ethers-101/04_SendETH/SendETH.js docs/ethers-101/05_WriteContract/WriteContract.js docs/ethers-101/06_DeployContract/DeployContract.js docs/ethers-101/07_Event/Event.js docs/ethers-101/08_ContractListener/ContractListener.js docs/ethers-101/09_EventFilter/EventFilter.js docs/ethers-101/10_Units/Units.js docs/ethers-102/11_StaticCall/readme.md docs/ethers-102/11_StaticCall/staticCall.js docs/ethers-102/12_ERC721Check/ERC721Check.js docs/ethers-102/12_ERC721Check/readme.md docs/ethers-102/13_EncodeCalldata/EncodeCalldata.js docs/ethers-102/14_HDwallet/HDwallet.js docs/ethers-102/14_HDwallet/readme.md docs/ethers-102/15_MultiTransfer/MultiTransfer.js docs/ethers-102/15_MultiTransfer/readme.md docs/ethers-102/16_MultiCollect/MultiCollect.js docs/ethers-102/16_MultiCollect/readme.md docs/ethers-102/17_MerkleTree/MerkleTree.js docs/ethers-102/18_Signature/Signature.js docs/ethers-102/18_Signature/readme.md docs/ethers-102/19_Mempool/Mempool.js docs/ethers-102/19_Mempool/readme.md docs/ethers-102/20_DecodeTx/DecodeTx.js docs/ethers-102/20_DecodeTx/img/20-3.png docs/ethers-102/20_DecodeTx/img/20-4.png docs/ethers-102/20_DecodeTx/readme.md docs/ethers-102/21_VanityAddress/readme.md docs/ethers-102/23_Frontrun/Frontrun.sol docs/ethers-102/23_Frontrun/frontrun.js docs/ethers-102/23_Frontrun/img/23-2.png docs/ethers-102/23_Frontrun/img/23-3.png docs/ethers-102/23_Frontrun/readme.md docs/ethers-102/24_ERC20Check/readme.md docs/ethers-102/25_Flashbots/Flashbots.js docs/ethers-102/25_Flashbots/img/25-4.png docs/ethers-102/25_Flashbots/img/25-5.png docs/ethers-102/25_Flashbots/readme.md docs/solidity-101/01_HelloWeb3/HelloWeb3.sol docs/solidity-101/01_HelloWeb3/img/1-2.png docs/solidity-101/01_HelloWeb3/readme.md docs/solidity-101/02_ValueTypes/ValueTypes.sol docs/solidity-101/02_ValueTypes/readme.md docs/solidity-101/03_Function/Function.sol docs/solidity-101/03_Function/readme.md docs/solidity-101/04_Return/Return.sol docs/solidity-101/04_Return/readme.md docs/solidity-101/05_DataStorage/DataStorage.sol docs/solidity-101/05_DataStorage/readme.md docs/solidity-101/06_ArrayAndStruct/ArrayAndStruct.sol docs/solidity-101/06_ArrayAndStruct/readme.md docs/solidity-101/07_Mapping/Mapping.sol docs/solidity-101/07_Mapping/readme.md docs/solidity-101/08_InitialValue/InitialValue.sol docs/solidity-101/08_InitialValue/readme.md docs/solidity-101/09_Constant/Constant.sol docs/solidity-101/09_Constant/readme.md docs/solidity-101/10_InsertionSort/InsertionSort.sol docs/solidity-101/10_InsertionSort/readme.md docs/solidity-101/11_Modifier/Owner.sol docs/solidity-101/11_Modifier/img/11-1.jpg docs/solidity-101/11_Modifier/img/11-2.jpg docs/solidity-101/11_Modifier/img/11-3.jpg docs/solidity-101/11_Modifier/readme.md docs/solidity-101/12_Event/Event.sol docs/solidity-101/12_Event/readme.md docs/solidity-101/13_Inheritance/Inheritance.sol docs/solidity-101/13_Inheritance/ModifierInheritance.sol docs/solidity-101/13_Inheritance/readme.md docs/solidity-101/14_Interface/Interface.sol docs/solidity-101/14_Interface/img/14-2.png docs/solidity-101/14_Interface/readme.md docs/solidity-101/15_Errors/Error.sol docs/solidity-101/15_Errors/readme.md docs/solidity-102/16_Overloading/Overloading.sol docs/solidity-102/16_Overloading/readme.md docs/solidity-102/17_Library/Library.sol docs/solidity-102/17_Library/readme.md docs/solidity-102/18_Import/Yeye.sol docs/solidity-102/18_Import/readme.md docs/solidity-102/19_Fallback/Fallback.sol docs/solidity-102/19_Fallback/readme.md docs/solidity-102/20_SendETH/SendETH.sol docs/solidity-102/20_SendETH/readme.md docs/solidity-102/21_CallContract/CallContract.sol docs/solidity-102/21_CallContract/readme.md docs/solidity-102/22_Call/Call.sol docs/solidity-102/22_Call/readme.md docs/solidity-102/23_Delegatecall/Delegatecall.sol docs/solidity-102/23_Delegatecall/readme.md docs/solidity-102/24_Create/Create.sol docs/solidity-102/24_Create/readme.md docs/solidity-102/25_Create2/create2test.js docs/solidity-102/25_Create2/readme.md docs/solidity-102/26_DeleteContract/DeleteContract.sol docs/solidity-102/26_DeleteContract/img/26-1.png docs/solidity-102/26_DeleteContract/img/26-2.png docs/solidity-102/26_DeleteContract/readme.md docs/solidity-102/27_ABIEncode/ABIEncode.sol docs/solidity-102/27_ABIEncode/readme.md docs/solidity-102/28_Hash/Hash.sol docs/solidity-102/28_Hash/readme.md docs/solidity-102/29_Selector/Selector.sol docs/solidity-102/29_Selector/img/29-2.png docs/solidity-102/29_Selector/img/29-3.png docs/solidity-102/29_Selector/readme.md docs/solidity-102/30_TryCatch/TryCatch.sol docs/solidity-102/30_TryCatch/readme.md docs/solidity-103/31_ERC20/ERC20.sol docs/solidity-103/31_ERC20/IERC20.sol docs/solidity-103/31_ERC20/readme.md docs/solidity-103/32_Faucet/Faucet.sol docs/solidity-103/32_Faucet/IERC20.sol docs/solidity-103/32_Faucet/readme.md docs/solidity-103/33_Airdrop/Airdrop.sol docs/solidity-103/33_Airdrop/IERC20.sol docs/solidity-103/33_Airdrop/readme.md docs/solidity-103/34_ERC721/ERC721.sol docs/solidity-103/34_ERC721/String.sol docs/solidity-103/34_ERC721/WTFApe.sol docs/solidity-103/34_ERC721/readme.md docs/solidity-103/35_DutchAuction/DutchAuction.sol docs/solidity-103/35_DutchAuction/readme.md docs/solidity-103/36_MerkleTree/MerkleTree.sol docs/solidity-103/36_MerkleTree/readme.md docs/solidity-103/37_Signature/Signature.sol docs/solidity-103/37_Signature/readme.md docs/solidity-103/38_NFTSwap/NFTSwap.sol docs/solidity-103/38_NFTSwap/readme.md docs/solidity-103/39_Random/Random.sol docs/solidity-103/39_Random/RandomNumberConsumer.sol docs/solidity-103/39_Random/img/39-2.png docs/solidity-103/39_Random/img/39-3.png docs/solidity-103/39_Random/img/39-4.png docs/solidity-103/39_Random/img/39-5.png docs/solidity-103/39_Random/img/39-6.png docs/solidity-103/39_Random/img/39-7.png docs/solidity-103/39_Random/readme.md docs/solidity-103/40_ERC1155/BAYC1155.sol docs/solidity-103/40_ERC1155/readme.md docs/solidity-103/41_WETH/readme.md docs/solidity-103/42_PaymentSplit/PaymentSplit.sol docs/solidity-103/42_PaymentSplit/readme.md docs/solidity-103/43_TokenVesting/readme.md docs/solidity-103/44_TokenLocker/readme.md docs/solidity-103/45_Timelock/Timelock.sol docs/solidity-103/45_Timelock/readme.md docs/solidity-103/46_ProxyContract/ProxyContract.sol docs/solidity-103/46_ProxyContract/readme.md docs/solidity-103/47_Upgrade/Upgrade.sol docs/solidity-103/47_Upgrade/readme.md docs/solidity-103/48_TransparentProxy/TransparentProxy.sol docs/solidity-103/48_TransparentProxy/readme.md docs/solidity-103/49_UUPS/UUPS.sol docs/solidity-103/49_UUPS/readme.md docs/solidity-103/50_MultisigWallet/MultisigWallet.sol docs/solidity-103/50_MultisigWallet/readme.md docs/solidity-104/S01_ReentrancyAttack/ReentrancyAttack.sol docs/solidity-104/S01_ReentrancyAttack/readme.md docs/solidity-104/S02_SelectorClash/SelectorClash.sol docs/solidity-104/S02_SelectorClash/readme.md docs/solidity-104/S03_Centralization/Centralization.sol docs/solidity-104/S03_Centralization/readme.md docs/solidity-104/S04_AccessControlExploit/AccessControlExploit.sol docs/solidity-104/S04_AccessControlExploit/readme.md docs/solidity-104/S05_Overflow/Overflow.sol docs/solidity-104/S05_Overflow/readme.md docs/solidity-104/S06_SignatureReplay/SingatureReplay.sol docs/solidity-104/S06_SignatureReplay/readme.md docs/solidity-104/S07_BadRandomness/BadRandomness.sol docs/solidity-104/S07_BadRandomness/readme.md docs/solidity-104/S08_ContractCheck/ContractCheck.sol docs/solidity-104/S08_ContractCheck/readme.md docs/solidity-104/S09_DoS/DoS.sol docs/solidity-104/S09_DoS/readme.md docs/solidity-104/S10_Honeypot/Honeypot.sol docs/solidity-104/S10_Honeypot/readme.md docs/solidity-104/S11_Frontrun/Frontrun.sol docs/solidity-104/S11_Frontrun/frontrun.js docs/solidity-104/S11_Frontrun/readme.md docs/solidity-104/S12_TxOrigin/readme.md docs/solidity-104/S13_UncheckedCall/UncheckedCall.sol docs/solidity-104/S13_UncheckedCall/readme.md docs/solidity-104/S14_TimeManipulation/readme.md docs/solidity-104/S14_TimeManipulation/src/TimeManipulation.sol docs/solidity-104/S14_TimeManipulation/test/TimeManipulation.t.sol docs/solidity-104/S15_OracleManipulation/readme.md docs/solidity-104/S15_OracleManipulation/src/Oracle.sol docs/solidity-104/S15_OracleManipulation/test/Oracle.t.sol docs/solidity-104/S16_NFTReentrancy/NFTReentrancy.sol docs/solidity-104/S16_NFTReentrancy/readme.md docs/ethers-102/21_VanityAddress/BulkVanityAddress.js docs/solidity-101/05_DataStorage/img/5-5.png docs/solidity-101/05_DataStorage/img/5-6.png docs/solidity-101/06_ArrayAndStruct/img/6-4.png docs/solidity-101/06_ArrayAndStruct/img/6-5.png docs/solidity-101/11_Modifier/img/11-4.jpg docs/solidity-101/12_Event/img/12-4.png docs/solidity-101/13_Inheritance/DiamondInheritance.sol docs/solidity-101/14_Interface/AbstractDemo.sol docs/solidity-101/14_Interface/InterfaceDemo.sol docs/solidity-102/18_Import/Import.sol docs/solidity-102/25_Create2/Create2.sol docs/solidity-102/26_DeleteContract/DeployContract.sol docs/solidity-102/26_DeleteContract/img/26-3.png docs/solidity-102/26_DeleteContract/img/26-4.png docs/solidity-102/26_DeleteContract/img/26-5.png docs/solidity-102/26_DeleteContract/img/26-6.png docs/solidity-103/39_Random/img/39-10.png docs/solidity-103/39_Random/img/39-6-1.png docs/solidity-103/39_Random/img/39-8.png docs/solidity-103/39_Random/img/39-9.png docs/solidity-103/51_ERC4626/ docs/solidity-103/52_EIP712/ docs/solidity-103/53_ERC20Permit/ docs/solidity-103/54_CrossChainBridge/ docs/solidity-103/55_MultiCall/ docs/solidity-103/56_DEX/ docs/solidity-103/57_Flashloan/ docs/solidity-104/S17_CrossReentrancy/

--------------------------------
Sync started at Sun Oct 6 01:10:35 UTC 2024


Changes in docs/solidity-101:
docs/solidity-101/09_Constant/readme.md

Changes in docs/solidity-102:
docs/solidity-101/09_Constant/readme.md docs/solidity-102/26_DeleteContract/readme.md

Changes in docs/solidity-103:
docs/solidity-101/09_Constant/readme.md docs/solidity-102/26_DeleteContract/readme.md

Changes in docs/solidity-104:
docs/solidity-101/09_Constant/readme.md docs/solidity-102/26_DeleteContract/readme.md

5 changes: 3 additions & 2 deletions docs/solidity-101/09_Constant/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ address constant CONSTANT_ADDRESS = 0x0000000000000000000000000000000000000000;

### immutable

`immutable`变量可以在声明时或构造函数中初始化,因此更加灵活。在`Solidity v8.0.21`以后,`immutable`变量不需要显式初始化。反之,则需要显式初始化。
`immutable`变量可以在声明时或构造函数中初始化,因此更加灵活。在`Solidity v8.0.21`以后,`immutable`变量不需要显式初始化,未显式初始化的`immutable`变量将使用数值类型的初始值(见 [8. 变量初始值](https://github.com/AmazingAng/WTF-Solidity/blob/main/08_InitialValue/readme.md#%E5%8F%98%E9%87%8F%E5%88%9D%E5%A7%8B%E5%80%BC))。反之,则需要显式初始化。
若`immutable`变量既在声明时初始化,又在constructor中初始化,会使用constructor初始化的值。

``` solidity
// immutable变量可以在constructor里初始化,之后不能改变
uint256 public immutable IMMUTABLE_NUM = 9999999999;
address public immutable IMMUTABLE_ADDRESS;
// 在`Solidity v8.0.21`以后,下列变量数值暂为初始值
address public immutable IMMUTABLE_ADDRESS;
uint256 public immutable IMMUTABLE_BLOCK;
uint256 public immutable IMMUTABLE_TEST;
```
Expand Down
2 changes: 1 addition & 1 deletion docs/solidity-102/26_DeleteContract/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@ contract DeployContract {

`selfdestruct`是智能合约的紧急按钮,销毁合约并将剩余`ETH`转移到指定账户。当著名的`The DAO`攻击发生时,以太坊的创始人们一定后悔过没有在合约里加入`selfdestruct`来停止黑客的攻击吧。在坎昆升级后,`selfdestruct`的作用也逐渐发生了改变,什么都不是一成不变的,还是要保持学习。

<LessonQuizStart meta={require('./meta.json')} />
<LessonQuizStart meta={require('./meta.json')} />