We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0f0e068 commit 5436715Copy full SHA for 5436715
1 file changed
satalai.md
@@ -15,6 +15,35 @@ timezone: UTC+8
15
## Notes
16
17
<!-- Content_START -->
18
+# 2025-08-18
19
+
20
+- message映射变量名称
21
+ - 可以通过messages[地址]访问该地址对应的字符串数组
22
+- event NewMessage(address indexed sender, string message);
23
+ - event 事件结构(固定)
24
+ - indexed表示这个sender参数被索引了,方便后续查找
25
26
+```solidity
27
+constructor() {
28
+string memory initMsg = "Hello ETH Pandas";
29
+messages[msg.sender].push(initMsg);
30
+emit NewMessage(msg.sender, initMsg);
31
+}
32
+```
33
34
+- constructor
35
+ - 构造函数起手式
36
+- memory
37
+ - 存储在内存里
38
+- **msg.sender**
39
+ - 固定搭配,表示当前调用该函数的地址
40
+- push(initMsg)
41
+ - 把initMsg通过messages的地址指向赋值给对应的字符串组
42
+- emit
43
+ - 关键字,触发事件NewMessage
44
+- emit NewMessage(msg.sender,initMsg)
45
+ - NewMessgae是之前定义的事件名称,记录相关地址对应的字符串数组
46
47
# 2025-08-16
48
49
### 1、环境准备
0 commit comments