Skip to content

Commit

Permalink
Update k66inthesky.md
Browse files Browse the repository at this point in the history
  • Loading branch information
k66inthesky authored Oct 16, 2024
1 parent 3968cf9 commit 9ceed94
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions k66inthesky.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,4 +283,27 @@ receive() fallback()
學習內容: `25. CREATE2`
+ `CREATE2`和前一篇的`CREATE`不同,`Uniswap v2`用來驅動factory合約。

### 2024.10.16
學習內容: `26. DeleteContract`
+ `selfdestruct`在v.0.8.18後不再建議使用,但目前還沒有替代方案。
+ 將合約自我銷毀,範例:
```
contract DelContract{
...
function delContract() external{
selfdestruct(payable(msg.sender));
}
}
// 外部呼叫
contract DeployContract{
...
function demo() public payable returns (DemeResult memory){
...
DelContract del = new DelContract{value:msg.value)();
del.delContract();
}
}
```

<!-- Content_END -->

0 comments on commit 9ceed94

Please sign in to comment.