Skip to content

Commit 610a7bf

Browse files
committed
Changes to opcode documentation
1 parent 76edf02 commit 610a7bf

File tree

3 files changed

+62
-56
lines changed

3 files changed

+62
-56
lines changed

data/transactions/logic/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ Starting from version 2 TEAL evaluator can run programs in two modes:
3636
2. Application run (stateful)
3737

3838
Differences between modes include:
39-
1. Max program length (consensus parameters LogicSigMaxSize, MaxApprovalProgramLen and MaxClearStateProgramLen)
39+
1. Max program length (consensus parameters LogicSigMaxSize, MaxAppProgramLen & MaxExtraAppProgramPages)
4040
2. Max program cost (consensus parameters LogicSigMaxCost, MaxAppProgramCost)
41-
3. Opcodes availability. For example, all stateful operations are only available in stateful mode. Refer to [opcodes document](TEAL_opcodes.md) for details.
41+
3. Opcode availability. For example, all stateful operations are only available in stateful mode. Refer to [opcodes document](TEAL_opcodes.md) for details.
4242

4343
## Constants
4444

@@ -345,19 +345,19 @@ Asset fields include `AssetHolding` and `AssetParam` fields that are used in `as
345345

346346
| Op | Description |
347347
| --- | --- |
348-
| `balance` | get balance for the requested account specified by Txn.Accounts[A] in microalgos. A is specified as an account index in the Accounts field of the ApplicationCall transaction, zero index means the sender. The balance is observed after the effects of previous transactions in the group, and after the fee for the current transaction is deducted. |
349-
| `min_balance` | get minimum required balance for the requested account specified by Txn.Accounts[A] in microalgos. A is specified as an account index in the Accounts field of the ApplicationCall transaction, zero index means the sender. Required balance is affected by [ASA](https://developer.algorand.org/docs/features/asa/#assets-overview) and [App](https://developer.algorand.org/docs/features/asc1/stateful/#minimum-balance-requirement-for-a-smart-contract) usage. When creating or opting into an app, the minimum balance grows before the app code runs, therefore the increase is visible there. When deleting or closing out, the minimum balance decreases after the app executes. |
350-
| `app_opted_in` | check if account specified by Txn.Accounts[A] opted in for the application B => {0 or 1} |
351-
| `app_local_get` | read from account specified by Txn.Accounts[A] from local state of the current application key B => value |
352-
| `app_local_get_ex` | read from account specified by Txn.Accounts[A] from local state of the application B key C => [*... stack*, value, 0 or 1] |
348+
| `balance` | get balance account A, in microalgos. The balance is observed after the effects of previous transactions in the group, and after the fee for the current transaction is deducted. |
349+
| `min_balance` | get minimum required balance account A, in microalgos. Required balance is affected by [ASA](https://developer.algorand.org/docs/features/asa/#assets-overview) and [App](https://developer.algorand.org/docs/features/asc1/stateful/#minimum-balance-requirement-for-a-smart-contract) usage. When creating or opting into an app, the minimum balance grows before the app code runs, therefore the increase is visible there. When deleting or closing out, the minimum balance decreases after the app executes. |
350+
| `app_opted_in` | check if account A opted in for the application B => {0 or 1} |
351+
| `app_local_get` | read from account A from local state of the current application key B => value |
352+
| `app_local_get_ex` | read from account A from local state of the application B key C => [*... stack*, value, 0 or 1] |
353353
| `app_global_get` | read key A from global state of a current application => value |
354-
| `app_global_get_ex` | read from application Txn.ForeignApps[A] global state key B => [*... stack*, value, 0 or 1]. A is specified as an account index in the ForeignApps field of the ApplicationCall transaction, zero index means this app |
355-
| `app_local_put` | write to account specified by Txn.Accounts[A] to local state of a current application key B with value C |
354+
| `app_global_get_ex` | read from application A global state key B => [*... stack*, value, 0 or 1] |
355+
| `app_local_put` | write to account specified by A to local state of a current application key B with value C |
356356
| `app_global_put` | write key A and value B to global state of the current application |
357-
| `app_local_del` | delete from account specified by Txn.Accounts[A] local state key B of the current application |
357+
| `app_local_del` | delete from account A local state key B of the current application |
358358
| `app_global_del` | delete key A from a global state of the current application |
359-
| `asset_holding_get i` | read from account specified by Txn.Accounts[A] and asset B holding field X (imm arg) => {0 or 1 (top), value} |
360-
| `asset_params_get i` | read from asset Txn.ForeignAssets[A] params field X (imm arg) => {0 or 1 (top), value} |
359+
| `asset_holding_get i` | read from account A and asset B holding field X (imm arg) => {0 or 1 (top), value} |
360+
| `asset_params_get i` | read from asset A params field X (imm arg) => {0 or 1 (top), value} |
361361

362362
# Assembler Syntax
363363

data/transactions/logic/TEAL_opcodes.md

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -702,44 +702,46 @@ bit indexing begins with low-order bits in integers. Setting bit 4 to 1 on the i
702702
## balance
703703

704704
- Opcode: 0x60
705-
- Pops: *... stack*, uint64
705+
- Pops: *... stack*, any
706706
- Pushes: uint64
707-
- get balance for the requested account specified by Txn.Accounts[A] in microalgos. A is specified as an account index in the Accounts field of the ApplicationCall transaction, zero index means the sender. The balance is observed after the effects of previous transactions in the group, and after the fee for the current transaction is deducted.
707+
- get balance account A, in microalgos. The balance is observed after the effects of previous transactions in the group, and after the fee for the current transaction is deducted.
708708
- LogicSigVersion >= 2
709709
- Mode: Application
710710

711+
params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender). Return: value.
712+
711713
## app_opted_in
712714

713715
- Opcode: 0x61
714-
- Pops: *... stack*, {uint64 A}, {uint64 B}
716+
- Pops: *... stack*, {any A}, {uint64 B}
715717
- Pushes: uint64
716-
- check if account specified by Txn.Accounts[A] opted in for the application B => {0 or 1}
718+
- check if account A opted in for the application B => {0 or 1}
717719
- LogicSigVersion >= 2
718720
- Mode: Application
719721

720-
params: account index, application id (top of the stack on opcode entry). Return: 1 if opted in and 0 otherwise.
722+
params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender), application id (or, since v4, a Txn.ForeignApps offset). Return: 1 if opted in and 0 otherwise.
721723

722724
## app_local_get
723725

724726
- Opcode: 0x62
725-
- Pops: *... stack*, {uint64 A}, {[]byte B}
727+
- Pops: *... stack*, {any A}, {[]byte B}
726728
- Pushes: any
727-
- read from account specified by Txn.Accounts[A] from local state of the current application key B => value
729+
- read from account A from local state of the current application key B => value
728730
- LogicSigVersion >= 2
729731
- Mode: Application
730732

731-
params: account index, state key. Return: value. The value is zero (of type uint64) if the key does not exist.
733+
params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender), state key. Return: value. The value is zero (of type uint64) if the key does not exist.
732734

733735
## app_local_get_ex
734736

735737
- Opcode: 0x63
736-
- Pops: *... stack*, {uint64 A}, {uint64 B}, {[]byte C}
738+
- Pops: *... stack*, {any A}, {uint64 B}, {[]byte C}
737739
- Pushes: *... stack*, any, uint64
738-
- read from account specified by Txn.Accounts[A] from local state of the application B key C => [*... stack*, value, 0 or 1]
740+
- read from account A from local state of the application B key C => [*... stack*, value, 0 or 1]
739741
- LogicSigVersion >= 2
740742
- Mode: Application
741743

742-
params: account index, application id, state key. Return: did_exist flag (top of the stack, 1 if exist and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist.
744+
params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender), application id (or, since v4, a Txn.ForeignApps offset), state key. Return: did_exist flag (top of the stack, 1 if exist and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist.
743745

744746
## app_global_get
745747

@@ -757,22 +759,22 @@ params: state key. Return: value. The value is zero (of type uint64) if the key
757759
- Opcode: 0x65
758760
- Pops: *... stack*, {uint64 A}, {[]byte B}
759761
- Pushes: *... stack*, any, uint64
760-
- read from application Txn.ForeignApps[A] global state key B => [*... stack*, value, 0 or 1]. A is specified as an account index in the ForeignApps field of the ApplicationCall transaction, zero index means this app
762+
- read from application A global state key B => [*... stack*, value, 0 or 1]
761763
- LogicSigVersion >= 2
762764
- Mode: Application
763765

764-
params: application index, state key. Return: did_exist flag (top of the stack, 1 if exist and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist.
766+
params: Txn.ForeignApps offset (or, since v4, an application id that appears in Txn.ForeignApps or is the CurrentApplicationID), state key. Return: did_exist flag (top of the stack, 1 if exist and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist.
765767

766768
## app_local_put
767769

768770
- Opcode: 0x66
769-
- Pops: *... stack*, {uint64 A}, {[]byte B}, {any C}
771+
- Pops: *... stack*, {any A}, {[]byte B}, {any C}
770772
- Pushes: _None_
771-
- write to account specified by Txn.Accounts[A] to local state of a current application key B with value C
773+
- write to account specified by A to local state of a current application key B with value C
772774
- LogicSigVersion >= 2
773775
- Mode: Application
774776

775-
params: account index, state key, value.
777+
params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender), state key, value.
776778

777779
## app_global_put
778780

@@ -786,13 +788,13 @@ params: account index, state key, value.
786788
## app_local_del
787789

788790
- Opcode: 0x68
789-
- Pops: *... stack*, {uint64 A}, {[]byte B}
791+
- Pops: *... stack*, {any A}, {[]byte B}
790792
- Pushes: _None_
791-
- delete from account specified by Txn.Accounts[A] local state key B of the current application
793+
- delete from account A local state key B of the current application
792794
- LogicSigVersion >= 2
793795
- Mode: Application
794796

795-
params: account index, state key.
797+
params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender), state key.
796798

797799
Deleting a key which is already absent has no effect on the application local state. (In particular, it does _not_ cause the program to fail.)
798800

@@ -812,9 +814,9 @@ Deleting a key which is already absent has no effect on the application global s
812814
## asset_holding_get i
813815

814816
- Opcode: 0x70 {uint8 asset holding field index}
815-
- Pops: *... stack*, {uint64 A}, {uint64 B}
817+
- Pops: *... stack*, {any A}, {uint64 B}
816818
- Pushes: *... stack*, any, uint64
817-
- read from account specified by Txn.Accounts[A] and asset B holding field X (imm arg) => {0 or 1 (top), value}
819+
- read from account A and asset B holding field X (imm arg) => {0 or 1 (top), value}
818820
- LogicSigVersion >= 2
819821
- Mode: Application
820822

@@ -826,14 +828,14 @@ Deleting a key which is already absent has no effect on the application global s
826828
| 1 | AssetFrozen | uint64 | Is the asset frozen or not |
827829

828830

829-
params: account index, asset id. Return: did_exist flag (1 if exist and 0 otherwise), value.
831+
params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender), asset id (or, since v4, a Txn.ForeignAssets offset). Return: did_exist flag (1 if exist and 0 otherwise), value.
830832

831833
## asset_params_get i
832834

833835
- Opcode: 0x71 {uint8 asset params field index}
834836
- Pops: *... stack*, uint64
835837
- Pushes: *... stack*, any, uint64
836-
- read from asset Txn.ForeignAssets[A] params field X (imm arg) => {0 or 1 (top), value}
838+
- read from asset A params field X (imm arg) => {0 or 1 (top), value}
837839
- LogicSigVersion >= 2
838840
- Mode: Application
839841

@@ -854,17 +856,19 @@ params: account index, asset id. Return: did_exist flag (1 if exist and 0 otherw
854856
| 10 | AssetClawback | []byte | Clawback address |
855857

856858

857-
params: txn.ForeignAssets offset. Return: did_exist flag (1 if exist and 0 otherwise), value.
859+
params: Txn.ForeignAssets offset (or, since v4, an asset id that appears in Txn.ForeignAssets) . Return: did_exist flag (1 if exist and 0 otherwise), value.
858860

859861
## min_balance
860862

861863
- Opcode: 0x78
862-
- Pops: *... stack*, uint64
864+
- Pops: *... stack*, any
863865
- Pushes: uint64
864-
- get minimum required balance for the requested account specified by Txn.Accounts[A] in microalgos. A is specified as an account index in the Accounts field of the ApplicationCall transaction, zero index means the sender. Required balance is affected by [ASA](https://developer.algorand.org/docs/features/asa/#assets-overview) and [App](https://developer.algorand.org/docs/features/asc1/stateful/#minimum-balance-requirement-for-a-smart-contract) usage. When creating or opting into an app, the minimum balance grows before the app code runs, therefore the increase is visible there. When deleting or closing out, the minimum balance decreases after the app executes.
866+
- get minimum required balance account A, in microalgos. Required balance is affected by [ASA](https://developer.algorand.org/docs/features/asa/#assets-overview) and [App](https://developer.algorand.org/docs/features/asc1/stateful/#minimum-balance-requirement-for-a-smart-contract) usage. When creating or opting into an app, the minimum balance grows before the app code runs, therefore the increase is visible there. When deleting or closing out, the minimum balance decreases after the app executes.
865867
- LogicSigVersion >= 3
866868
- Mode: Application
867869

870+
params: Txn.Accounts offset (or, since v4, an account address that appears in Txn.Accounts or is Txn.Sender). Return: value.
871+
868872
## pushbytes bytes
869873

870874
- Opcode: 0x80 {varuint length} {bytes}

0 commit comments

Comments
 (0)