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,701 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TEALrb
|
4
|
+
module ExtendedOpcodes
|
5
|
+
extend Opcodes
|
6
|
+
end
|
7
|
+
|
8
|
+
module Opcodes
|
9
|
+
class AccountLocal
|
10
|
+
include TEALrb::Opcodes
|
11
|
+
|
12
|
+
def initialize(account)
|
13
|
+
@account = account
|
14
|
+
end
|
15
|
+
|
16
|
+
def [](key)
|
17
|
+
app_local_get @account, key
|
18
|
+
end
|
19
|
+
|
20
|
+
def []=(key, value)
|
21
|
+
app_local_put @account, key, value
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module Local
|
26
|
+
def self.[](account)
|
27
|
+
AccountLocal.new account
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module TxnType
|
32
|
+
class << self
|
33
|
+
private
|
34
|
+
|
35
|
+
def txn_type_int(type)
|
36
|
+
TEALrb::TEAL.current[Thread.current] << "int '#{type}'"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.unknown
|
41
|
+
txn_type_int 'unknown'
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.pay
|
45
|
+
txn_type_int 'pay'
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.key_registration
|
49
|
+
txn_type_int 'keyreg'
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.asset_config
|
53
|
+
txn_type_int 'acfg'
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.asset_transfer
|
57
|
+
txn_type_int 'axfer'
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.asset_freeze
|
61
|
+
txn_type_int 'afrz'
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.application_call
|
65
|
+
txn_type_int 'appl'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# TODO: Create TxnaFields to seperate array fields
|
70
|
+
module TxnFields
|
71
|
+
# @return [[]byte] 32 byte address (v1)
|
72
|
+
def sender(*args)
|
73
|
+
opcode('Sender', *args)
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [uint64] microalgos (v1)
|
77
|
+
def fee(*args)
|
78
|
+
opcode('Fee', *args)
|
79
|
+
end
|
80
|
+
|
81
|
+
# @return [uint64] round number (v1)
|
82
|
+
def first_valid(*args)
|
83
|
+
opcode('FirstValid', *args)
|
84
|
+
end
|
85
|
+
|
86
|
+
# @return [uint64] Causes program to fail; reserved for future use (v1)
|
87
|
+
def first_valid_time(*args)
|
88
|
+
opcode('FirstValidTime', *args)
|
89
|
+
end
|
90
|
+
|
91
|
+
# @return [uint64] round number (v1)
|
92
|
+
def last_valid(*args)
|
93
|
+
opcode('LastValid', *args)
|
94
|
+
end
|
95
|
+
|
96
|
+
# @return [[]byte] Any data up to 1024 bytes (v1)
|
97
|
+
def note(*args)
|
98
|
+
opcode('Note', *args)
|
99
|
+
end
|
100
|
+
|
101
|
+
# @return [[]byte] 32 byte lease value (v1)
|
102
|
+
def lease(*args)
|
103
|
+
opcode('Lease', *args)
|
104
|
+
end
|
105
|
+
|
106
|
+
# @return [[]byte] 32 byte address (v1)
|
107
|
+
def receiver(*args)
|
108
|
+
opcode('Receiver', *args)
|
109
|
+
end
|
110
|
+
|
111
|
+
# @return [uint64] microalgos (v1)
|
112
|
+
def amount(*args)
|
113
|
+
opcode('Amount', *args)
|
114
|
+
end
|
115
|
+
|
116
|
+
# @return [[]byte] 32 byte address (v1)
|
117
|
+
def close_remainder_to(*args)
|
118
|
+
opcode('CloseRemainderTo', *args)
|
119
|
+
end
|
120
|
+
|
121
|
+
# @return [[]byte] 32 byte address (v1)
|
122
|
+
def vote_pk(*args)
|
123
|
+
opcode('VotePK', *args)
|
124
|
+
end
|
125
|
+
|
126
|
+
# @return [[]byte] 32 byte address (v1)
|
127
|
+
def selection_pk(*args)
|
128
|
+
opcode('SelectionPK', *args)
|
129
|
+
end
|
130
|
+
|
131
|
+
# @return [uint64] The first round that the participation key is valid. (v1)
|
132
|
+
def vote_first(*args)
|
133
|
+
opcode('VoteFirst', *args)
|
134
|
+
end
|
135
|
+
|
136
|
+
# @return [uint64] The last round that the participation key is valid. (v1)
|
137
|
+
def vote_last(*args)
|
138
|
+
opcode('VoteLast', *args)
|
139
|
+
end
|
140
|
+
|
141
|
+
# @return [uint64] Dilution for the 2-level participation key (v1)
|
142
|
+
def vote_key_dilution(*args)
|
143
|
+
opcode('VoteKeyDilution', *args)
|
144
|
+
end
|
145
|
+
|
146
|
+
# @return [[]byte] Transaction type as bytes (v1)
|
147
|
+
def type(*args)
|
148
|
+
opcode('Type', *args)
|
149
|
+
end
|
150
|
+
|
151
|
+
# @return [uint64] See table below (v1)
|
152
|
+
def type_enum(*args)
|
153
|
+
opcode('TypeEnum', *args)
|
154
|
+
end
|
155
|
+
|
156
|
+
# @return [uint64] Asset ID (v1)
|
157
|
+
def xfer_asset(*args)
|
158
|
+
opcode('XferAsset', *args)
|
159
|
+
end
|
160
|
+
|
161
|
+
# @return [uint64] value in Asset's units (v1)
|
162
|
+
def asset_amount(*args)
|
163
|
+
opcode('AssetAmount', *args)
|
164
|
+
end
|
165
|
+
|
166
|
+
# @return [[]byte] 32 byte address. Causes clawback of all value of asset from AssetSender if
|
167
|
+
# Sender is the Clawback address of the asset. (v1)
|
168
|
+
def asset_sender(*args)
|
169
|
+
opcode('AssetSender', *args)
|
170
|
+
end
|
171
|
+
|
172
|
+
# @return [[]byte] 32 byte address (v1)
|
173
|
+
def asset_receiver(*args)
|
174
|
+
opcode('AssetReceiver', *args)
|
175
|
+
end
|
176
|
+
|
177
|
+
# @return [[]byte] 32 byte address (v1)
|
178
|
+
def asset_close_to(*args)
|
179
|
+
opcode('AssetCloseTo', *args)
|
180
|
+
end
|
181
|
+
|
182
|
+
# @return [uint64] Position of this transaction within an atomic transaction group.
|
183
|
+
# A stand-alone transaction is implicitly element 0 in a group of 1 (v1)
|
184
|
+
def group_index(*args)
|
185
|
+
opcode('GroupIndex', *args)
|
186
|
+
end
|
187
|
+
|
188
|
+
# @return [[]byte] The computed ID for this transaction. 32 bytes. (v1)
|
189
|
+
def tx_id(*args)
|
190
|
+
opcode('TxID', *args)
|
191
|
+
end
|
192
|
+
|
193
|
+
# @return [uint64] ApplicationID from ApplicationCall transaction (v2)
|
194
|
+
def application_id(*args)
|
195
|
+
opcode('ApplicationID', *args)
|
196
|
+
end
|
197
|
+
|
198
|
+
# @return [uint64] ApplicationCall transaction on completion action (v2)
|
199
|
+
def on_completion(*args)
|
200
|
+
opcode('OnCompletion', *args)
|
201
|
+
end
|
202
|
+
|
203
|
+
# @return [[]byte] Arguments passed to the application in the ApplicationCall transaction (v2)
|
204
|
+
def application_args(*args)
|
205
|
+
opcode('ApplicationArgs', *args)
|
206
|
+
end
|
207
|
+
|
208
|
+
# @return [uint64] Number of ApplicationArgs (v2)
|
209
|
+
def num_app_args(*args)
|
210
|
+
opcode('NumAppArgs', *args)
|
211
|
+
end
|
212
|
+
|
213
|
+
# @return [[]byte] Accounts listed in the ApplicationCall transaction (v2)
|
214
|
+
def accounts(*args)
|
215
|
+
opcode('Accounts', *args)
|
216
|
+
end
|
217
|
+
|
218
|
+
# @return [uint64] Number of Accounts (v2)
|
219
|
+
def num_accounts(*args)
|
220
|
+
opcode('NumAccounts', *args)
|
221
|
+
end
|
222
|
+
|
223
|
+
# @return [[]byte] Approval program (v2)
|
224
|
+
def approval_program(*args)
|
225
|
+
opcode('ApprovalProgram', *args)
|
226
|
+
end
|
227
|
+
|
228
|
+
# @return [[]byte] Clear state program (v2)
|
229
|
+
def clear_state_program(*args)
|
230
|
+
opcode('ClearStateProgram', *args)
|
231
|
+
end
|
232
|
+
|
233
|
+
# @return [[]byte] 32 byte Sender's new AuthAddr (v2)
|
234
|
+
def rekey_to(*args)
|
235
|
+
opcode('RekeyTo', *args)
|
236
|
+
end
|
237
|
+
|
238
|
+
# @return [uint64] Asset ID in asset config transaction (v2)
|
239
|
+
def config_asset(*args)
|
240
|
+
opcode('ConfigAsset', *args)
|
241
|
+
end
|
242
|
+
|
243
|
+
# @return [uint64] Total number of units of this asset created (v2)
|
244
|
+
def config_asset_total(*args)
|
245
|
+
opcode('ConfigAssetTotal', *args)
|
246
|
+
end
|
247
|
+
|
248
|
+
# @return [uint64] Number of digits to display after the decimal place when displaying the asset (v2)
|
249
|
+
def config_asset_decimals(*args)
|
250
|
+
opcode('ConfigAssetDecimals', *args)
|
251
|
+
end
|
252
|
+
|
253
|
+
# @return [uint64] Whether the asset's slots are frozen by default or not, 0 or 1 (v2)
|
254
|
+
def config_asset_default_frozen(*args)
|
255
|
+
opcode('ConfigAssetDefaultFrozen', *args)
|
256
|
+
end
|
257
|
+
|
258
|
+
# @return [[]byte] Unit name of the asset (v2)
|
259
|
+
def config_asset_unit_name(*args)
|
260
|
+
opcode('ConfigAssetUnitName', *args)
|
261
|
+
end
|
262
|
+
|
263
|
+
# @return [[]byte] The asset name (v2)
|
264
|
+
def config_asset_name(*args)
|
265
|
+
opcode('ConfigAssetName', *args)
|
266
|
+
end
|
267
|
+
|
268
|
+
# @return [[]byte] URL (v2)
|
269
|
+
def config_asset_url(*args)
|
270
|
+
opcode('ConfigAssetURL', *args)
|
271
|
+
end
|
272
|
+
|
273
|
+
# @return [[]byte] 32 byte commitment to some unspecified asset metadata (v2)
|
274
|
+
def config_asset_metadata_hash(*args)
|
275
|
+
opcode('ConfigAssetMetadataHash', *args)
|
276
|
+
end
|
277
|
+
|
278
|
+
# @return [[]byte] 32 byte address (v2)
|
279
|
+
def config_asset_manager(*args)
|
280
|
+
opcode('ConfigAssetManager', *args)
|
281
|
+
end
|
282
|
+
|
283
|
+
# @return [[]byte] 32 byte address (v2)
|
284
|
+
def config_asset_reserve(*args)
|
285
|
+
opcode('ConfigAssetReserve', *args)
|
286
|
+
end
|
287
|
+
|
288
|
+
# @return [[]byte] 32 byte address (v2)
|
289
|
+
def config_asset_freeze(*args)
|
290
|
+
opcode('ConfigAssetFreeze', *args)
|
291
|
+
end
|
292
|
+
|
293
|
+
# @return [[]byte] 32 byte address (v2)
|
294
|
+
def config_asset_clawback(*args)
|
295
|
+
opcode('ConfigAssetClawback', *args)
|
296
|
+
end
|
297
|
+
|
298
|
+
# @return [uint64] Asset ID being frozen or un-frozen (v2)
|
299
|
+
def freeze_asset(*args)
|
300
|
+
opcode('FreezeAsset', *args)
|
301
|
+
end
|
302
|
+
|
303
|
+
# @return [[]byte] 32 byte address of the account whose asset slot is being frozen or un-frozen (v2)
|
304
|
+
def freeze_asset_account(*args)
|
305
|
+
opcode('FreezeAssetAccount', *args)
|
306
|
+
end
|
307
|
+
|
308
|
+
# @return [uint64] The new frozen value, 0 or 1 (v2)
|
309
|
+
def freeze_asset_frozen(*args)
|
310
|
+
opcode('FreezeAssetFrozen', *args)
|
311
|
+
end
|
312
|
+
|
313
|
+
# @return [uint64] Foreign Assets listed in the ApplicationCall transaction (v3)
|
314
|
+
def assets(*args)
|
315
|
+
opcode('Assets', *args)
|
316
|
+
end
|
317
|
+
|
318
|
+
# @return [uint64] Number of Assets (v3)
|
319
|
+
def num_assets(*args)
|
320
|
+
opcode('NumAssets', *args)
|
321
|
+
end
|
322
|
+
|
323
|
+
# @return [uint64] Foreign Apps listed in the ApplicationCall transaction (v3)
|
324
|
+
def applications(*args)
|
325
|
+
opcode('Applications', *args)
|
326
|
+
end
|
327
|
+
|
328
|
+
# @return [uint64] Number of Applications (v3)
|
329
|
+
def num_applications(*args)
|
330
|
+
opcode('NumApplications', *args)
|
331
|
+
end
|
332
|
+
|
333
|
+
# @return [uint64] Number of global state integers in ApplicationCall (v3)
|
334
|
+
def global_num_uint(*args)
|
335
|
+
opcode('GlobalNumUint', *args)
|
336
|
+
end
|
337
|
+
|
338
|
+
# @return [uint64] Number of global state byteslices in ApplicationCall (v3)
|
339
|
+
def global_num_byte_slice(*args)
|
340
|
+
opcode('GlobalNumByteSlice', *args)
|
341
|
+
end
|
342
|
+
|
343
|
+
# @return [uint64] Number of local state integers in ApplicationCall (v3)
|
344
|
+
def local_num_uint(*args)
|
345
|
+
opcode('LocalNumUint', *args)
|
346
|
+
end
|
347
|
+
|
348
|
+
# @return [uint64] Number of local state byteslices in ApplicationCall (v3)
|
349
|
+
def local_num_byte_slice(*args)
|
350
|
+
opcode('LocalNumByteSlice', *args)
|
351
|
+
end
|
352
|
+
|
353
|
+
# @return [uint64] Number of additional pages for each of the application's approval and clear state programs.
|
354
|
+
# An ExtraProgramPages of 1 means 2048 more total bytes, or 1024 for each program. (v4)
|
355
|
+
def extra_program_pages(*args)
|
356
|
+
opcode('ExtraProgramPages', *args)
|
357
|
+
end
|
358
|
+
|
359
|
+
# @return [uint64] Marks an account nonparticipating for rewards (v5)
|
360
|
+
def nonparticipation(*args)
|
361
|
+
opcode('Nonparticipation', *args)
|
362
|
+
end
|
363
|
+
|
364
|
+
# @return [[]byte] Log messages emitted by an application call (only with itxn in v5). Application mode only (v5)
|
365
|
+
def logs(*args)
|
366
|
+
opcode('Logs', *args)
|
367
|
+
end
|
368
|
+
|
369
|
+
# @return [uint64] Number of Logs (only with itxn in v5). Application mode only (v5)
|
370
|
+
def num_logs(*args)
|
371
|
+
opcode('NumLogs', *args)
|
372
|
+
end
|
373
|
+
|
374
|
+
# @return [uint64] Asset ID allocated by the creation of an ASA (only with itxn in v5). Application mode only (v5)
|
375
|
+
def created_asset_id(*args)
|
376
|
+
opcode('CreatedAssetID', *args)
|
377
|
+
end
|
378
|
+
|
379
|
+
# @return [uint64] ApplicationID allocated by the creation of an application (only with itxn in v5).
|
380
|
+
# Application mode only (v5)
|
381
|
+
def created_application_id(*args)
|
382
|
+
opcode('CreatedApplicationID', *args)
|
383
|
+
end
|
384
|
+
|
385
|
+
# @return [[]byte] The last message emitted. Empty bytes if none were emitted. Application mode only (v6)
|
386
|
+
def last_log(*args)
|
387
|
+
opcode('LastLog', *args)
|
388
|
+
end
|
389
|
+
|
390
|
+
# @return [[]byte] 64 byte state proof public key commitment (v6)
|
391
|
+
def state_proof_pk(*args)
|
392
|
+
opcode('StateProofPK', *args)
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
module AppFields
|
397
|
+
# @return [[]byte] Bytecode of Approval Program
|
398
|
+
def app_approval_program(*args)
|
399
|
+
opcode('AppApprovalProgram', *args)
|
400
|
+
end
|
401
|
+
|
402
|
+
# @return [[]byte] Bytecode of Clear State Program
|
403
|
+
def app_clear_state_program(*args)
|
404
|
+
opcode('AppClearStateProgram', *args)
|
405
|
+
end
|
406
|
+
|
407
|
+
# @return [uint64] Number of uint64 values allowed in Global State
|
408
|
+
def app_global_num_uint(*args)
|
409
|
+
opcode('AppGlobalNumUint', *args)
|
410
|
+
end
|
411
|
+
|
412
|
+
# @return [uint64] Number of byte array values allowed in Global State
|
413
|
+
def app_global_num_byte_slice(*args)
|
414
|
+
opcode('AppGlobalNumByteSlice', *args)
|
415
|
+
end
|
416
|
+
|
417
|
+
# @return [uint64] Number of uint64 values allowed in Local State
|
418
|
+
def app_local_num_uint(*args)
|
419
|
+
opcode('AppLocalNumUint', *args)
|
420
|
+
end
|
421
|
+
|
422
|
+
# @return [uint64] Number of byte array values allowed in Local State
|
423
|
+
def app_local_num_byte_slice(*args)
|
424
|
+
opcode('AppLocalNumByteSlice', *args)
|
425
|
+
end
|
426
|
+
|
427
|
+
# @return [uint64] Number of Extra Program Pages of code space
|
428
|
+
def app_extra_program_pages(*args)
|
429
|
+
opcode('AppExtraProgramPages', *args)
|
430
|
+
end
|
431
|
+
|
432
|
+
# @return [[]byte] Creator address
|
433
|
+
def app_creator(*args)
|
434
|
+
opcode('AppCreator', *args)
|
435
|
+
end
|
436
|
+
|
437
|
+
# @return [[]byte] Address for which this application has authority
|
438
|
+
def app_address(*args)
|
439
|
+
opcode('AppAddress', *args)
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
module AssetFields
|
444
|
+
# @return [uint64] Total number of units of this asset (v1)
|
445
|
+
def asset_total(*args)
|
446
|
+
opcode('AssetTotal', *args)
|
447
|
+
end
|
448
|
+
|
449
|
+
# @return [uint64] See AssetParams.Decimals (v1)
|
450
|
+
def asset_decimals(*args)
|
451
|
+
opcode('AssetDecimals', *args)
|
452
|
+
end
|
453
|
+
|
454
|
+
# @return [uint64] Frozen by default or not (v1)
|
455
|
+
def asset_default_frozen(*args)
|
456
|
+
opcode('AssetDefaultFrozen', *args)
|
457
|
+
end
|
458
|
+
|
459
|
+
# @return [[]byte] Asset unit name (v1)
|
460
|
+
def asset_unit_name(*args)
|
461
|
+
opcode('AssetUnitName', *args)
|
462
|
+
end
|
463
|
+
|
464
|
+
# @return [[]byte] Asset name (v1)
|
465
|
+
def asset_name(*args)
|
466
|
+
opcode('AssetName', *args)
|
467
|
+
end
|
468
|
+
|
469
|
+
# @return [[]byte] URL with additional info about the asset (v1)
|
470
|
+
def asset_url(*args)
|
471
|
+
opcode('AssetURL', *args)
|
472
|
+
end
|
473
|
+
|
474
|
+
# @return [[]byte] Arbitrary commitment (v1)
|
475
|
+
def asset_metadata_hash(*args)
|
476
|
+
opcode('AssetMetadataHash', *args)
|
477
|
+
end
|
478
|
+
|
479
|
+
# @return [[]byte] Manager commitment (v1)
|
480
|
+
def asset_manager(*args)
|
481
|
+
opcode('AssetManager', *args)
|
482
|
+
end
|
483
|
+
|
484
|
+
# @return [[]byte] Reserve address (v1)
|
485
|
+
def asset_reserve(*args)
|
486
|
+
opcode('AssetReserve', *args)
|
487
|
+
end
|
488
|
+
|
489
|
+
# @return [[]byte] Freeze address (v1)
|
490
|
+
def asset_freeze(*args)
|
491
|
+
opcode('AssetFreeze', *args)
|
492
|
+
end
|
493
|
+
|
494
|
+
# @return [[]byte] Clawback address (v1)
|
495
|
+
def asset_clawback(*args)
|
496
|
+
opcode('AssetClawback', *args)
|
497
|
+
end
|
498
|
+
|
499
|
+
# @return [[]byte] Creator address (v5)
|
500
|
+
def asset_creator(*args)
|
501
|
+
opcode('AssetCreator', *args)
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
module AccountFields
|
506
|
+
# @return [uint64] Account balance in microalgos
|
507
|
+
def acct_balance(*args)
|
508
|
+
opcode('AcctBalance', *args)
|
509
|
+
end
|
510
|
+
|
511
|
+
# @return [uint64] in microalgos (Minimum required blance for account)
|
512
|
+
def acct_min_balance(*args)
|
513
|
+
opcode('AcctMinBalance', *args)
|
514
|
+
end
|
515
|
+
|
516
|
+
# @return [[]byte] Address the account is rekeyed to.
|
517
|
+
def acct_auth_addr(*args)
|
518
|
+
opcode('AcctAuthAddr', *args)
|
519
|
+
end
|
520
|
+
end
|
521
|
+
|
522
|
+
module GlobalFields
|
523
|
+
# @return [uint64] microalgos (v1)
|
524
|
+
def min_txn_fee(*args)
|
525
|
+
opcode('MinTxnFee', *args)
|
526
|
+
end
|
527
|
+
|
528
|
+
# @return [uint64] microalgos (v1)
|
529
|
+
def min_balance(*args)
|
530
|
+
opcode('MinBalance', *args)
|
531
|
+
end
|
532
|
+
|
533
|
+
# @return [uint64] rounds (v1)
|
534
|
+
def max_txn_life(*args)
|
535
|
+
opcode('MaxTxnLife', *args)
|
536
|
+
end
|
537
|
+
|
538
|
+
# @return [[]byte] 32 byte address of all zero bytes (v1)
|
539
|
+
def zero_address(*args)
|
540
|
+
opcode('ZeroAddress', *args)
|
541
|
+
end
|
542
|
+
|
543
|
+
# @return [uint64] Number of transactions in this atomic transaction group. At least 1 (v1)
|
544
|
+
def group_size(*args)
|
545
|
+
opcode('GroupSize', *args)
|
546
|
+
end
|
547
|
+
|
548
|
+
# @return [uint64] Maximum supported version (v2)
|
549
|
+
def logic_sig_version(*args)
|
550
|
+
opcode('LogicSigVersion', *args)
|
551
|
+
end
|
552
|
+
|
553
|
+
# @return [uint64] Current round number. Application mode only. (v2)
|
554
|
+
def round(*args)
|
555
|
+
opcode('Round', *args)
|
556
|
+
end
|
557
|
+
|
558
|
+
# @return [uint64] Last confirmed block UNIX timestamp. Fails if negative. Application mode only. (v2)
|
559
|
+
def latest_timestamp(*args)
|
560
|
+
opcode('LatestTimestamp', *args)
|
561
|
+
end
|
562
|
+
|
563
|
+
# @return [uint64] ID of current application executing. Application mode only. (v2)
|
564
|
+
def current_application_id(*args)
|
565
|
+
opcode('CurrentApplicationID', *args)
|
566
|
+
end
|
567
|
+
|
568
|
+
# @return [[]byte] Address of the creator of the current application. Application mode only. (v3)
|
569
|
+
def creator_address(*args)
|
570
|
+
opcode('CreatorAddress', *args)
|
571
|
+
end
|
572
|
+
|
573
|
+
# @return [[]byte] Address that the current application controls. Application mode only. (v5)
|
574
|
+
def current_application_address(*args)
|
575
|
+
opcode('CurrentApplicationAddress', *args)
|
576
|
+
end
|
577
|
+
|
578
|
+
# @return [[]byte] ID of the transaction group. 32 zero bytes if the transaction is not part of a group. (v5)
|
579
|
+
def group_id(*args)
|
580
|
+
opcode('GroupID', *args)
|
581
|
+
end
|
582
|
+
|
583
|
+
# @return [uint64] The remaining cost that can be spent by opcodes in this program. (v6)
|
584
|
+
def opcode_budget(*args)
|
585
|
+
opcode('OpcodeBudget', *args)
|
586
|
+
end
|
587
|
+
|
588
|
+
# @return [uint64] The application ID of the application that called this application.
|
589
|
+
# 0 if this application is at the top-level. Application mode only. (v6)
|
590
|
+
def caller_application_id(*args)
|
591
|
+
opcode('CallerApplicationID', *args)
|
592
|
+
end
|
593
|
+
|
594
|
+
# @return [[]byte] The application address of the application that called this application.
|
595
|
+
# ZeroAddress if this application is at the top-level. Application mode only. (v6)
|
596
|
+
def caller_application_address(*args)
|
597
|
+
opcode('CallerApplicationAddress', *args)
|
598
|
+
end
|
599
|
+
end
|
600
|
+
|
601
|
+
module App
|
602
|
+
extend Opcodes
|
603
|
+
extend AppFields
|
604
|
+
|
605
|
+
def self.opcode(field, app_id = nil)
|
606
|
+
@teal = TEALrb::TEAL.current[Thread.current]
|
607
|
+
app_params_get field, app_id
|
608
|
+
end
|
609
|
+
end
|
610
|
+
|
611
|
+
module Asset
|
612
|
+
extend Opcodes
|
613
|
+
extend AssetFields
|
614
|
+
|
615
|
+
def self.opcode(field, asset = nil)
|
616
|
+
@teal = TEALrb::TEAL.current[Thread.current]
|
617
|
+
asset_params_get field, asset
|
618
|
+
end
|
619
|
+
end
|
620
|
+
|
621
|
+
module Account
|
622
|
+
extend Opcodes
|
623
|
+
extend AccountFields
|
624
|
+
|
625
|
+
def self.opcode(field, account = nil)
|
626
|
+
@teal = TEALrb::TEAL.current[Thread.current]
|
627
|
+
acct_params_get field, account
|
628
|
+
end
|
629
|
+
end
|
630
|
+
|
631
|
+
module Txn
|
632
|
+
extend Opcodes
|
633
|
+
extend TxnFields
|
634
|
+
|
635
|
+
def self.opcode(field)
|
636
|
+
txn field
|
637
|
+
end
|
638
|
+
end
|
639
|
+
|
640
|
+
module Gtxn
|
641
|
+
extend TxnFields
|
642
|
+
extend Opcodes
|
643
|
+
|
644
|
+
def self.opcode(field, index)
|
645
|
+
@teal = TEALrb::TEAL.current[Thread.current]
|
646
|
+
gtxn index, field
|
647
|
+
end
|
648
|
+
|
649
|
+
def self.[](index)
|
650
|
+
GroupTransaction.new(index)
|
651
|
+
end
|
652
|
+
end
|
653
|
+
|
654
|
+
class GroupTransaction
|
655
|
+
include TxnFields
|
656
|
+
include Opcodes
|
657
|
+
|
658
|
+
def initialize(index)
|
659
|
+
@index = index
|
660
|
+
end
|
661
|
+
|
662
|
+
def opcode(field)
|
663
|
+
gtxn @index, field
|
664
|
+
end
|
665
|
+
end
|
666
|
+
|
667
|
+
module Txna
|
668
|
+
extend Opcodes
|
669
|
+
extend TxnFields
|
670
|
+
|
671
|
+
def self.opcode(field, index)
|
672
|
+
@teal = TEALrb::TEAL.current[Thread.current]
|
673
|
+
txna field, index
|
674
|
+
end
|
675
|
+
end
|
676
|
+
|
677
|
+
module Global
|
678
|
+
extend Opcodes
|
679
|
+
extend GlobalFields
|
680
|
+
|
681
|
+
def self.opcode(field)
|
682
|
+
@teal = TEALrb::TEAL.current[Thread.current]
|
683
|
+
global field
|
684
|
+
end
|
685
|
+
|
686
|
+
def self.[](key)
|
687
|
+
app_global_get key
|
688
|
+
end
|
689
|
+
|
690
|
+
def self.[]=(key, value)
|
691
|
+
app_global_put key, value
|
692
|
+
end
|
693
|
+
end
|
694
|
+
|
695
|
+
module AppArgs
|
696
|
+
def self.[](index)
|
697
|
+
Txna.application_args index
|
698
|
+
end
|
699
|
+
end
|
700
|
+
end
|
701
|
+
end
|