-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontract.sol
173 lines (125 loc) · 5.29 KB
/
contract.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/**
*Submitted for verification at Etherscan.io on 2022-11-20
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
contract Store {
// slot 0
address private owner;
// slot 1
uint256 private value;
// slot 2
uint8 private one;
uint96 private two;
bool private three;
uint8 private four;
// slot 3
address private contract_address;
// slot 4
uint256 private max_value;
// slot 5
address private slot_five_address;
uint24 private slot_five_24;
uint32 private slot_five_32;
uint40 private slot_five_40;
// slot 6
mapping (address => uint256) private response;
// slot 7
mapping (uint256 => address) private intMapping;
// slot 8
mapping (bytes32 => bool) private bytesMapping;
// slot 9
mapping (bytes32 => uint256) private bytesMappingInt;
// slot 10
uint256[] private arrayUint;
// slot 11
address[] private arrayAddress;
// slot 12
mapping (address => uint256[]) private mappingUintArray;
// slot 13
mapping (uint256 => address[]) private mappingAddressArray;
// slot 14
mapping (address => mapping (uint256 => bytes32)) private three_mapping;
// slot 15
mapping (address => mapping (uint256 => uint256[])) private three_mapping_uint_array;
struct data_one{
string name;
uint256 id;
address user;
}
// slot 16,17,18
data_one private store_struct;
// slot 19
data_one[] private undefined_array;
// slot 20,21,22, 23,24,25 26,27,28
data_one[3] private defined_array;
// slot 29
mapping (uint256 => data_one) private mappingStruct;
// slot 30
mapping (uint256 => data_one[]) private mappingStructArray;
// slot 31
mapping (address => data_one[]) private mappingAddressStructArray;
// slot 32
mapping (address => mapping (uint256 => data_one)) private three_mapping_struct;
// slot 33
mapping (address => mapping (uint256 => data_one[])) private three_mapping_struct_array;
constructor(address _one,address _two,address _three) {
address address_one = _one;
address address_two = _two;
owner = msg.sender;
value = type(uint96).max;
one = 240;
two = type(uint32).max;
three = true;
four = 195;
slot_five_address = address(_three);
slot_five_24 = type(uint24).max - type(uint8).max;
slot_five_32 = type(uint32).max - type(uint16).max;
slot_five_40 = type(uint40).max - type(uint24).max;
contract_address = address(this);
max_value = type(uint256).max;
response[address_one] = 123456789;
response[address_two] = 987456123;
intMapping[897] = address_two;
intMapping[797] = address_one;
bytesMapping[getMapAddr(address_one)] = true;
bytesMapping[getMapAddr(address_two)] = true;
bytesMappingInt[getMapAddr(address_one)] = 98524165498;
bytesMappingInt[getMapAddr(address_two)] = 87897465411347887;
arrayUint.push(8769411);
arrayUint.push(148982);
arrayUint.push(58798412285);
arrayAddress.push(address_one);
arrayAddress.push(address_two);
mappingUintArray[address_one].push(6979843);
mappingUintArray[address_two].push(37878978);
mappingAddressArray[8542123].push(address_one);
mappingAddressArray[3634648].push(address_two);
mappingStruct[432] = data_one("hello world",11,address(0xdead));
mappingStructArray[5].push(data_one("hey cool",11,address_one));
mappingStructArray[5].push(data_one("welcome",22,address_two));
mappingStructArray[6].push(data_one("welcome",11,address_one));
mappingStructArray[6].push(data_one("hey cool",22,address_two));
mappingAddressStructArray[address_one].push(data_one("hey cool",11,address_one));
mappingAddressStructArray[address_one].push(data_one("welcome",11,address_one));
mappingAddressStructArray[address_one].push(data_one("hey welcome",6,address_one));
mappingAddressStructArray[address_one].push(data_one("hey welcome",3,address_two));
mappingAddressStructArray[address_two].push(data_one("welcome",22,address_two));
mappingAddressStructArray[address_two].push(data_one("hey cool",22,address_two));
undefined_array.push(data_one("hey cool",55,address_one));
defined_array[0] = data_one("hey cool",11,address_one);
defined_array[1] = data_one("hey cool",22,address_one);
defined_array[2] = data_one("hey cool",33,address(0xdead));
store_struct = data_one("hello",555,address_one);
three_mapping[address_one][7] = keccak256(abi.encodePacked(("welcome to all")));
three_mapping[address_two][8] = keccak256(abi.encodePacked(("welcome to all")));
three_mapping_uint_array[address_one][5].push(type(uint40).max);
three_mapping_uint_array[address_one][4].push(type(uint24).max);
three_mapping_struct[address_one][5] = data_one("hey welcome",7,address_one);
three_mapping_struct[address_one][4] = data_one("hey welcome",6,address_two);
three_mapping_struct_array[address_one][444].push(data_one("End",142,address_one));
}
function getMapAddr(address slot) private pure returns (bytes32) {
return bytes32(uint256(uint160(slot)));
}
}