Skip to content

Commit 68cdd1c

Browse files
committed
Add study notes for 2025-08-20
1 parent 68bf892 commit 68cdd1c

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

segment7.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,41 @@ segment7,成都,前北师大学生,现cs在读,目前使用lens protocol
1515
## Notes
1616

1717
<!-- Content_START -->
18+
# 2025-08-20
19+
20+
- nested mapping logic
21+
22+
- `transfer()` sytax and its gas limit on interacting with smart contracts
23+
24+
`<address payable>.transfer(uint256 amount); //send given amount of Wei to Address`
25+
26+
- common requirements: `_amount > 0` `_adress!= address(0)`
27+
28+
`call()` syntax
29+
30+
`(bool success, ) = <address payable>.call{value: _amount}("");`
31+
32+
- 自动回滚错误的函数机制 Error handling: Assert, Require, Revert and Exceptions [link](https://docs.soliditylang.org/en/latest/control-structures.html#error-handling-assert-require-revert-and-exceptions)
33+
34+
> address payable
35+
36+
e.g. `payable(msg.sender)`
37+
38+
`address payable xxx`
39+
40+
> nested mapping logic
41+
42+
```solidity
43+
mapping(address => mapping(address => uint256)) public debts
44+
45+
debts[debtor][creditor] = amount;
46+
47+
//EXAMPLE
48+
debts[0xA][0xB] = 1.5 ether;
49+
//A owes B 1.5 ETH
50+
51+
```
52+
1853
# 2025-08-19
1954

2055
`今日零碎小知识嘻嘻`

0 commit comments

Comments
 (0)