Repository navigation
Expand file tree
/
Copy pathBytecode.lean
More file actions
299 lines (278 loc) · 20 KB
/
Copy pathBytecode.lean
File metadata and controls
299 lines (278 loc) · 20 KB
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
import Examples.ERC20.Spec
import Stele.Semantics
import Ethereum.Semantics
import Reasoning.JumpDest
/-! # ERC20 — deployed runtime bytecode and trusted-base facts. -/
open Stele Ethereum Ethereum.EVM
/-- `solc --bin-runtime --evm-version shanghai Examples/ERC20/ERC20.sol` (optimizer OFF). -/
def erc20Bytecode : ByteArray :=
⟨#[
96, 128, 96, 64, 82, 52, 128, 21, 97, 0, 15, 87, 95, 95, 253, 91, 80, 96, 4, 54, 16, 97, 0, 96, 87,
95, 53, 96, 224, 28, 128, 99, 9, 94, 167, 179, 20, 97, 0, 100, 87, 128, 99, 24, 22, 13, 221, 20,
97, 0, 148, 87, 128, 99, 35, 184, 114, 221, 20, 97, 0, 178, 87, 128, 99, 112, 160, 130, 49, 20, 97,
0, 226, 87, 128, 99, 169, 5, 156, 187, 20, 97, 1, 18, 87, 128, 99, 221, 98, 237, 62, 20, 97, 1, 66,
87, 91, 95, 95, 253, 91, 97, 0, 126, 96, 4, 128, 54, 3, 129, 1, 144, 97, 0, 121, 145, 144, 97, 7,
153, 86, 91, 97, 1, 114, 86, 91, 96, 64, 81, 97, 0, 139, 145, 144, 97, 7, 241, 86, 91, 96, 64, 81,
128, 145, 3, 144, 243, 91, 97, 0, 156, 97, 2, 95, 86, 91, 96, 64, 81, 97, 0, 169, 145, 144, 97, 8,
25, 86, 91, 96, 64, 81, 128, 145, 3, 144, 243, 91, 97, 0, 204, 96, 4, 128, 54, 3, 129, 1, 144, 97,
0, 199, 145, 144, 97, 8, 50, 86, 91, 97, 2, 101, 86, 91, 96, 64, 81, 97, 0, 217, 145, 144, 97, 7,
241, 86, 91, 96, 64, 81, 128, 145, 3, 144, 243, 91, 97, 0, 252, 96, 4, 128, 54, 3, 129, 1, 144, 97,
0, 247, 145, 144, 97, 8, 130, 86, 91, 97, 5, 65, 86, 91, 96, 64, 81, 97, 1, 9, 145, 144, 97, 8, 25,
86, 91, 96, 64, 81, 128, 145, 3, 144, 243, 91, 97, 1, 44, 96, 4, 128, 54, 3, 129, 1, 144, 97, 1,
39, 145, 144, 97, 7, 153, 86, 91, 97, 5, 85, 86, 91, 96, 64, 81, 97, 1, 57, 145, 144, 97, 7, 241,
86, 91, 96, 64, 81, 128, 145, 3, 144, 243, 91, 97, 1, 92, 96, 4, 128, 54, 3, 129, 1, 144, 97, 1,
87, 145, 144, 97, 8, 173, 86, 91, 97, 6, 232, 86, 91, 96, 64, 81, 97, 1, 105, 145, 144, 97, 8, 25,
86, 91, 96, 64, 81, 128, 145, 3, 144, 243, 91, 95, 129, 96, 1, 95, 51, 115, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 115, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 129,
82, 96, 32, 1, 144, 129, 82, 96, 32, 1, 95, 32, 95, 133, 115, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 115, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 129, 82, 96, 32, 1,
144, 129, 82, 96, 32, 1, 95, 32, 129, 144, 85, 80, 130, 115, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 51, 115, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 127, 140, 91,
225, 229, 235, 236, 125, 91, 209, 79, 113, 66, 125, 30, 132, 243, 221, 3, 20, 192, 247, 178, 41,
30, 91, 32, 10, 200, 199, 195, 185, 37, 132, 96, 64, 81, 97, 2, 77, 145, 144, 97, 8, 25, 86, 91,
96, 64, 81, 128, 145, 3, 144, 163, 96, 1, 144, 80, 146, 145, 80, 80, 86, 91, 96, 2, 84, 129, 86,
91, 95, 95, 96, 1, 95, 134, 115, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 22, 115, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 129, 82, 96, 32, 1, 144, 129, 82, 96, 32, 1, 95,
32, 95, 51, 115, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 22, 115, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 22, 129, 82, 96, 32, 1, 144, 129, 82, 96, 32, 1, 95, 32, 84, 144, 80,
130, 129, 16, 21, 97, 3, 37, 87, 96, 64, 81, 127, 8, 195, 121, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 82, 96, 4, 1, 97, 3, 28, 144, 97, 9, 69,
86, 91, 96, 64, 81, 128, 145, 3, 144, 253, 91, 130, 95, 95, 135, 115, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 115, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 129, 82, 96,
32, 1, 144, 129, 82, 96, 32, 1, 95, 32, 84, 16, 21, 97, 3, 164, 87, 96, 64, 81, 127, 8, 195, 121,
160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 82,
96, 4, 1, 97, 3, 155, 144, 97, 9, 173, 86, 91, 96, 64, 81, 128, 145, 3, 144, 253, 91, 130, 129, 97,
3, 176, 145, 144, 97, 9, 248, 86, 91, 96, 1, 95, 135, 115, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 115, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 129, 82, 96, 32, 1, 144,
129, 82, 96, 32, 1, 95, 32, 95, 51, 115, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 115, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 129, 82, 96, 32, 1, 144, 129, 82, 96,
32, 1, 95, 32, 129, 144, 85, 80, 130, 95, 95, 135, 115, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 115, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 129, 82, 96, 32, 1, 144,
129, 82, 96, 32, 1, 95, 32, 95, 130, 130, 84, 97, 4, 119, 145, 144, 97, 9, 248, 86, 91, 146, 80,
80, 129, 144, 85, 80, 130, 95, 95, 134, 115, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 115, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 129, 82, 96, 32, 1, 144, 129, 82, 96,
32, 1, 95, 32, 95, 130, 130, 84, 97, 4, 201, 145, 144, 97, 10, 43, 86, 91, 146, 80, 80, 129, 144,
85, 80, 131, 115, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 22, 133, 115, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 22, 127, 221, 242, 82, 173, 27, 226, 200, 155, 105, 194, 176,
104, 252, 55, 141, 170, 149, 43, 167, 241, 99, 196, 161, 22, 40, 245, 90, 77, 245, 35, 179, 239,
133, 96, 64, 81, 97, 5, 45, 145, 144, 97, 8, 25, 86, 91, 96, 64, 81, 128, 145, 3, 144, 163, 96, 1,
145, 80, 80, 147, 146, 80, 80, 80, 86, 91, 95, 96, 32, 82, 128, 95, 82, 96, 64, 95, 32, 95, 145,
80, 144, 80, 84, 129, 86, 91, 95, 129, 95, 95, 51, 115, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 115, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 129, 82, 96, 32, 1, 144,
129, 82, 96, 32, 1, 95, 32, 84, 16, 21, 97, 5, 213, 87, 96, 64, 81, 127, 8, 195, 121, 160, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 82, 96, 4, 1, 97,
5, 204, 144, 97, 9, 173, 86, 91, 96, 64, 81, 128, 145, 3, 144, 253, 91, 129, 95, 95, 51, 115, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22,
115, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 22, 129, 82, 96, 32, 1, 144, 129, 82, 96, 32, 1, 95, 32, 95, 130, 130, 84, 97, 6, 32, 145,
144, 97, 9, 248, 86, 91, 146, 80, 80, 129, 144, 85, 80, 129, 95, 95, 133, 115, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 115, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 129,
82, 96, 32, 1, 144, 129, 82, 96, 32, 1, 95, 32, 95, 130, 130, 84, 97, 6, 114, 145, 144, 97, 10, 43,
86, 91, 146, 80, 80, 129, 144, 85, 80, 130, 115, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 51, 115, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 127, 221, 242, 82, 173, 27,
226, 200, 155, 105, 194, 176, 104, 252, 55, 141, 170, 149, 43, 167, 241, 99, 196, 161, 22, 40, 245,
90, 77, 245, 35, 179, 239, 132, 96, 64, 81, 97, 6, 214, 145, 144, 97, 8, 25, 86, 91, 96, 64, 81,
128, 145, 3, 144, 163, 96, 1, 144, 80, 146, 145, 80, 80, 86, 91, 96, 1, 96, 32, 82, 129, 95, 82,
96, 64, 95, 32, 96, 32, 82, 128, 95, 82, 96, 64, 95, 32, 95, 145, 80, 145, 80, 80, 84, 129, 86, 91,
95, 95, 253, 91, 95, 115, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 130, 22, 144, 80, 145, 144, 80, 86, 91, 95, 97, 7, 53, 130, 97, 7,
12, 86, 91, 144, 80, 145, 144, 80, 86, 91, 97, 7, 69, 129, 97, 7, 43, 86, 91, 129, 20, 97, 7, 79,
87, 95, 95, 253, 91, 80, 86, 91, 95, 129, 53, 144, 80, 97, 7, 96, 129, 97, 7, 60, 86, 91, 146, 145,
80, 80, 86, 91, 95, 129, 144, 80, 145, 144, 80, 86, 91, 97, 7, 120, 129, 97, 7, 102, 86, 91, 129,
20, 97, 7, 130, 87, 95, 95, 253, 91, 80, 86, 91, 95, 129, 53, 144, 80, 97, 7, 147, 129, 97, 7, 111,
86, 91, 146, 145, 80, 80, 86, 91, 95, 95, 96, 64, 131, 133, 3, 18, 21, 97, 7, 175, 87, 97, 7, 174,
97, 7, 8, 86, 91, 91, 95, 97, 7, 188, 133, 130, 134, 1, 97, 7, 82, 86, 91, 146, 80, 80, 96, 32, 97,
7, 205, 133, 130, 134, 1, 97, 7, 133, 86, 91, 145, 80, 80, 146, 80, 146, 144, 80, 86, 91, 95, 129,
21, 21, 144, 80, 145, 144, 80, 86, 91, 97, 7, 235, 129, 97, 7, 215, 86, 91, 130, 82, 80, 80, 86,
91, 95, 96, 32, 130, 1, 144, 80, 97, 8, 4, 95, 131, 1, 132, 97, 7, 226, 86, 91, 146, 145, 80, 80,
86, 91, 97, 8, 19, 129, 97, 7, 102, 86, 91, 130, 82, 80, 80, 86, 91, 95, 96, 32, 130, 1, 144, 80,
97, 8, 44, 95, 131, 1, 132, 97, 8, 10, 86, 91, 146, 145, 80, 80, 86, 91, 95, 95, 95, 96, 96, 132,
134, 3, 18, 21, 97, 8, 73, 87, 97, 8, 72, 97, 7, 8, 86, 91, 91, 95, 97, 8, 86, 134, 130, 135, 1,
97, 7, 82, 86, 91, 147, 80, 80, 96, 32, 97, 8, 103, 134, 130, 135, 1, 97, 7, 82, 86, 91, 146, 80,
80, 96, 64, 97, 8, 120, 134, 130, 135, 1, 97, 7, 133, 86, 91, 145, 80, 80, 146, 80, 146, 80, 146,
86, 91, 95, 96, 32, 130, 132, 3, 18, 21, 97, 8, 151, 87, 97, 8, 150, 97, 7, 8, 86, 91, 91, 95, 97,
8, 164, 132, 130, 133, 1, 97, 7, 82, 86, 91, 145, 80, 80, 146, 145, 80, 80, 86, 91, 95, 95, 96, 64,
131, 133, 3, 18, 21, 97, 8, 195, 87, 97, 8, 194, 97, 7, 8, 86, 91, 91, 95, 97, 8, 208, 133, 130,
134, 1, 97, 7, 82, 86, 91, 146, 80, 80, 96, 32, 97, 8, 225, 133, 130, 134, 1, 97, 7, 82, 86, 91,
145, 80, 80, 146, 80, 146, 144, 80, 86, 91, 95, 130, 130, 82, 96, 32, 130, 1, 144, 80, 146, 145,
80, 80, 86, 91, 127, 69, 82, 67, 50, 48, 58, 32, 105, 110, 115, 117, 102, 102, 105, 99, 105, 101,
110, 116, 32, 97, 108, 108, 111, 119, 97, 110, 99, 101, 0, 0, 0, 95, 130, 1, 82, 80, 86, 91, 95,
97, 9, 47, 96, 29, 131, 97, 8, 235, 86, 91, 145, 80, 97, 9, 58, 130, 97, 8, 251, 86, 91, 96, 32,
130, 1, 144, 80, 145, 144, 80, 86, 91, 95, 96, 32, 130, 1, 144, 80, 129, 129, 3, 95, 131, 1, 82,
97, 9, 92, 129, 97, 9, 35, 86, 91, 144, 80, 145, 144, 80, 86, 91, 127, 69, 82, 67, 50, 48, 58, 32,
105, 110, 115, 117, 102, 102, 105, 99, 105, 101, 110, 116, 32, 98, 97, 108, 97, 110, 99, 101, 0, 0,
0, 0, 0, 95, 130, 1, 82, 80, 86, 91, 95, 97, 9, 151, 96, 27, 131, 97, 8, 235, 86, 91, 145, 80, 97,
9, 162, 130, 97, 9, 99, 86, 91, 96, 32, 130, 1, 144, 80, 145, 144, 80, 86, 91, 95, 96, 32, 130, 1,
144, 80, 129, 129, 3, 95, 131, 1, 82, 97, 9, 196, 129, 97, 9, 139, 86, 91, 144, 80, 145, 144, 80,
86, 91, 127, 78, 72, 123, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 95, 82, 96, 17, 96, 4, 82, 96, 36, 95, 253, 91, 95, 97, 10, 2, 130, 97, 7, 102, 86,
91, 145, 80, 97, 10, 13, 131, 97, 7, 102, 86, 91, 146, 80, 130, 130, 3, 144, 80, 129, 129, 17, 21,
97, 10, 37, 87, 97, 10, 36, 97, 9, 203, 86, 91, 91, 146, 145, 80, 80, 86, 91, 95, 97, 10, 53, 130,
97, 7, 102, 86, 91, 145, 80, 97, 10, 64, 131, 97, 7, 102, 86, 91, 146, 80, 130, 130, 1, 144, 80,
128, 130, 17, 21, 97, 10, 88, 87, 97, 10, 87, 97, 9, 203, 86, 91, 91, 146, 145, 80, 80, 86, 254,
162, 100, 105, 112, 102, 115, 88, 34, 18, 32, 161, 128, 50, 41, 20, 78, 209, 13, 48, 81, 98, 5, 60,
170, 48, 113, 117, 235, 74, 39, 180, 167, 49, 5, 220, 216, 169, 41, 169, 39, 1, 209, 100, 115, 111,
108, 99, 67, 0, 8, 35, 0, 51
]⟩
/-! ## Constructor/initcode bytecode
For constructor-equivalence we use compact straight-line initcode, following `CtorStore` and
`SimpleAuction`: it enforces the nonpayable constructor guard, copies the appended ABI
`initialSupply` word, writes `balanceOf[msg.sender]`, writes `totalSupply`, and returns the deployed
runtime above.
-/
/-- Constructor prefix; the deployed runtime starts at byte offset 55. -/
def erc20CtorPrefix : ByteArray :=
⟨#[
0x34, -- CALLVALUE
0x80, -- DUP1
0x15, -- ISZERO
0x60, 0x09, -- PUSH1 0x09 ; nonpayable-ok target
0x57, -- JUMPI
0x5f, -- PUSH0
0x5f, -- PUSH0
0xfd, -- REVERT
0x5b, -- JUMPDEST
0x50, -- POP
0x60, 0x80, -- PUSH1 0x80
0x60, 0x40, -- PUSH1 0x40
0x52, -- MSTORE ; free-memory pointer word
0x60, 0x20, -- PUSH1 0x20 ; one ABI word
0x61, 0x0a, 0xcb, -- PUSH2 0x0acb ; initialSupply ABI word
0x60, 0x40, -- PUSH1 0x40 ; memory dst
0x39, -- CODECOPY
0x60, 0x40, -- PUSH1 0x40
0x51, -- MLOAD ; initialSupply
0x80, -- DUP1 ; keep a copy for totalSupply
0x33, -- CALLER
0x5f, -- PUSH0
0x52, -- MSTORE ; mapping key
0x5f, -- PUSH0 ; mapping base slot 0
0x60, 0x20, -- PUSH1 0x20
0x52, -- MSTORE
0x60, 0x40, -- PUSH1 0x40
0x5f, -- PUSH0
0x20, -- KECCAK256 ; balanceOf[msg.sender] slot
0x55, -- SSTORE
0x60, 0x02, -- PUSH1 0x02 ; totalSupply slot
0x55, -- SSTORE
0x61, 0x0a, 0x94, -- PUSH2 0x0a94 ; runtime length
0x60, 0x37, -- PUSH1 0x37 ; runtime offset
0x5f, -- PUSH0
0x39, -- CODECOPY
0x61, 0x0a, 0x94, -- PUSH2 0x0a94
0x5f, -- PUSH0
0xf3 -- RETURN
]⟩
/-- Pure creation/initcode for `ERC20`, without appended constructor ABI arguments. -/
def erc20Initcode : ByteArray := erc20CtorPrefix ++ erc20Bytecode
private lemma natRepr256 : Nat.repr 256 = "256" := by
decide +kernel
private lemma erc20ApproveSigStr :
Stele.transitionSigStr ERC20.approveTransition = "approve(address,uint256)" := by
simp [ERC20.approveTransition, Stele.transitionSigStr, ABI.printSignature,
transitionSignature, ERC20.uint256, ERC20.addr, ABI.abiToSigStr, ABI.elemToSigStr,
ERC20.uint256Int, ABI.intTypeToSigStr, natRepr256]
decide +kernel
private lemma erc20TotalSupplySigStr :
Stele.transitionSigStr ERC20.totalSupplyTransition = "totalSupply()" := by
rfl
private lemma erc20TransferFromSigStr :
Stele.transitionSigStr ERC20.transferFromTransition =
"transferFrom(address,address,uint256)" := by
simp [ERC20.transferFromTransition, Stele.transitionSigStr, ABI.printSignature,
transitionSignature, ERC20.uint256, ERC20.addr, ABI.abiToSigStr, ABI.elemToSigStr,
ERC20.uint256Int, ABI.intTypeToSigStr, natRepr256]
decide +kernel
private lemma erc20BalanceOfSigStr :
Stele.transitionSigStr ERC20.balanceOfTransition = "balanceOf(address)" := by
simp [ERC20.balanceOfTransition, Stele.transitionSigStr, ABI.printSignature,
transitionSignature, ERC20.addr, ABI.abiToSigStr, ABI.elemToSigStr]
decide +kernel
private lemma erc20TransferSigStr :
Stele.transitionSigStr ERC20.transferTransition = "transfer(address,uint256)" := by
simp [ERC20.transferTransition, Stele.transitionSigStr, ABI.printSignature,
transitionSignature, ERC20.uint256, ERC20.addr, ABI.abiToSigStr, ABI.elemToSigStr,
ERC20.uint256Int, ABI.intTypeToSigStr, natRepr256]
decide +kernel
private lemma erc20AllowanceSigStr :
Stele.transitionSigStr ERC20.allowanceTransition = "allowance(address,address)" := by
simp [ERC20.allowanceTransition, Stele.transitionSigStr, ABI.printSignature,
transitionSignature, ERC20.addr, ABI.abiToSigStr, ABI.elemToSigStr]
decide +kernel
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
/-- `keccak("approve(address,uint256)")[0:4] = 0x095ea7b3`. -/
lemma erc20ApproveSelectorBytes :
(KEC (String.toByteArray (Stele.transitionSigStr ERC20.approveTransition))).extract 0 4
= ⟨#[0x09, 0x5e, 0xa7, 0xb3]⟩ := by
rw [erc20ApproveSigStr]
decide +kernel
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
/-- `keccak("totalSupply()")[0:4] = 0x18160ddd`. -/
lemma erc20TotalSupplySelectorBytes :
(KEC (String.toByteArray (Stele.transitionSigStr ERC20.totalSupplyTransition))).extract 0 4
= ⟨#[0x18, 0x16, 0x0d, 0xdd]⟩ := by
rw [erc20TotalSupplySigStr]
decide +kernel
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
/-- `keccak("transferFrom(address,address,uint256)")[0:4] = 0x23b872dd`. -/
lemma erc20TransferFromSelectorBytes :
(KEC (String.toByteArray (Stele.transitionSigStr ERC20.transferFromTransition))).extract 0 4
= ⟨#[0x23, 0xb8, 0x72, 0xdd]⟩ := by
rw [erc20TransferFromSigStr]
decide +kernel
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
/-- `keccak("balanceOf(address)")[0:4] = 0x70a08231`. -/
lemma erc20BalanceOfSelectorBytes :
(KEC (String.toByteArray (Stele.transitionSigStr ERC20.balanceOfTransition))).extract 0 4
= ⟨#[0x70, 0xa0, 0x82, 0x31]⟩ := by
rw [erc20BalanceOfSigStr]
decide +kernel
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
/-- `keccak("transfer(address,uint256)")[0:4] = 0xa9059cbb`. -/
lemma erc20TransferSelectorBytes :
(KEC (String.toByteArray (Stele.transitionSigStr ERC20.transferTransition))).extract 0 4
= ⟨#[0xa9, 0x05, 0x9c, 0xbb]⟩ := by
rw [erc20TransferSigStr]
decide +kernel
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
/-- `keccak("allowance(address,address)")[0:4] = 0xdd62ed3e`. -/
lemma erc20AllowanceSelectorBytes :
(KEC (String.toByteArray (Stele.transitionSigStr ERC20.allowanceTransition))).extract 0 4
= ⟨#[0xdd, 0x62, 0xed, 0x3e]⟩ := by
rw [erc20AllowanceSigStr]
decide +kernel
/-- The `JUMPDEST` set of `erc20Bytecode` (computed with PUSH-data skipping). -/
@[valid_jumps] theorem erc20ValidJumps :
Ethereum.EVM.D_J erc20Bytecode 0
= #[⟨15⟩, ⟨96⟩, ⟨100⟩, ⟨121⟩, ⟨126⟩, ⟨139⟩, ⟨148⟩, ⟨156⟩, ⟨169⟩, ⟨178⟩, ⟨199⟩,
⟨204⟩, ⟨217⟩, ⟨226⟩, ⟨247⟩, ⟨252⟩, ⟨265⟩, ⟨274⟩, ⟨295⟩, ⟨300⟩, ⟨313⟩, ⟨322⟩,
⟨343⟩, ⟨348⟩, ⟨361⟩, ⟨370⟩, ⟨589⟩, ⟨607⟩, ⟨613⟩, ⟨796⟩, ⟨805⟩, ⟨923⟩, ⟨932⟩,
⟨944⟩, ⟨1143⟩, ⟨1225⟩, ⟨1325⟩, ⟨1345⟩, ⟨1365⟩, ⟨1484⟩, ⟨1493⟩, ⟨1568⟩, ⟨1650⟩,
⟨1750⟩, ⟨1768⟩, ⟨1800⟩, ⟨1804⟩, ⟨1835⟩, ⟨1845⟩, ⟨1852⟩, ⟨1861⟩, ⟨1871⟩, ⟨1874⟩,
⟨1888⟩, ⟨1894⟩, ⟨1903⟩, ⟨1912⟩, ⟨1922⟩, ⟨1925⟩, ⟨1939⟩, ⟨1945⟩, ⟨1966⟩, ⟨1967⟩,
⟨1980⟩, ⟨1997⟩, ⟨2007⟩, ⟨2018⟩, ⟨2027⟩, ⟨2033⟩, ⟨2052⟩, ⟨2058⟩, ⟨2067⟩, ⟨2073⟩,
⟨2092⟩, ⟨2098⟩, ⟨2120⟩, ⟨2121⟩, ⟨2134⟩, ⟨2151⟩, ⟨2168⟩, ⟨2178⟩, ⟨2198⟩, ⟨2199⟩,
⟨2212⟩, ⟨2221⟩, ⟨2242⟩, ⟨2243⟩, ⟨2256⟩, ⟨2273⟩, ⟨2283⟩, ⟨2299⟩, ⟨2339⟩, ⟨2351⟩,
⟨2362⟩, ⟨2373⟩, ⟨2396⟩, ⟨2403⟩, ⟨2443⟩, ⟨2455⟩, ⟨2466⟩, ⟨2477⟩, ⟨2500⟩, ⟨2507⟩,
⟨2552⟩, ⟨2562⟩, ⟨2573⟩, ⟨2596⟩, ⟨2597⟩, ⟨2603⟩, ⟨2613⟩, ⟨2624⟩, ⟨2647⟩, ⟨2648⟩]
:= by native_decide