We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 481c5af + e325347 commit 6286e36Copy full SHA for 6286e36
07_Mapping/readme.md
@@ -61,7 +61,7 @@ mapping(address => address) public swapPair; // 币对的映射,地址到地
61
62
- **原理1**: 映射不储存任何键(`Key`)的资讯,也没有length的资讯。
63
64
-- **原理2**: 映射使用`keccak256(abi.encodePacked(key, slot))`当成offset存取value,其中`slot`是映射变量定义所在的插槽位置。
+- **原理2**: 对于映射使用`keccak256(h(key) . slot)`计算存取value的位置。感兴趣的可以去阅读 [WTF Solidity 内部规则: 映射存储布局](https://github.com/WTFAcademy/WTF-Solidity-Internals/tree/master/tutorials/02_MappingStorage)
65
66
- **原理3**: 因为Ethereum会定义所有未使用的空间为0,所以未赋值(`Value`)的键(`Key`)初始值都是各个type的默认值,如uint的默认值是0。
67
0 commit comments