forked from huff-language/foundry-huff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NoConstructor.huff
38 lines (31 loc) · 1011 Bytes
/
NoConstructor.huff
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
/* Interface */
#define function getArgOne() view returns (address)
#define function getArgTwo() view returns (uint256)
/* Storage Slots */
#define constant CONSTRUCTOR_ARG_ONE = FREE_STORAGE_POINTER()
#define constant CONSTRUCTOR_ARG_TWO = FREE_STORAGE_POINTER()
/* Events */
#define event ArgumentsUpdated(address indexed one, uint256 indexed two)
#define constant ARGUMENTS_TOPIC = 0xd0a6a6b9636b3b1e85120bfc8c36f7bc862769b48e0854deaf8780636a71ce7d
/* First Argument Accessor */
#define macro GET_ARG_ONE() = takes (0) returns (0) {
[CONSTRUCTOR_ARG_ONE] sload
0x00 mstore
0x20 0x00 return
}
/* Second Argument Accessor */
#define macro GET_ARG_TWO() = takes (0) returns (0) {
[CONSTRUCTOR_ARG_TWO] sload
0x00 mstore
0x20 0x00 return
}
/* Main Macro */
#define macro MAIN() = takes (0) returns (0) {
0x00 calldataload 0xE0 shr
dup1 0xbb01e52d eq arg_one jumpi
dup1 0x98e45be4 eq arg_two jumpi
arg_one:
GET_ARG_ONE()
arg_two:
GET_ARG_TWO()
}