tealrb 0.10.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,883 +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 Gtxn
478
- extend TxnFields
479
-
480
- def self.opcode(field, index)
481
- ExtendedOpcodes.gtxn index, field
482
- end
483
-
484
- def self.[](index)
485
- GroupTransaction.new(index)
486
- end
487
- end
488
-
489
- module Gtxns
490
- extend TxnFields
491
-
492
- def self.opcode(field)
493
- ExtendedOpcodes.gtxns field
494
- end
495
-
496
- def self.[](_index)
497
- self
498
- end
499
- end
500
-
501
- class GroupTransaction
502
- include TxnFields
503
-
504
- def initialize(index)
505
- @index = index
506
- end
507
-
508
- def opcode(field)
509
- ExtendedOpcodes.gtxn @index, field
510
- end
511
- end
512
-
513
- class TxnArray
514
- TEALrb::Opcodes::BINARY_OPCODE_METHOD_MAPPING.each do |meth, opcode|
515
- define_method(meth) do |other|
516
- ExtendedOpcodes.send(opcode, self, other)
517
- end
518
- end
519
-
520
- TEALrb::Opcodes::UNARY_OPCODE_METHOD_MAPPING.each do |meth, opcode|
521
- define_method(meth) do
522
- ExtendedOpcodes.send(opcode, self)
523
- end
524
- end
525
-
526
- def self.[](index)
527
- new[index]
528
- end
529
-
530
- def [](index)
531
- ExtendedOpcodes.txna @field, index
532
- self
533
- end
534
- end
535
-
536
- class ApplicationArgs < TxnArray
537
- def initialize
538
- super
539
- @field = 'ApplicationArgs'
540
- end
541
- end
542
-
543
- class Logs < TxnArray
544
- def initialize
545
- super
546
- @field = 'Logs'
547
- end
548
- end
549
-
550
- class Accounts < TxnArray
551
- def initialize
552
- super
553
- @field = 'Accounts'
554
- end
555
-
556
- def min_balance
557
- ExtendedOpcodes.acct_param_value 'AcctMinBalance'
558
- end
559
-
560
- def balance
561
- ExtendedOpcodes.acct_param_value 'AcctBalance'
562
- end
563
-
564
- def auth_addr
565
- ExtendedOpcodes.acct_param_value 'AcctAuthAddr'
566
- end
567
-
568
- def balance?
569
- ExtendedOpcodes.acct_has_balance?
570
- end
571
- end
572
-
573
- class Apps < TxnArray
574
- def initialize
575
- super
576
- @field = 'Applications'
577
- end
578
-
579
- # @return [[]byte] Bytecode of Approval Program
580
- def approval_program(*_args)
581
- ExtendedOpcodes.app_param_value 'AppApprovalProgram'
582
- end
583
-
584
- # @return [[]byte] Bytecode of Clear State Program
585
- def clear_state_program(*_args)
586
- ExtendedOpcodes.app_param_value 'AppClearStateProgram'
587
- end
588
-
589
- # @return [uint64] Number of uint64 values allowed in Global State
590
- def global_num_uint(*_args)
591
- ExtendedOpcodes.app_param_value 'AppGlobalNumUint'
592
- end
593
-
594
- # @return [uint64] Number of byte array values allowed in Global State
595
- def global_num_byte_slice(*_args)
596
- ExtendedOpcodes.app_param_value 'AppGlobalNumByteSlice'
597
- end
598
-
599
- # @return [uint64] Number of uint64 values allowed in Local State
600
- def local_num_uint(*_args)
601
- ExtendedOpcodes.app_param_value 'AppLocalNumUint'
602
- end
603
-
604
- # @return [uint64] Number of byte array values allowed in Local State
605
- def local_num_byte_slice(*_args)
606
- ExtendedOpcodes.app_param_value 'AppLocalNumByteSlice'
607
- end
608
-
609
- # @return [uint64] Number of Extra Program Pages of code space
610
- def extra_program_pages(*_args)
611
- ExtendedOpcodes.app_param_value 'AppExtraProgramPages'
612
- end
613
-
614
- # @return [[]byte] Creator address
615
- def creator(*_args)
616
- ExtendedOpcodes.app_param_value 'AppCreator'
617
- end
618
-
619
- # @return [[]byte] Address for which this application has authority
620
- def address(*_args)
621
- ExtendedOpcodes.app_param_value 'AppAddress'
622
- end
623
-
624
- # @return [[]byte] Bytecode of Approval Program
625
- def approval_program?(*_args)
626
- ExtendedOpcodes.app_param_exists? 'AppApprovalProgram'
627
- end
628
-
629
- # @return [[]byte] Bytecode of Clear State Program
630
- def clear_state_program?(*_args)
631
- ExtendedOpcodes.app_param_exists? 'AppClearStateProgram'
632
- end
633
-
634
- # @return [uint64] Number of uint64 values allowed in Global State
635
- def global_num_uint?(*_args)
636
- ExtendedOpcodes.app_param_exists? 'AppGlobalNumUint'
637
- end
638
-
639
- # @return [uint64] Number of byte array values allowed in Global State
640
- def global_num_byte_slice?(*_args)
641
- ExtendedOpcodes.app_param_exists? 'AppGlobalNumByteSlice'
642
- end
643
-
644
- # @return [uint64] Number of uint64 values allowed in Local State
645
- def local_num_uint?(*_args)
646
- ExtendedOpcodes.app_param_exists? 'AppLocalNumUint'
647
- end
648
-
649
- # @return [uint64] Number of byte array values allowed in Local State
650
- def local_num_byte_slice?(*_args)
651
- ExtendedOpcodes.app_param_exists? 'AppLocalNumByteSlice'
652
- end
653
-
654
- # @return [uint64] Number of Extra Program Pages of code space
655
- def extra_program_pages?(*_args)
656
- ExtendedOpcodes.app_param_exists? 'AppExtraProgramPages'
657
- end
658
-
659
- # @return [[]byte] Creator address
660
- def creator?(*_args)
661
- ExtendedOpcodes.app_param_exists? 'AppCreator'
662
- end
663
-
664
- # @return [[]byte] Address for which this application has authority
665
- def address?(*_args)
666
- ExtendedOpcodes.app_param_exists? 'AppAddress'
667
- end
668
- end
669
-
670
- class Assets < TxnArray
671
- def initialize
672
- super
673
- @field = 'Assets'
674
- end
675
-
676
- def total
677
- ExtendedOpcodes.asset_param_value 'AssetTotal'
678
- end
679
-
680
- def decimals
681
- ExtendedOpcodes.asset_param_value 'AssetDecimals'
682
- end
683
-
684
- def default_frozen
685
- ExtendedOpcodes.asset_param_value 'AssetDefaultFrozen'
686
- end
687
-
688
- def name
689
- ExtendedOpcodes.asset_param_value 'AssetName'
690
- end
691
-
692
- def unit_name
693
- ExtendedOpcodes.asset_param_value 'AssetUnitName'
694
- end
695
-
696
- def url
697
- ExtendedOpcodes.asset_param_value 'AssetURL'
698
- end
699
-
700
- def metadata_hash
701
- ExtendedOpcodes.asset_param_value 'AssetMetadataHash'
702
- end
703
-
704
- def manager
705
- ExtendedOpcodes.asset_param_value 'AssetManager'
706
- end
707
-
708
- def reserve
709
- ExtendedOpcodes.asset_param_value 'AssetReserve'
710
- end
711
-
712
- def freeze
713
- ExtendedOpcodes.asset_param_value 'AssetFreeze'
714
- end
715
-
716
- def clawback
717
- ExtendedOpcodes.asset_param_value 'AssetClawback'
718
- end
719
-
720
- def creator
721
- ExtendedOpcodes.asset_param_value 'AssetCreator'
722
- end
723
-
724
- def total?
725
- ExtendedOpcodes.asset_param_exists? 'AssetTotal'
726
- end
727
-
728
- def decimals?
729
- ExtendedOpcodes.asset_param_exists? 'AssetDecimals'
730
- end
731
-
732
- def default_frozen?
733
- ExtendedOpcodes.asset_param_exists? 'AssetDefaultFrozen'
734
- end
735
-
736
- def name?
737
- ExtendedOpcodes.asset_param_exists? 'AssetName'
738
- end
739
-
740
- def unit_name?
741
- ExtendedOpcodes.asset_param_exists? 'AssetUnitName'
742
- end
743
-
744
- def url?
745
- ExtendedOpcodes.asset_param_exists? 'AssetURL'
746
- end
747
-
748
- def metadata_hash?
749
- ExtendedOpcodes.asset_param_exists? 'AssetMetadataHash'
750
- end
751
-
752
- def manager?
753
- ExtendedOpcodes.asset_param_exists? 'AssetManager'
754
- end
755
-
756
- def reserve?
757
- ExtendedOpcodes.asset_param_exists? 'AssetReserve'
758
- end
759
-
760
- def freeze?
761
- ExtendedOpcodes.asset_param_exists? 'AssetFreeze'
762
- end
763
-
764
- def clawback?
765
- ExtendedOpcodes.asset_param_exists? 'AssetClawback'
766
- end
767
-
768
- def creator?
769
- ExtendedOpcodes.asset_param_exists? 'AssetCreator'
770
- end
771
- end
772
-
773
- module Txna
774
- def self.application_args
775
- ApplicationArgs.new
776
- end
777
-
778
- def self.accounts
779
- Accounts.new
780
- end
781
-
782
- def self.assets
783
- Assets.new
784
- end
785
-
786
- def self.applications
787
- Apps.new
788
- end
789
-
790
- def self.logs
791
- Logs.new
792
- end
793
- end
794
-
795
- module Global
796
- extend GlobalFields
797
-
798
- def self.opcode(field)
799
- ExtendedOpcodes.global field
800
- end
801
-
802
- def self.[](key)
803
- ExtendedOpcodes.app_global_get key
804
- end
805
-
806
- def self.[]=(key, value)
807
- ExtendedOpcodes.app_global_put key, value
808
- end
809
- end
810
-
811
- module AppArgs
812
- def self.[](index)
813
- Txna.application_args[index]
814
- end
815
- end
816
-
817
- module MaybeOps
818
- def app_param_exists?(field, _app_id = nil)
819
- app_params_get field
820
- swap
821
- pop
822
- end
823
-
824
- def app_param_value(field, _app_id = nil)
825
- app_params_get field
826
- pop
827
- end
828
-
829
- def asset_param_exists?(field, _asset_id = nil)
830
- asset_params_get field
831
- swap
832
- pop
833
- end
834
-
835
- def asset_param_value(field, _asset_id = nil)
836
- asset_params_get field
837
- pop
838
- end
839
-
840
- def acct_has_balance?(_asset_id = nil)
841
- acct_params_get 'AcctBalance'
842
- swap
843
- pop
844
- end
845
-
846
- def acct_param_value(field, _asset_id = nil)
847
- acct_params_get field
848
- pop
849
- end
850
-
851
- def app_local_ex_exists?(_account = nil, _applicaiton = nil, _key = nil)
852
- app_local_get_ex
853
- swap
854
- pop
855
- end
856
-
857
- def app_local_ex_value(_account = nil, _applicaiton = nil, _key = nil)
858
- app_local_get_ex
859
- pop
860
- end
861
-
862
- def app_global_ex_exists?(_account = nil, _applicaiton = nil, _key = nil)
863
- app_global_get_ex
864
- swap
865
- pop
866
- end
867
-
868
- def app_global_ex_value(_account = nil, _applicaiton = nil, _key = nil)
869
- app_global_get_ex
870
- pop
871
- end
872
- end
873
-
874
- module AllOpcodes
875
- include TEALOpcodes
876
- include MaybeOps
877
- end
878
-
879
- module ExtendedOpcodes
880
- extend AllOpcodes
881
- end
882
- end
883
- end