tealrb 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/tealrb/abi.rb +43 -0
- data/lib/tealrb/cmd_line/teal2tealrb.rb +66 -0
- data/lib/tealrb/constants.rb +5 -0
- data/lib/tealrb/contract.rb +253 -0
- data/lib/tealrb/if_block.rb +44 -0
- data/lib/tealrb/opcode_modules.rb +701 -0
- data/lib/tealrb/opcodes.rb +661 -0
- data/lib/tealrb/patches.rb +6 -0
- data/lib/tealrb/rewriters.rb +149 -0
- data/lib/tealrb.rb +51 -0
- metadata +152 -0
@@ -0,0 +1,661 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TEALrb
|
4
|
+
module Opcodes
|
5
|
+
BINARY_OPCODE_METHOD_MAPPING = {
|
6
|
+
'+': 'add',
|
7
|
+
'-': 'subtract',
|
8
|
+
'<': 'less',
|
9
|
+
'>': 'greater',
|
10
|
+
'<=': 'less_eq',
|
11
|
+
'>=': 'greater_eq',
|
12
|
+
'/': 'divide',
|
13
|
+
'==': 'equal',
|
14
|
+
'&': 'bitwise_and',
|
15
|
+
'!=': 'not_equal',
|
16
|
+
'*': 'multiply',
|
17
|
+
'&&': 'boolean_and',
|
18
|
+
'||': 'boolean_or',
|
19
|
+
'%': 'modulo',
|
20
|
+
'|': 'bitwise_or',
|
21
|
+
'^': 'bitwise_xor',
|
22
|
+
'~': 'bitwise_invert',
|
23
|
+
'b+': 'big_endian_add',
|
24
|
+
'b-': 'big_endian_subtract',
|
25
|
+
'b/': 'big_endian_divide',
|
26
|
+
'b*': 'big_endian_multiply',
|
27
|
+
'b<': 'big_endian_less',
|
28
|
+
'b>': 'big_endian_more',
|
29
|
+
'b<=': 'big_endian_less_eq',
|
30
|
+
'b>=': 'big_endian_more_eq',
|
31
|
+
'b==': 'big_endian_equal',
|
32
|
+
'b!=': 'big_endian_not_equal',
|
33
|
+
'b%': 'big_endian_modulo',
|
34
|
+
'b|': 'padded_bitwise_or',
|
35
|
+
'b&': 'padded_bitwise_and',
|
36
|
+
'b^': 'padded_bitwise_xor',
|
37
|
+
'b~': 'bitwise_byte_invert'
|
38
|
+
}.freeze
|
39
|
+
|
40
|
+
UNARY_OPCODE_METHOD_MAPPING = {
|
41
|
+
'!': 'zero?'
|
42
|
+
}.freeze
|
43
|
+
|
44
|
+
def acct_params_get(field, _account = nil)
|
45
|
+
TEALrb::TEAL.current[Thread.current] << "acct_params_get #{field}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def add(_a = nil, _b = nil)
|
49
|
+
TEALrb::TEAL.current[Thread.current] << '+'
|
50
|
+
end
|
51
|
+
|
52
|
+
def addr(address)
|
53
|
+
TEALrb::TEAL.current[Thread.current] << "addr #{address}"
|
54
|
+
end
|
55
|
+
|
56
|
+
def addw(_a = nil, _b = nil)
|
57
|
+
TEALrb::TEAL.current[Thread.current] << 'addw'
|
58
|
+
end
|
59
|
+
|
60
|
+
def app_global_del(_key = nil)
|
61
|
+
TEALrb::TEAL.current[Thread.current] << 'app_global_del'
|
62
|
+
end
|
63
|
+
|
64
|
+
def app_global_get(_key = nil)
|
65
|
+
TEALrb::TEAL.current[Thread.current] << 'app_global_get'
|
66
|
+
end
|
67
|
+
|
68
|
+
def app_global_get_ex(_app = nil, _key = nil)
|
69
|
+
TEALrb::TEAL.current[Thread.current] << 'app_global_get_ex'
|
70
|
+
end
|
71
|
+
|
72
|
+
def app_global_put(_key = nil, _value = nil)
|
73
|
+
TEALrb::TEAL.current[Thread.current] << 'app_global_put'
|
74
|
+
end
|
75
|
+
|
76
|
+
def app_local_del(_account = nil, _key = nil)
|
77
|
+
TEALrb::TEAL.current[Thread.current] << 'app_local_del'
|
78
|
+
end
|
79
|
+
|
80
|
+
def app_local_get(_account = nil, _key = nil)
|
81
|
+
TEALrb::TEAL.current[Thread.current] << 'app_local_get'
|
82
|
+
end
|
83
|
+
|
84
|
+
def app_local_get_ex(_account = nil, _application = nil, _key = nil)
|
85
|
+
TEALrb::TEAL.current[Thread.current] << 'app_local_get_ex'
|
86
|
+
end
|
87
|
+
|
88
|
+
def app_local_put(_account = nil, _key = nil, _value = nil)
|
89
|
+
TEALrb::TEAL.current[Thread.current] << 'app_local_put'
|
90
|
+
end
|
91
|
+
|
92
|
+
def app_opted_in(_account = nil, _app = nil)
|
93
|
+
TEALrb::TEAL.current[Thread.current] << 'app_opted_in'
|
94
|
+
end
|
95
|
+
|
96
|
+
def app_params_get(field, _app_id = nil)
|
97
|
+
TEALrb::TEAL.current[Thread.current] << "app_params_get #{field}"
|
98
|
+
end
|
99
|
+
|
100
|
+
def approve
|
101
|
+
TEALrb::TEAL.current[Thread.current] << 'int 1'
|
102
|
+
TEALrb::TEAL.current[Thread.current] << 'return'
|
103
|
+
end
|
104
|
+
|
105
|
+
def arg(index)
|
106
|
+
TEALrb::TEAL.current[Thread.current] << "arg #{index}"
|
107
|
+
end
|
108
|
+
|
109
|
+
def arg_0 # rubocop:disable Naming/VariableNumber
|
110
|
+
TEALrb::TEAL.current[Thread.current] << 'arg_0'
|
111
|
+
end
|
112
|
+
|
113
|
+
def arg_1 # rubocop:disable Naming/VariableNumber
|
114
|
+
TEALrb::TEAL.current[Thread.current] << 'arg_1'
|
115
|
+
end
|
116
|
+
|
117
|
+
def arg_2 # rubocop:disable Naming/VariableNumber
|
118
|
+
TEALrb::TEAL.current[Thread.current] << 'arg_2'
|
119
|
+
end
|
120
|
+
|
121
|
+
def arg_3 # rubocop:disable Naming/VariableNumber
|
122
|
+
TEALrb::TEAL.current[Thread.current] << 'arg_3'
|
123
|
+
end
|
124
|
+
|
125
|
+
def args(_index = nil)
|
126
|
+
TEALrb::TEAL.current[Thread.current] << 'args'
|
127
|
+
end
|
128
|
+
|
129
|
+
def assert(_expr = nil)
|
130
|
+
TEALrb::TEAL.current[Thread.current] << 'assert'
|
131
|
+
end
|
132
|
+
|
133
|
+
def asset_holding_get(field, _account = nil, _asset = nil)
|
134
|
+
TEALrb::TEAL.current[Thread.current] << "asset_holding_get #{field}"
|
135
|
+
end
|
136
|
+
|
137
|
+
def asset_params_get(field, _asset = nil)
|
138
|
+
TEALrb::TEAL.current[Thread.current] << "asset_params_get #{field}"
|
139
|
+
end
|
140
|
+
|
141
|
+
def b(target)
|
142
|
+
TEALrb::TEAL.current[Thread.current] << "#{__method__} #{target}"
|
143
|
+
end
|
144
|
+
|
145
|
+
def base32(input)
|
146
|
+
TEALrb::TEAL.current[Thread.current] << "byte base32(#{input})"
|
147
|
+
end
|
148
|
+
|
149
|
+
def balance(_account = nil)
|
150
|
+
TEALrb::TEAL.current[Thread.current] << 'balance'
|
151
|
+
end
|
152
|
+
|
153
|
+
def big_endian_add(_a = nil, _b = nil)
|
154
|
+
TEALrb::TEAL.current[Thread.current] << 'b+'
|
155
|
+
end
|
156
|
+
|
157
|
+
def big_endian_divide(_a = nil, _b = nil)
|
158
|
+
TEALrb::TEAL.current[Thread.current] << 'b/'
|
159
|
+
end
|
160
|
+
|
161
|
+
def big_endian_equal(_a = nil, _b = nil)
|
162
|
+
TEALrb::TEAL.current[Thread.current] << 'b=='
|
163
|
+
end
|
164
|
+
|
165
|
+
def big_endian_less(_a = nil, _b = nil)
|
166
|
+
TEALrb::TEAL.current[Thread.current] << 'b<'
|
167
|
+
end
|
168
|
+
|
169
|
+
def big_endian_less_eq(_a = nil, _b = nil)
|
170
|
+
TEALrb::TEAL.current[Thread.current] << 'b<='
|
171
|
+
end
|
172
|
+
|
173
|
+
def big_endian_modulo(_a = nil, _b = nil)
|
174
|
+
TEALrb::TEAL.current[Thread.current] << 'b%'
|
175
|
+
end
|
176
|
+
|
177
|
+
def big_endian_more(_a = nil, _b = nil)
|
178
|
+
TEALrb::TEAL.current[Thread.current] << 'b>'
|
179
|
+
end
|
180
|
+
|
181
|
+
def big_endian_more_eq(_a = nil, _b = nil)
|
182
|
+
TEALrb::TEAL.current[Thread.current] << 'b>='
|
183
|
+
end
|
184
|
+
|
185
|
+
def big_endian_multiply(_a = nil, _b = nil)
|
186
|
+
TEALrb::TEAL.current[Thread.current] << 'b*'
|
187
|
+
end
|
188
|
+
|
189
|
+
def big_endian_not_equal(_a = nil, _b = nil)
|
190
|
+
TEALrb::TEAL.current[Thread.current] << 'b!='
|
191
|
+
end
|
192
|
+
|
193
|
+
def big_endian_subtract(_a = nil, _b = nil)
|
194
|
+
TEALrb::TEAL.current[Thread.current] << 'b-'
|
195
|
+
end
|
196
|
+
|
197
|
+
def bitlen(_input = nil)
|
198
|
+
TEALrb::TEAL.current[Thread.current] << 'bitlen'
|
199
|
+
end
|
200
|
+
|
201
|
+
def bitwise_and(_a = nil, _b = nil)
|
202
|
+
TEALrb::TEAL.current[Thread.current] << '&'
|
203
|
+
end
|
204
|
+
|
205
|
+
def bitwise_byte_invert(_a = nil, _b = nil)
|
206
|
+
TEALrb::TEAL.current[Thread.current] << 'b~'
|
207
|
+
end
|
208
|
+
|
209
|
+
def bitwise_invert(_a = nil, _b = nil)
|
210
|
+
TEALrb::TEAL.current[Thread.current] << '~'
|
211
|
+
end
|
212
|
+
|
213
|
+
def bitwise_or(_a = nil, _b = nil)
|
214
|
+
TEALrb::TEAL.current[Thread.current] << '|'
|
215
|
+
end
|
216
|
+
|
217
|
+
def bitwise_xor(_a = nil, _b = nil)
|
218
|
+
TEALrb::TEAL.current[Thread.current] << '^'
|
219
|
+
end
|
220
|
+
|
221
|
+
def bnz(target)
|
222
|
+
TEALrb::TEAL.current[Thread.current] << "#{__method__} #{target}"
|
223
|
+
end
|
224
|
+
|
225
|
+
def bsqrt(_big_endian_uint = nil)
|
226
|
+
TEALrb::TEAL.current[Thread.current] << 'bsqrt'
|
227
|
+
end
|
228
|
+
|
229
|
+
def btoi(_bytes = nil)
|
230
|
+
TEALrb::TEAL.current[Thread.current] << 'btoi'
|
231
|
+
end
|
232
|
+
|
233
|
+
def byte(string)
|
234
|
+
TEALrb::TEAL.current[Thread.current] << "byte \"#{string}\""
|
235
|
+
end
|
236
|
+
|
237
|
+
def bytec(index)
|
238
|
+
TEALrb::TEAL.current[Thread.current] << "bytec #{index}"
|
239
|
+
end
|
240
|
+
|
241
|
+
def bytec_0 # rubocop:disable Naming/VariableNumber
|
242
|
+
TEALrb::TEAL.current[Thread.current] << 'bytec_0'
|
243
|
+
end
|
244
|
+
|
245
|
+
def bytec_1 # rubocop:disable Naming/VariableNumber
|
246
|
+
TEALrb::TEAL.current[Thread.current] << 'bytec_1'
|
247
|
+
end
|
248
|
+
|
249
|
+
def bytec_2 # rubocop:disable Naming/VariableNumber
|
250
|
+
TEALrb::TEAL.current[Thread.current] << 'bytec_2'
|
251
|
+
end
|
252
|
+
|
253
|
+
def bytec_3 # rubocop:disable Naming/VariableNumber
|
254
|
+
TEALrb::TEAL.current[Thread.current] << 'bytec_3'
|
255
|
+
end
|
256
|
+
|
257
|
+
def bytecblock(*bytes)
|
258
|
+
TEALrb::TEAL.current[Thread.current] << "bytecblock #{bytes.join(' ')}"
|
259
|
+
end
|
260
|
+
|
261
|
+
def bz(target)
|
262
|
+
TEALrb::TEAL.current[Thread.current] << "#{__method__} #{target}"
|
263
|
+
end
|
264
|
+
|
265
|
+
def bzero(_length = nil)
|
266
|
+
TEALrb::TEAL.current[Thread.current] << 'bzero'
|
267
|
+
end
|
268
|
+
|
269
|
+
def callsub(name, *_args)
|
270
|
+
TEALrb::TEAL.current[Thread.current] << "callsub #{name}"
|
271
|
+
end
|
272
|
+
|
273
|
+
def concat(_a = nil, _b = nil)
|
274
|
+
TEALrb::TEAL.current[Thread.current] << 'concat'
|
275
|
+
end
|
276
|
+
|
277
|
+
def cover(count)
|
278
|
+
TEALrb::TEAL.current[Thread.current] << "cover #{count}"
|
279
|
+
end
|
280
|
+
|
281
|
+
def dig(index)
|
282
|
+
TEALrb::TEAL.current[Thread.current] << "dig #{index}"
|
283
|
+
end
|
284
|
+
|
285
|
+
def divide(_a = nil, _b = nil)
|
286
|
+
TEALrb::TEAL.current[Thread.current] << '/'
|
287
|
+
end
|
288
|
+
|
289
|
+
def divmodw(_a = nil, _b = nil)
|
290
|
+
TEALrb::TEAL.current[Thread.current] << 'divmodw'
|
291
|
+
end
|
292
|
+
|
293
|
+
def divw(_a = nil, _b = nil)
|
294
|
+
TEALrb::TEAL.current[Thread.current] << 'divw'
|
295
|
+
end
|
296
|
+
|
297
|
+
def dup(_expr = nil)
|
298
|
+
TEALrb::TEAL.current[Thread.current] << 'dup'
|
299
|
+
end
|
300
|
+
|
301
|
+
def dup2(_expr_a = nil, _expr_b = nil)
|
302
|
+
TEALrb::TEAL.current[Thread.current] << 'dup2'
|
303
|
+
end
|
304
|
+
|
305
|
+
def ecdsa_pk_decompress(index, _input = nil)
|
306
|
+
TEALrb::TEAL.current[Thread.current] << "ecdsa_pk_decompress #{index}"
|
307
|
+
end
|
308
|
+
|
309
|
+
def ecdsa_pk_recover(index, _input = nil)
|
310
|
+
TEALrb::TEAL.current[Thread.current] << "ecdsa_pk_recover #{index}"
|
311
|
+
end
|
312
|
+
|
313
|
+
def ecdsa_verify(index, _input = nil)
|
314
|
+
TEALrb::TEAL.current[Thread.current] << "ecdsa_verify #{index}"
|
315
|
+
end
|
316
|
+
|
317
|
+
def ed25519verify(_input = nil)
|
318
|
+
TEALrb::TEAL.current[Thread.current] << 'ed25519verify'
|
319
|
+
end
|
320
|
+
|
321
|
+
def equal(_a = nil, _b = nil)
|
322
|
+
TEALrb::TEAL.current[Thread.current] << '=='
|
323
|
+
end
|
324
|
+
|
325
|
+
def err
|
326
|
+
TEALrb::TEAL.current[Thread.current] << 'err'
|
327
|
+
end
|
328
|
+
|
329
|
+
def exp(_a = nil, _b = nil)
|
330
|
+
TEALrb::TEAL.current[Thread.current] << 'exp'
|
331
|
+
end
|
332
|
+
|
333
|
+
def expw(_a = nil, _b = nil)
|
334
|
+
TEALrb::TEAL.current[Thread.current] << 'expw'
|
335
|
+
end
|
336
|
+
|
337
|
+
def extract(start, length, _byte_array = nil)
|
338
|
+
TEALrb::TEAL.current[Thread.current] << "extract #{start} #{length}"
|
339
|
+
end
|
340
|
+
|
341
|
+
def extract3(_byte_array = nil, _start = nil, _exclusive_end = nil)
|
342
|
+
TEALrb::TEAL.current[Thread.current] << 'extract3'
|
343
|
+
end
|
344
|
+
|
345
|
+
def extract_uint16(_byte_array = nil, _start = nil)
|
346
|
+
TEALrb::TEAL.current[Thread.current] << 'extract_uint16'
|
347
|
+
end
|
348
|
+
|
349
|
+
def extract_uint32(_byte_array = nil, _start = nil)
|
350
|
+
TEALrb::TEAL.current[Thread.current] << 'extract_uint32'
|
351
|
+
end
|
352
|
+
|
353
|
+
def extract_uint64(_byte_array = nil, _start = nil)
|
354
|
+
TEALrb::TEAL.current[Thread.current] << 'extract_uint64'
|
355
|
+
end
|
356
|
+
|
357
|
+
def gaid(transaction_index)
|
358
|
+
TEALrb::TEAL.current[Thread.current] << "gaid #{transaction_index}"
|
359
|
+
end
|
360
|
+
|
361
|
+
def gaids(_transaction = nil)
|
362
|
+
TEALrb::TEAL.current[Thread.current] << 'gaids'
|
363
|
+
end
|
364
|
+
|
365
|
+
def getbit(_input = nil, _bit_index = nil)
|
366
|
+
TEALrb::TEAL.current[Thread.current] << 'getbit'
|
367
|
+
end
|
368
|
+
|
369
|
+
def getbyte(_input = nil, _byte_index = nil)
|
370
|
+
TEALrb::TEAL.current[Thread.current] << 'getbyte'
|
371
|
+
end
|
372
|
+
|
373
|
+
def gitxn(transaction_index, field)
|
374
|
+
TEALrb::TEAL.current[Thread.current] << "gitxn #{transaction_index} #{field}"
|
375
|
+
end
|
376
|
+
|
377
|
+
def gitxna(transaction_index, field, index)
|
378
|
+
TEALrb::TEAL.current[Thread.current] << "gitxna #{transaction_index} #{field} #{index}"
|
379
|
+
end
|
380
|
+
|
381
|
+
def gitxnas(transaction_index, field, _index = nil)
|
382
|
+
TEALrb::TEAL.current[Thread.current] << "gitxnas #{transaction_index} #{field}"
|
383
|
+
end
|
384
|
+
|
385
|
+
def gload(transaction_index, index)
|
386
|
+
TEALrb::TEAL.current[Thread.current] << "gload #{transaction_index} #{index}"
|
387
|
+
end
|
388
|
+
|
389
|
+
def gloads(index, _transaction_index = nil)
|
390
|
+
TEALrb::TEAL.current[Thread.current] << "gloads #{index}"
|
391
|
+
end
|
392
|
+
|
393
|
+
def gloadss(_transaction = nil, _index = nil)
|
394
|
+
TEALrb::TEAL.current[Thread.current] << 'gloadss'
|
395
|
+
end
|
396
|
+
|
397
|
+
def global(field)
|
398
|
+
TEALrb::TEAL.current[Thread.current] << "global #{field}"
|
399
|
+
end
|
400
|
+
|
401
|
+
def greater(_a = nil, _b = nil)
|
402
|
+
TEALrb::TEAL.current[Thread.current] << '>'
|
403
|
+
end
|
404
|
+
|
405
|
+
def greater_eq(_a = nil, _b = nil)
|
406
|
+
TEALrb::TEAL.current[Thread.current] << '>='
|
407
|
+
end
|
408
|
+
|
409
|
+
def gtxn(index, field)
|
410
|
+
TEALrb::TEAL.current[Thread.current] << "gtxn #{index} #{field}"
|
411
|
+
end
|
412
|
+
|
413
|
+
def gtxna(transaction_index, field, index)
|
414
|
+
TEALrb::TEAL.current[Thread.current] << "gtxna #{transaction_index} #{field} #{index}"
|
415
|
+
end
|
416
|
+
|
417
|
+
def gtxns(field, _transaction_index = nil)
|
418
|
+
TEALrb::TEAL.current[Thread.current] << "gtxns #{field}"
|
419
|
+
end
|
420
|
+
|
421
|
+
def gtxnsa(field, index, _transaction_index = nil)
|
422
|
+
TEALrb::TEAL.current[Thread.current] << "gtxnsa #{field} #{index}"
|
423
|
+
end
|
424
|
+
|
425
|
+
def gtxnas(transaction_index, field, _index = nil)
|
426
|
+
TEALrb::TEAL.current[Thread.current] << "gtxnas #{transaction_index} #{field}"
|
427
|
+
end
|
428
|
+
|
429
|
+
def gtxnsas(field, _transaction_index = nil, _index = nil)
|
430
|
+
TEALrb::TEAL.current[Thread.current] << "gtxnsas #{field}"
|
431
|
+
end
|
432
|
+
|
433
|
+
def int(integer)
|
434
|
+
TEALrb::TEAL.current[Thread.current] << "int #{integer}"
|
435
|
+
end
|
436
|
+
|
437
|
+
def intc(index)
|
438
|
+
TEALrb::TEAL.current[Thread.current] << "intc #{index}"
|
439
|
+
end
|
440
|
+
|
441
|
+
def intc_0 # rubocop:disable Naming/VariableNumber
|
442
|
+
TEALrb::TEAL.current[Thread.current] << 'intc_0'
|
443
|
+
end
|
444
|
+
|
445
|
+
def intc_1 # rubocop:disable Naming/VariableNumber
|
446
|
+
TEALrb::TEAL.current[Thread.current] << 'intc_1'
|
447
|
+
end
|
448
|
+
|
449
|
+
def intc_2 # rubocop:disable Naming/VariableNumber
|
450
|
+
TEALrb::TEAL.current[Thread.current] << 'intc_2'
|
451
|
+
end
|
452
|
+
|
453
|
+
def intc_3 # rubocop:disable Naming/VariableNumber
|
454
|
+
TEALrb::TEAL.current[Thread.current] << 'intc_3'
|
455
|
+
end
|
456
|
+
|
457
|
+
def intcblock(*ints)
|
458
|
+
TEALrb::TEAL.current[Thread.current] << "intcblock #{ints.join(' ')}"
|
459
|
+
end
|
460
|
+
|
461
|
+
def itob(_bytes = nil)
|
462
|
+
TEALrb::TEAL.current[Thread.current] << 'itob'
|
463
|
+
end
|
464
|
+
|
465
|
+
def itxn_begin
|
466
|
+
TEALrb::TEAL.current[Thread.current] << 'itxn_begin'
|
467
|
+
end
|
468
|
+
|
469
|
+
def itxn_field(field, _value = nil)
|
470
|
+
TEALrb::TEAL.current[Thread.current] << "itxn_field #{field}"
|
471
|
+
end
|
472
|
+
|
473
|
+
def itxn_next
|
474
|
+
TEALrb::TEAL.current[Thread.current] << 'itxn_next'
|
475
|
+
end
|
476
|
+
|
477
|
+
def itxn_submit
|
478
|
+
TEALrb::TEAL.current[Thread.current] << 'itxn_submit'
|
479
|
+
end
|
480
|
+
|
481
|
+
def itxna(field, index)
|
482
|
+
TEALrb::TEAL.current[Thread.current] << "itxna #{field} #{index}"
|
483
|
+
end
|
484
|
+
|
485
|
+
def itxnas(field, _index = nil)
|
486
|
+
TEALrb::TEAL.current[Thread.current] << "itxnas #{field}"
|
487
|
+
end
|
488
|
+
|
489
|
+
def keccak256(_input = nil)
|
490
|
+
TEALrb::TEAL.current[Thread.current] << 'keccak256'
|
491
|
+
end
|
492
|
+
|
493
|
+
def label(label_name)
|
494
|
+
TEALrb::TEAL.current[Thread.current] << "#{label_name}:"
|
495
|
+
end
|
496
|
+
|
497
|
+
def len(_input = nil)
|
498
|
+
TEALrb::TEAL.current[Thread.current] << 'len'
|
499
|
+
end
|
500
|
+
|
501
|
+
def less(_a = nil, _b = nil)
|
502
|
+
TEALrb::TEAL.current[Thread.current] << '<'
|
503
|
+
end
|
504
|
+
|
505
|
+
def less_eq(_a = nil, _b = nil)
|
506
|
+
TEALrb::TEAL.current[Thread.current] << '<='
|
507
|
+
end
|
508
|
+
|
509
|
+
def load(index)
|
510
|
+
TEALrb::TEAL.current[Thread.current] << "load #{index}"
|
511
|
+
end
|
512
|
+
|
513
|
+
def loads(_index = nil)
|
514
|
+
TEALrb::TEAL.current[Thread.current] << 'loads'
|
515
|
+
end
|
516
|
+
|
517
|
+
def log(_byte_array = nil)
|
518
|
+
TEALrb::TEAL.current[Thread.current] << 'log'
|
519
|
+
end
|
520
|
+
|
521
|
+
def method_signature(signature)
|
522
|
+
TEALrb::TEAL.current[Thread.current] << %(method "#{signature}")
|
523
|
+
end
|
524
|
+
|
525
|
+
def min_balance(_account = nil)
|
526
|
+
TEALrb::TEAL.current[Thread.current] << 'min_balance'
|
527
|
+
end
|
528
|
+
|
529
|
+
def modulo(_a = nil, _b = nil)
|
530
|
+
TEALrb::TEAL.current[Thread.current] << '%'
|
531
|
+
end
|
532
|
+
|
533
|
+
def multiply(_a = nil, _b = nil)
|
534
|
+
TEALrb::TEAL.current[Thread.current] << '*'
|
535
|
+
end
|
536
|
+
|
537
|
+
def mulw(_a = nil, _b = nil)
|
538
|
+
TEALrb::TEAL.current[Thread.current] << 'mulw'
|
539
|
+
end
|
540
|
+
|
541
|
+
def zero?(_expr = nil)
|
542
|
+
TEALrb::TEAL.current[Thread.current] << '!'
|
543
|
+
end
|
544
|
+
|
545
|
+
def not_equal(_a = nil, _b = nil)
|
546
|
+
TEALrb::TEAL.current[Thread.current] << '!='
|
547
|
+
end
|
548
|
+
|
549
|
+
def padded_bitwise_and(_a = nil, _b = nil)
|
550
|
+
TEALrb::TEAL.current[Thread.current] << 'b&'
|
551
|
+
end
|
552
|
+
|
553
|
+
def padded_bitwise_or(_a = nil, _b = nil)
|
554
|
+
TEALrb::TEAL.current[Thread.current] << 'b|'
|
555
|
+
end
|
556
|
+
|
557
|
+
def padded_bitwise_xor(_a = nil, _b = nil)
|
558
|
+
TEALrb::TEAL.current[Thread.current] << 'b^'
|
559
|
+
end
|
560
|
+
|
561
|
+
def pop(_expr = nil)
|
562
|
+
TEALrb::TEAL.current[Thread.current] << 'pop'
|
563
|
+
end
|
564
|
+
|
565
|
+
def pushbytes(string)
|
566
|
+
TEALrb::TEAL.current[Thread.current] << "pushbytes \"#{string}\""
|
567
|
+
end
|
568
|
+
|
569
|
+
def pushint(integer)
|
570
|
+
TEALrb::TEAL.current[Thread.current] << "pushint #{integer}"
|
571
|
+
end
|
572
|
+
|
573
|
+
def retsub
|
574
|
+
TEALrb::TEAL.current[Thread.current] << 'retsub'
|
575
|
+
end
|
576
|
+
|
577
|
+
def select(_expr_a = nil, _expr_b = nil, _expr_c = nil)
|
578
|
+
TEALrb::TEAL.current[Thread.current] << 'select'
|
579
|
+
end
|
580
|
+
|
581
|
+
def setbit(_input = nil, _bit_index = nil, _value = nil)
|
582
|
+
TEALrb::TEAL.current[Thread.current] << 'setbit'
|
583
|
+
end
|
584
|
+
|
585
|
+
def setbyte(_byte_array = nil, _byte_index = nil, _value = nil)
|
586
|
+
TEALrb::TEAL.current[Thread.current] << 'setbyte'
|
587
|
+
end
|
588
|
+
|
589
|
+
def sha256(_input = nil)
|
590
|
+
TEALrb::TEAL.current[Thread.current] << 'sha256'
|
591
|
+
end
|
592
|
+
|
593
|
+
def sha512_256(_input = nil) # rubocop:disable Naming/VariableNumber
|
594
|
+
TEALrb::TEAL.current[Thread.current] << 'sha512_256'
|
595
|
+
end
|
596
|
+
|
597
|
+
def shl(_a = nil, _b = nil)
|
598
|
+
TEALrb::TEAL.current[Thread.current] << 'shl'
|
599
|
+
end
|
600
|
+
|
601
|
+
def shr(_a = nil, _b = nil)
|
602
|
+
TEALrb::TEAL.current[Thread.current] << 'shr'
|
603
|
+
end
|
604
|
+
|
605
|
+
def sqrt(_integer = nil)
|
606
|
+
TEALrb::TEAL.current[Thread.current] << 'sqrt'
|
607
|
+
end
|
608
|
+
|
609
|
+
def store(index, _value = nil)
|
610
|
+
TEALrb::TEAL.current[Thread.current] << "store #{index}"
|
611
|
+
end
|
612
|
+
|
613
|
+
def stores(_index = nil, _value = nil)
|
614
|
+
TEALrb::TEAL.current[Thread.current] << 'stores'
|
615
|
+
end
|
616
|
+
|
617
|
+
def substring(start, exclusive_end, _byte_array = nil)
|
618
|
+
TEALrb::TEAL.current[Thread.current] << "substring #{start} #{exclusive_end}"
|
619
|
+
end
|
620
|
+
|
621
|
+
def substring3(_byte_array = nil, _start = nil, _exclusive_end = nil)
|
622
|
+
TEALrb::TEAL.current[Thread.current] << 'substring3'
|
623
|
+
end
|
624
|
+
|
625
|
+
def subtract(_a = nil, _b = nil)
|
626
|
+
TEALrb::TEAL.current[Thread.current] << '-'
|
627
|
+
end
|
628
|
+
|
629
|
+
def swap(_expr_a = nil, _expr_b = nil)
|
630
|
+
TEALrb::TEAL.current[Thread.current] << 'swap'
|
631
|
+
end
|
632
|
+
|
633
|
+
def teal_return(_expr = nil)
|
634
|
+
TEALrb::TEAL.current[Thread.current] << 'return'
|
635
|
+
end
|
636
|
+
|
637
|
+
def txn(field)
|
638
|
+
TEALrb::TEAL.current[Thread.current] << "txn #{field}"
|
639
|
+
end
|
640
|
+
|
641
|
+
def txna(field, index)
|
642
|
+
TEALrb::TEAL.current[Thread.current] << "txna #{field} #{index}"
|
643
|
+
end
|
644
|
+
|
645
|
+
def txnas(field, _index = nil)
|
646
|
+
TEALrb::TEAL.current[Thread.current] << "txnas #{field}"
|
647
|
+
end
|
648
|
+
|
649
|
+
def uncover(count)
|
650
|
+
TEALrb::TEAL.current[Thread.current] << "uncover #{count}"
|
651
|
+
end
|
652
|
+
|
653
|
+
def boolean_and(_a = nil, _b = nil)
|
654
|
+
TEALrb::TEAL.current[Thread.current] << '&&'
|
655
|
+
end
|
656
|
+
|
657
|
+
def boolean_or(_a = nil, _b = nil)
|
658
|
+
TEALrb::TEAL.current[Thread.current] << '||'
|
659
|
+
end
|
660
|
+
end
|
661
|
+
end
|