Last active
March 3, 2023 10:42
-
-
Save jamesmorgan/95d0eede2544c5a9b93aea77624013ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract Sample { | |
uint256 a; // storage position 0 | |
uint256[2] b; // storage position 1 & 2 | |
// This is just declaration | |
struct TestStruct { | |
uint256 id; | |
uint256 value; | |
} | |
TestStruct c; // Initialization with default values. storage position 3 & 4 | |
uint256 d; //storage position 5 | |
mapping(uint256 => uint256) e; // storage position 6 | |
mapping(uint256 => uint256) f; // storage position 7 | |
// In case of e, for an arbitrary key 4 and value 10, the storage determines the slot by hashing keccak256(4, 1) | |
// In case of f, for an arbitrary key 4 and value 11, the storage determines the slot by hashing keccak256(4, 2) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment