tealrb 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,904 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module TEALrb
4
- module Opcodes
5
- class AccountLocal
6
- def initialize(account)
7
- @account = account
8
- end
9
-
10
- def [](key)
11
- ExtendedOpcodes.app_local_get @account, key
12
- end
13
-
14
- def []=(key, value)
15
- ExtendedOpcodes.app_local_put @account, key, value
16
- end
17
- end
18
-
19
- module Local
20
- def self.[](account)
21
- AccountLocal.new account
22
- end
23
- end
24
-
25
- module TxnType
26
- class << self
27
- private
28
-
29
- def txn_type_int(type)
30
- TEAL.instance << "int #{type}"
31
- end
32
- end
33
-
34
- def self.unknown
35
- txn_type_int 'unknown'
36
- end
37
-
38
- def self.pay
39
- txn_type_int 'pay'
40
- end
41
-
42
- def self.key_registration
43
- txn_type_int 'keyreg'
44
- end
45
-
46
- def self.asset_config
47
- txn_type_int 'acfg'
48
- end
49
-
50
- def self.asset_transfer
51
- txn_type_int 'axfer'
52
- end
53
-
54
- def self.asset_freeze
55
- txn_type_int 'afrz'
56
- end
57
-
58
- def self.application_call
59
- txn_type_int 'appl'
60
- end
61
- end
62
-
63
- # TODO: Create TxnaFields to seperate array fields
64
- module TxnFields
65
- # @return [[]byte] 32 byte address (v1)
66
- def sender(*args)
67
- opcode('Sender', *args)
68
- end
69
-
70
- # @return [uint64] microalgos (v1)
71
- def fee(*args)
72
- opcode('Fee', *args)
73
- end
74
-
75
- # @return [uint64] round number (v1)
76
- def first_valid(*args)
77
- opcode('FirstValid', *args)
78
- end
79
-
80
- # @return [uint64] Causes program to fail; reserved for future use (v1)
81
- def first_valid_time(*args)
82
- opcode('FirstValidTime', *args)
83
- end
84
-
85
- # @return [uint64] round number (v1)
86
- def last_valid(*args)
87
- opcode('LastValid', *args)
88
- end
89
-
90
- # @return [[]byte] Any data up to 1024 bytes (v1)
91
- def note(*args)
92
- opcode('Note', *args)
93
- end
94
-
95
- # @return [[]byte] 32 byte lease value (v1)
96
- def lease(*args)
97
- opcode('Lease', *args)
98
- end
99
-
100
- # @return [[]byte] 32 byte address (v1)
101
- def receiver(*args)
102
- opcode('Receiver', *args)
103
- end
104
-
105
- # @return [uint64] microalgos (v1)
106
- def amount(*args)
107
- opcode('Amount', *args)
108
- end
109
-
110
- # @return [[]byte] 32 byte address (v1)
111
- def close_remainder_to(*args)
112
- opcode('CloseRemainderTo', *args)
113
- end
114
-
115
- # @return [[]byte] 32 byte address (v1)
116
- def vote_pk(*args)
117
- opcode('VotePK', *args)
118
- end
119
-
120
- # @return [[]byte] 32 byte address (v1)
121
- def selection_pk(*args)
122
- opcode('SelectionPK', *args)
123
- end
124
-
125
- # @return [uint64] The first round that the participation key is valid. (v1)
126
- def vote_first(*args)
127
- opcode('VoteFirst', *args)
128
- end
129
-
130
- # @return [uint64] The last round that the participation key is valid. (v1)
131
- def vote_last(*args)
132
- opcode('VoteLast', *args)
133
- end
134
-
135
- # @return [uint64] Dilution for the 2-level participation key (v1)
136
- def vote_key_dilution(*args)
137
- opcode('VoteKeyDilution', *args)
138
- end
139
-
140
- # @return [[]byte] Transaction type as bytes (v1)
141
- def type(*args)
142
- opcode('Type', *args)
143
- end
144
-
145
- # @return [uint64] See table below (v1)
146
- def type_enum(*args)
147
- opcode('TypeEnum', *args)
148
- end
149
-
150
- # @return [uint64] Asset ID (v1)
151
- def xfer_asset(*args)
152
- opcode('XferAsset', *args)
153
- end
154
-
155
- # @return [uint64] value in Asset's units (v1)
156
- def asset_amount(*args)
157
- opcode('AssetAmount', *args)
158
- end
159
-
160
- # @return [[]byte] 32 byte address. Causes clawback of all value of asset from AssetSender if
161
- # Sender is the Clawback address of the asset. (v1)
162
- def asset_sender(*args)
163
- opcode('AssetSender', *args)
164
- end
165
-
166
- # @return [[]byte] 32 byte address (v1)
167
- def asset_receiver(*args)
168
- opcode('AssetReceiver', *args)
169
- end
170
-
171
- # @return [[]byte] 32 byte address (v1)
172
- def asset_close_to(*args)
173
- opcode('AssetCloseTo', *args)
174
- end
175
-
176
- # @return [uint64] Position of this transaction within an atomic transaction group.
177
- # A stand-alone transaction is implicitly element 0 in a group of 1 (v1)
178
- def group_index(*args)
179
- opcode('GroupIndex', *args)
180
- end
181
-
182
- # @return [[]byte] The computed ID for this transaction. 32 bytes. (v1)
183
- def tx_id(*args)
184
- opcode('TxID', *args)
185
- end
186
-
187
- # @return [uint64] ApplicationID from ApplicationCall transaction (v2)
188
- def application_id(*args)
189
- opcode('ApplicationID', *args)
190
- end
191
-
192
- # @return [uint64] ApplicationCall transaction on completion action (v2)
193
- def on_completion(*args)
194
- opcode('OnCompletion', *args)
195
- end
196
-
197
- # @return [[]byte] Arguments passed to the application in the ApplicationCall transaction (v2)
198
- def application_args(*args)
199
- opcode('ApplicationArgs', *args)
200
- end
201
-
202
- # @return [uint64] Number of ApplicationArgs (v2)
203
- def num_app_args(*args)
204
- opcode('NumAppArgs', *args)
205
- end
206
-
207
- # @return [[]byte] Accounts listed in the ApplicationCall transaction (v2)
208
- def accounts(*args)
209
- opcode('Accounts', *args)
210
- end
211
-
212
- # @return [uint64] Number of Accounts (v2)
213
- def num_accounts(*args)
214
- opcode('NumAccounts', *args)
215
- end
216
-
217
- # @return [[]byte] Approval program (v2)
218
- def approval_program(*args)
219
- opcode('ApprovalProgram', *args)
220
- end
221
-
222
- # @return [[]byte] Clear state program (v2)
223
- def clear_state_program(*args)
224
- opcode('ClearStateProgram', *args)
225
- end
226
-
227
- # @return [[]byte] 32 byte Sender's new AuthAddr (v2)
228
- def rekey_to(*args)
229
- opcode('RekeyTo', *args)
230
- end
231
-
232
- # @return [uint64] Asset ID in asset config transaction (v2)
233
- def config_asset(*args)
234
- opcode('ConfigAsset', *args)
235
- end
236
-
237
- # @return [uint64] Total number of units of this asset created (v2)
238
- def config_asset_total(*args)
239
- opcode('ConfigAssetTotal', *args)
240
- end
241
-
242
- # @return [uint64] Number of digits to display after the decimal place when displaying the asset (v2)
243
- def config_asset_decimals(*args)
244
- opcode('ConfigAssetDecimals', *args)
245
- end
246
-
247
- # @return [uint64] Whether the asset's slots are frozen by default or not, 0 or 1 (v2)
248
- def config_asset_default_frozen(*args)
249
- opcode('ConfigAssetDefaultFrozen', *args)
250
- end
251
-
252
- # @return [[]byte] Unit name of the asset (v2)
253
- def config_asset_unit_name(*args)
254
- opcode('ConfigAssetUnitName', *args)
255
- end
256
-
257
- # @return [[]byte] The asset name (v2)
258
- def config_asset_name(*args)
259
- opcode('ConfigAssetName', *args)
260
- end
261
-
262
- # @return [[]byte] URL (v2)
263
- def config_asset_url(*args)
264
- opcode('ConfigAssetURL', *args)
265
- end
266
-
267
- # @return [[]byte] 32 byte commitment to some unspecified asset metadata (v2)
268
- def config_asset_metadata_hash(*args)
269
- opcode('ConfigAssetMetadataHash', *args)
270
- end
271
-
272
- # @return [[]byte] 32 byte address (v2)
273
- def config_asset_manager(*args)
274
- opcode('ConfigAssetManager', *args)
275
- end
276
-
277
- # @return [[]byte] 32 byte address (v2)
278
- def config_asset_reserve(*args)
279
- opcode('ConfigAssetReserve', *args)
280
- end
281
-
282
- # @return [[]byte] 32 byte address (v2)
283
- def config_asset_freeze(*args)
284
- opcode('ConfigAssetFreeze', *args)
285
- end
286
-
287
- # @return [[]byte] 32 byte address (v2)
288
- def config_asset_clawback(*args)
289
- opcode('ConfigAssetClawback', *args)
290
- end
291
-
292
- # @return [uint64] Asset ID being frozen or un-frozen (v2)
293
- def freeze_asset(*args)
294
- opcode('FreezeAsset', *args)
295
- end
296
-
297
- # @return [[]byte] 32 byte address of the account whose asset slot is being frozen or un-frozen (v2)
298
- def freeze_asset_account(*args)
299
- opcode('FreezeAssetAccount', *args)
300
- end
301
-
302
- # @return [uint64] The new frozen value, 0 or 1 (v2)
303
- def freeze_asset_frozen(*args)
304
- opcode('FreezeAssetFrozen', *args)
305
- end
306
-
307
- # @return [uint64] Foreign Assets listed in the ApplicationCall transaction (v3)
308
- def assets(*args)
309
- opcode('Assets', *args)
310
- end
311
-
312
- # @return [uint64] Number of Assets (v3)
313
- def num_assets(*args)
314
- opcode('NumAssets', *args)
315
- end
316
-
317
- # @return [uint64] Foreign Apps listed in the ApplicationCall transaction (v3)
318
- def applications(*args)
319
- opcode('Applications', *args)
320
- end
321
-
322
- # @return [uint64] Number of Applications (v3)
323
- def num_applications(*args)
324
- opcode('NumApplications', *args)
325
- end
326
-
327
- # @return [uint64] Number of global state integers in ApplicationCall (v3)
328
- def global_num_uint(*args)
329
- opcode('GlobalNumUint', *args)
330
- end
331
-
332
- # @return [uint64] Number of global state byteslices in ApplicationCall (v3)
333
- def global_num_byte_slice(*args)
334
- opcode('GlobalNumByteSlice', *args)
335
- end
336
-
337
- # @return [uint64] Number of local state integers in ApplicationCall (v3)
338
- def local_num_uint(*args)
339
- opcode('LocalNumUint', *args)
340
- end
341
-
342
- # @return [uint64] Number of local state byteslices in ApplicationCall (v3)
343
- def local_num_byte_slice(*args)
344
- opcode('LocalNumByteSlice', *args)
345
- end
346
-
347
- # @return [uint64] Number of additional pages for each of the application's approval and clear state programs.
348
- # An ExtraProgramPages of 1 means 2048 more total bytes, or 1024 for each program. (v4)
349
- def extra_program_pages(*args)
350
- opcode('ExtraProgramPages', *args)
351
- end
352
-
353
- # @return [uint64] Marks an account nonparticipating for rewards (v5)
354
- def nonparticipation(*args)
355
- opcode('Nonparticipation', *args)
356
- end
357
-
358
- # @return [[]byte] Log messages emitted by an application call (only with itxn in v5). Application mode only (v5)
359
- def logs(*args)
360
- opcode('Logs', *args)
361
- end
362
-
363
- # @return [uint64] Number of Logs (only with itxn in v5). Application mode only (v5)
364
- def num_logs(*args)
365
- opcode('NumLogs', *args)
366
- end
367
-
368
- # @return [uint64] Asset ID allocated by the creation of an ASA (only with itxn in v5). Application mode only (v5)
369
- def created_asset_id(*args)
370
- opcode('CreatedAssetID', *args)
371
- end
372
-
373
- # @return [uint64] ApplicationID allocated by the creation of an application (only with itxn in v5).
374
- # Application mode only (v5)
375
- def created_application_id(*args)
376
- opcode('CreatedApplicationID', *args)
377
- end
378
-
379
- # @return [[]byte] The last message emitted. Empty bytes if none were emitted. Application mode only (v6)
380
- def last_log(*args)
381
- opcode('LastLog', *args)
382
- end
383
-
384
- # @return [[]byte] 64 byte state proof public key commitment (v6)
385
- def state_proof_pk(*args)
386
- opcode('StateProofPK', *args)
387
- end
388
- end
389
-
390
- module GlobalFields
391
- # @return [uint64] microalgos (v1)
392
- def min_txn_fee(*args)
393
- opcode('MinTxnFee', *args)
394
- end
395
-
396
- # @return [uint64] microalgos (v1)
397
- def min_balance(*args)
398
- opcode('MinBalance', *args)
399
- end
400
-
401
- # @return [uint64] rounds (v1)
402
- def max_txn_life(*args)
403
- opcode('MaxTxnLife', *args)
404
- end
405
-
406
- # @return [[]byte] 32 byte address of all zero bytes (v1)
407
- def zero_address(*args)
408
- opcode('ZeroAddress', *args)
409
- end
410
-
411
- # @return [uint64] Number of transactions in this atomic transaction group. At least 1 (v1)
412
- def group_size(*args)
413
- opcode('GroupSize', *args)
414
- end
415
-
416
- # @return [uint64] Maximum supported version (v2)
417
- def logic_sig_version(*args)
418
- opcode('LogicSigVersion', *args)
419
- end
420
-
421
- # @return [uint64] Current round number. Application mode only. (v2)
422
- def round(*args)
423
- opcode('Round', *args)
424
- end
425
-
426
- # @return [uint64] Last confirmed block UNIX timestamp. Fails if negative. Application mode only. (v2)
427
- def latest_timestamp(*args)
428
- opcode('LatestTimestamp', *args)
429
- end
430
-
431
- # @return [uint64] ID of current application executing. Application mode only. (v2)
432
- def current_application_id(*args)
433
- opcode('CurrentApplicationID', *args)
434
- end
435
-
436
- # @return [[]byte] Address of the creator of the current application. Application mode only. (v3)
437
- def creator_address(*args)
438
- opcode('CreatorAddress', *args)
439
- end
440
-
441
- # @return [[]byte] Address that the current application controls. Application mode only. (v5)
442
- def current_application_address(*args)
443
- opcode('CurrentApplicationAddress', *args)
444
- end
445
-
446
- # @return [[]byte] ID of the transaction group. 32 zero bytes if the transaction is not part of a group. (v5)
447
- def group_id(*args)
448
- opcode('GroupID', *args)
449
- end
450
-
451
- # @return [uint64] The remaining cost that can be spent by opcodes in this program. (v6)
452
- def opcode_budget(*args)
453
- opcode('OpcodeBudget', *args)
454
- end
455
-
456
- # @return [uint64] The application ID of the application that called this application.
457
- # 0 if this application is at the top-level. Application mode only. (v6)
458
- def caller_application_id(*args)
459
- opcode('CallerApplicationID', *args)
460
- end
461
-
462
- # @return [[]byte] The application address of the application that called this application.
463
- # ZeroAddress if this application is at the top-level. Application mode only. (v6)
464
- def caller_application_address(*args)
465
- opcode('CallerApplicationAddress', *args)
466
- end
467
- end
468
-
469
- module Txn
470
- extend TxnFields
471
-
472
- def self.opcode(field)
473
- ExtendedOpcodes.txn field
474
- end
475
- end
476
-
477
- module ItxnField
478
- extend TxnFields
479
-
480
- def self.opcode(field, _value)
481
- ExtendedOpcodes.itxn_field field
482
- end
483
-
484
- class << self
485
- TxnFields.instance_methods.each do |m|
486
- define_method("#{m}=") do |value|
487
- send(m, value)
488
- end
489
- end
490
- end
491
- end
492
-
493
- module Gtxn
494
- extend TxnFields
495
-
496
- def self.opcode(field, index)
497
- ExtendedOpcodes.gtxn index, field
498
- end
499
-
500
- def self.[](index)
501
- GroupTransaction.new(index)
502
- end
503
- end
504
-
505
- module Gtxns
506
- extend TxnFields
507
-
508
- def self.opcode(field)
509
- ExtendedOpcodes.gtxns field
510
- end
511
-
512
- def self.[](_index)
513
- self
514
- end
515
- end
516
-
517
- class GroupTransaction
518
- include TxnFields
519
-
520
- def initialize(index)
521
- @index = index
522
- end
523
-
524
- def opcode(field)
525
- ExtendedOpcodes.gtxn @index, field
526
- end
527
- end
528
-
529
- class TxnArray
530
- TEALrb::Opcodes::BINARY_OPCODE_METHOD_MAPPING.each do |meth, opcode|
531
- define_method(meth) do |other|
532
- ExtendedOpcodes.send(opcode, self, other)
533
- end
534
- end
535
-
536
- TEALrb::Opcodes::UNARY_OPCODE_METHOD_MAPPING.each do |meth, opcode|
537
- define_method(meth) do
538
- ExtendedOpcodes.send(opcode, self)
539
- end
540
- end
541
-
542
- def self.[](index)
543
- new[index]
544
- end
545
-
546
- def [](index)
547
- if index.is_a? Integer
548
- ExtendedOpcodes.txna @field, index
549
- else
550
- ExtendedOpcodes.txnas @field
551
- end
552
-
553
- self
554
- end
555
- end
556
-
557
- class ApplicationArgs < TxnArray
558
- def initialize
559
- super
560
- @field = 'ApplicationArgs'
561
- end
562
- end
563
-
564
- class Logs < TxnArray
565
- def initialize
566
- super
567
- @field = 'Logs'
568
- end
569
- end
570
-
571
- class Accounts < TxnArray
572
- def initialize
573
- super
574
- @field = 'Accounts'
575
- end
576
-
577
- def min_balance
578
- ExtendedOpcodes.acct_param_value 'AcctMinBalance'
579
- end
580
-
581
- def balance
582
- ExtendedOpcodes.acct_param_value 'AcctBalance'
583
- end
584
-
585
- def auth_addr
586
- ExtendedOpcodes.acct_param_value 'AcctAuthAddr'
587
- end
588
-
589
- def balance?
590
- ExtendedOpcodes.acct_has_balance?
591
- end
592
- end
593
-
594
- class Apps < TxnArray
595
- def initialize
596
- super
597
- @field = 'Applications'
598
- end
599
-
600
- # @return [[]byte] Bytecode of Approval Program
601
- def approval_program(*_args)
602
- ExtendedOpcodes.app_param_value 'AppApprovalProgram'
603
- end
604
-
605
- # @return [[]byte] Bytecode of Clear State Program
606
- def clear_state_program(*_args)
607
- ExtendedOpcodes.app_param_value 'AppClearStateProgram'
608
- end
609
-
610
- # @return [uint64] Number of uint64 values allowed in Global State
611
- def global_num_uint(*_args)
612
- ExtendedOpcodes.app_param_value 'AppGlobalNumUint'
613
- end
614
-
615
- # @return [uint64] Number of byte array values allowed in Global State
616
- def global_num_byte_slice(*_args)
617
- ExtendedOpcodes.app_param_value 'AppGlobalNumByteSlice'
618
- end
619
-
620
- # @return [uint64] Number of uint64 values allowed in Local State
621
- def local_num_uint(*_args)
622
- ExtendedOpcodes.app_param_value 'AppLocalNumUint'
623
- end
624
-
625
- # @return [uint64] Number of byte array values allowed in Local State
626
- def local_num_byte_slice(*_args)
627
- ExtendedOpcodes.app_param_value 'AppLocalNumByteSlice'
628
- end
629
-
630
- # @return [uint64] Number of Extra Program Pages of code space
631
- def extra_program_pages(*_args)
632
- ExtendedOpcodes.app_param_value 'AppExtraProgramPages'
633
- end
634
-
635
- # @return [[]byte] Creator address
636
- def creator(*_args)
637
- ExtendedOpcodes.app_param_value 'AppCreator'
638
- end
639
-
640
- # @return [[]byte] Address for which this application has authority
641
- def address(*_args)
642
- ExtendedOpcodes.app_param_value 'AppAddress'
643
- end
644
-
645
- # @return [[]byte] Bytecode of Approval Program
646
- def approval_program?(*_args)
647
- ExtendedOpcodes.app_param_exists? 'AppApprovalProgram'
648
- end
649
-
650
- # @return [[]byte] Bytecode of Clear State Program
651
- def clear_state_program?(*_args)
652
- ExtendedOpcodes.app_param_exists? 'AppClearStateProgram'
653
- end
654
-
655
- # @return [uint64] Number of uint64 values allowed in Global State
656
- def global_num_uint?(*_args)
657
- ExtendedOpcodes.app_param_exists? 'AppGlobalNumUint'
658
- end
659
-
660
- # @return [uint64] Number of byte array values allowed in Global State
661
- def global_num_byte_slice?(*_args)
662
- ExtendedOpcodes.app_param_exists? 'AppGlobalNumByteSlice'
663
- end
664
-
665
- # @return [uint64] Number of uint64 values allowed in Local State
666
- def local_num_uint?(*_args)
667
- ExtendedOpcodes.app_param_exists? 'AppLocalNumUint'
668
- end
669
-
670
- # @return [uint64] Number of byte array values allowed in Local State
671
- def local_num_byte_slice?(*_args)
672
- ExtendedOpcodes.app_param_exists? 'AppLocalNumByteSlice'
673
- end
674
-
675
- # @return [uint64] Number of Extra Program Pages of code space
676
- def extra_program_pages?(*_args)
677
- ExtendedOpcodes.app_param_exists? 'AppExtraProgramPages'
678
- end
679
-
680
- # @return [[]byte] Creator address
681
- def creator?(*_args)
682
- ExtendedOpcodes.app_param_exists? 'AppCreator'
683
- end
684
-
685
- # @return [[]byte] Address for which this application has authority
686
- def address?(*_args)
687
- ExtendedOpcodes.app_param_exists? 'AppAddress'
688
- end
689
- end
690
-
691
- class Assets < TxnArray
692
- def initialize
693
- super
694
- @field = 'Assets'
695
- end
696
-
697
- def total
698
- ExtendedOpcodes.asset_param_value 'AssetTotal'
699
- end
700
-
701
- def decimals
702
- ExtendedOpcodes.asset_param_value 'AssetDecimals'
703
- end
704
-
705
- def default_frozen
706
- ExtendedOpcodes.asset_param_value 'AssetDefaultFrozen'
707
- end
708
-
709
- def name
710
- ExtendedOpcodes.asset_param_value 'AssetName'
711
- end
712
-
713
- def unit_name
714
- ExtendedOpcodes.asset_param_value 'AssetUnitName'
715
- end
716
-
717
- def url
718
- ExtendedOpcodes.asset_param_value 'AssetURL'
719
- end
720
-
721
- def metadata_hash
722
- ExtendedOpcodes.asset_param_value 'AssetMetadataHash'
723
- end
724
-
725
- def manager
726
- ExtendedOpcodes.asset_param_value 'AssetManager'
727
- end
728
-
729
- def reserve
730
- ExtendedOpcodes.asset_param_value 'AssetReserve'
731
- end
732
-
733
- def freeze
734
- ExtendedOpcodes.asset_param_value 'AssetFreeze'
735
- end
736
-
737
- def clawback
738
- ExtendedOpcodes.asset_param_value 'AssetClawback'
739
- end
740
-
741
- def creator
742
- ExtendedOpcodes.asset_param_value 'AssetCreator'
743
- end
744
-
745
- def total?
746
- ExtendedOpcodes.asset_param_exists? 'AssetTotal'
747
- end
748
-
749
- def decimals?
750
- ExtendedOpcodes.asset_param_exists? 'AssetDecimals'
751
- end
752
-
753
- def default_frozen?
754
- ExtendedOpcodes.asset_param_exists? 'AssetDefaultFrozen'
755
- end
756
-
757
- def name?
758
- ExtendedOpcodes.asset_param_exists? 'AssetName'
759
- end
760
-
761
- def unit_name?
762
- ExtendedOpcodes.asset_param_exists? 'AssetUnitName'
763
- end
764
-
765
- def url?
766
- ExtendedOpcodes.asset_param_exists? 'AssetURL'
767
- end
768
-
769
- def metadata_hash?
770
- ExtendedOpcodes.asset_param_exists? 'AssetMetadataHash'
771
- end
772
-
773
- def manager?
774
- ExtendedOpcodes.asset_param_exists? 'AssetManager'
775
- end
776
-
777
- def reserve?
778
- ExtendedOpcodes.asset_param_exists? 'AssetReserve'
779
- end
780
-
781
- def freeze?
782
- ExtendedOpcodes.asset_param_exists? 'AssetFreeze'
783
- end
784
-
785
- def clawback?
786
- ExtendedOpcodes.asset_param_exists? 'AssetClawback'
787
- end
788
-
789
- def creator?
790
- ExtendedOpcodes.asset_param_exists? 'AssetCreator'
791
- end
792
- end
793
-
794
- module Txna
795
- def self.application_args
796
- ApplicationArgs.new
797
- end
798
-
799
- def self.accounts
800
- Accounts.new
801
- end
802
-
803
- def self.assets
804
- Assets.new
805
- end
806
-
807
- def self.applications
808
- Apps.new
809
- end
810
-
811
- def self.logs
812
- Logs.new
813
- end
814
- end
815
-
816
- module Global
817
- extend GlobalFields
818
-
819
- def self.opcode(field)
820
- ExtendedOpcodes.global field
821
- end
822
-
823
- def self.[](key)
824
- ExtendedOpcodes.app_global_get key
825
- end
826
-
827
- def self.[]=(key, value)
828
- ExtendedOpcodes.app_global_put key, value
829
- end
830
- end
831
-
832
- module AppArgs
833
- def self.[](index)
834
- Txna.application_args[index]
835
- end
836
- end
837
-
838
- module MaybeOps
839
- def app_param_exists?(field, _app_id = nil)
840
- app_params_get field
841
- swap
842
- pop
843
- end
844
-
845
- def app_param_value(field, _app_id = nil)
846
- app_params_get field
847
- pop
848
- end
849
-
850
- def asset_param_exists?(field, _asset_id = nil)
851
- asset_params_get field
852
- swap
853
- pop
854
- end
855
-
856
- def asset_param_value(field, _asset_id = nil)
857
- asset_params_get field
858
- pop
859
- end
860
-
861
- def acct_has_balance?(_asset_id = nil)
862
- acct_params_get 'AcctBalance'
863
- swap
864
- pop
865
- end
866
-
867
- def acct_param_value(field, _asset_id = nil)
868
- acct_params_get field
869
- pop
870
- end
871
-
872
- def app_local_ex_exists?(_account = nil, _applicaiton = nil, _key = nil)
873
- app_local_get_ex
874
- swap
875
- pop
876
- end
877
-
878
- def app_local_ex_value(_account = nil, _applicaiton = nil, _key = nil)
879
- app_local_get_ex
880
- pop
881
- end
882
-
883
- def app_global_ex_exists?(_account = nil, _applicaiton = nil, _key = nil)
884
- app_global_get_ex
885
- swap
886
- pop
887
- end
888
-
889
- def app_global_ex_value(_account = nil, _applicaiton = nil, _key = nil)
890
- app_global_get_ex
891
- pop
892
- end
893
- end
894
-
895
- module AllOpcodes
896
- include TEALOpcodes
897
- include MaybeOps
898
- end
899
-
900
- module ExtendedOpcodes
901
- extend AllOpcodes
902
- end
903
- end
904
- end