From 27e7298594ce8fb55a7bdebabbf0f683a2d0fc8a Mon Sep 17 00:00:00 2001 From: Bobby Lat Date: Mon, 2 Dec 2024 16:27:58 +0800 Subject: [PATCH 1/7] refactor: tweaks required by stub impelemtation of arc4 types --- package-lock.json | 3 --- package.json | 2 +- src/awst_build/eb/arc4/arrays.ts | 2 +- src/awst_build/ptypes/arc4-types.ts | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3b8260b2..c6ec7993 100644 --- a/package-lock.json +++ b/package-lock.json @@ -79,7 +79,6 @@ "resolved": "https://registry.npmjs.org/@algorandfoundation/algokit-utils/-/algokit-utils-8.0.0.tgz", "integrity": "sha512-SIrQpWFJaAbqwN6dMvvEPYxggUjtq2OCpfRLvmBWksJ/Psi2CLdsS3R84vmilszRaLX5C1aRTv0c1rBxYEe3+w==", "dev": true, - "license": "MIT", "dependencies": { "buffer": "^6.0.3" }, @@ -3010,7 +3009,6 @@ "resolved": "https://registry.npmjs.org/algorand-msgpack/-/algorand-msgpack-1.1.0.tgz", "integrity": "sha512-08k7pBQnkaUB5p+jL7f1TRaUIlTSDE0cesFu1mD7llLao+1cAhtvvZmGE3OnisTd0xOn118QMw74SRqddqaYvw==", "dev": true, - "license": "ISC", "peer": true, "engines": { "node": ">= 14" @@ -3021,7 +3019,6 @@ "resolved": "https://registry.npmjs.org/algosdk/-/algosdk-3.0.0.tgz", "integrity": "sha512-PIKZ/YvbBpCudduug4KSH1CY/pTotI7/ccbUIbXKtcI9Onevl+57E+K5X4ow4gsCdysZ8zVvSLdxuCcXvsmPOw==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "algorand-msgpack": "^1.1.0", diff --git a/package.json b/package.json index 95ff10d1..dd7365c0 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "algo-ts:build": "cd packages/algo-ts && npm run build", "algo-ts:build:watch": "cd packages/algo-ts && npm run build:3-build:watch", "algo-ts:install": "npm i -D @algorandfoundation/algorand-typescript@./packages/algo-ts/dist", - "npm-install-all": "cd packages/algo-ts && npm i && npm run build && cd ../algo-ts-testing && npm i && npm run build && cd ../../ && npm i", + "npm-install-all": "cd packages/algo-ts && npm i && npm run build && cd ../../ && npm i", "script:op-types": "tsx ./scripts/generate-op-types.ts packages/algo-ts/src/op-types.ts && cd packages/algo-ts && eslint src/op-types.ts --fix", "script:op-metadata": "tsx ./scripts/generate-op-metadata.ts src/awst_build/op-metadata.ts && eslint src/awst_build/op-metadata.ts --fix", "script:op-ptypes": "tsx ./scripts/generate-op-ptypes.ts src/awst_build/ptypes/op-ptypes.ts && eslint src/awst_build/ptypes/op-ptypes.ts --fix" diff --git a/src/awst_build/eb/arc4/arrays.ts b/src/awst_build/eb/arc4/arrays.ts index e075cba2..dbddf32d 100644 --- a/src/awst_build/eb/arc4/arrays.ts +++ b/src/awst_build/eb/arc4/arrays.ts @@ -74,7 +74,7 @@ export class StaticArrayClassBuilder extends ClassBuilder { args, typeArgs, callLocation: sourceLocation, - funcName: 'DynamicArray constructor', + funcName: 'StaticArray constructor', genericTypeArgs: 2, argSpec: (a) => args.map((_) => a.required()), }) diff --git a/src/awst_build/ptypes/arc4-types.ts b/src/awst_build/ptypes/arc4-types.ts index c7b03d07..47962094 100644 --- a/src/awst_build/ptypes/arc4-types.ts +++ b/src/awst_build/ptypes/arc4-types.ts @@ -451,7 +451,7 @@ export class StaticArrayType extends ARC4EncodedType { } } export const arc4AddressAlias = new StaticArrayType({ - arraySize: BigInt(Constants.encodedAddressLength), + arraySize: BigInt(Constants.addressLength), elementType: arc4ByteAlias, wtype: wtypes.arc4AddressAliasWType, immutable: true, From 119a2db6c66d02925b97f3ed3220505d306c9f1a Mon Sep 17 00:00:00 2001 From: Bobby Lat Date: Fri, 6 Dec 2024 16:29:10 +0800 Subject: [PATCH 2/7] fix: typo which is setting wrong state value counts in arc32.json --- src/awst_build/models/app-storage-declaration.ts | 2 +- tests/approvals/out/jsdoc/JSDocDemo.arc32.json | 15 ++++++++------- tests/approvals/out/jsdoc/JSDocDemo.arc56.json | 9 +++++---- tests/approvals/out/jsdoc/jsdoc.awst | 2 ++ tests/approvals/out/jsdoc/jsdoc.awst.json | 2 +- .../out/local-state/LocalStateDemo.arc32.json | 16 ++++++++-------- .../out/local-state/LocalStateDemo.arc56.json | 12 ++++++------ tests/approvals/out/local-state/local-state.awst | 2 +- .../out/local-state/local-state.awst.json | 10 +++++----- 9 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/awst_build/models/app-storage-declaration.ts b/src/awst_build/models/app-storage-declaration.ts index 732eaf21..c4787fba 100644 --- a/src/awst_build/models/app-storage-declaration.ts +++ b/src/awst_build/models/app-storage-declaration.ts @@ -35,7 +35,7 @@ export class AppStorageDeclaration { return AppStorageKind.appGlobal } if (this.ptype instanceof LocalStateType) { - return AppStorageKind.appGlobal + return AppStorageKind.accountLocal } invariant( this.ptype instanceof BoxPType || this.ptype instanceof BoxRefPType || this.ptype instanceof BoxMapPType, diff --git a/tests/approvals/out/jsdoc/JSDocDemo.arc32.json b/tests/approvals/out/jsdoc/JSDocDemo.arc32.json index 29e115c4..caa5d3cf 100644 --- a/tests/approvals/out/jsdoc/JSDocDemo.arc32.json +++ b/tests/approvals/out/jsdoc/JSDocDemo.arc32.json @@ -40,11 +40,11 @@ "state": { "global": { "num_byte_slices": 1, - "num_uints": 1 + "num_uints": 0 }, "local": { "num_byte_slices": 0, - "num_uints": 0 + "num_uints": 1 } }, "schema": { @@ -53,16 +53,17 @@ "globalState": { "type": "bytes", "key": "globalState" - }, - "localState": { - "type": "uint64", - "key": "localState" } }, "reserved": {} }, "local": { - "declared": {}, + "declared": { + "localState": { + "type": "uint64", + "key": "localState" + } + }, "reserved": {} } }, diff --git a/tests/approvals/out/jsdoc/JSDocDemo.arc56.json b/tests/approvals/out/jsdoc/JSDocDemo.arc56.json index 4b3d0131..1f1c0a78 100644 --- a/tests/approvals/out/jsdoc/JSDocDemo.arc56.json +++ b/tests/approvals/out/jsdoc/JSDocDemo.arc56.json @@ -80,11 +80,11 @@ "state": { "schema": { "global": { - "ints": 1, + "ints": 0, "bytes": 1 }, "local": { - "ints": 0, + "ints": 1, "bytes": 0 } }, @@ -94,14 +94,15 @@ "keyType": "AVMString", "valueType": "AVMString", "key": "Z2xvYmFsU3RhdGU=" - }, + } + }, + "local": { "localState": { "keyType": "AVMString", "valueType": "AVMUint64", "key": "bG9jYWxTdGF0ZQ==" } }, - "local": {}, "box": {} }, "maps": { diff --git a/tests/approvals/out/jsdoc/jsdoc.awst b/tests/approvals/out/jsdoc/jsdoc.awst index 93bc1dc0..ad61c8dd 100644 --- a/tests/approvals/out/jsdoc/jsdoc.awst +++ b/tests/approvals/out/jsdoc/jsdoc.awst @@ -2,6 +2,8 @@ contract JSDocDemo { globals { ["globalState"]: string + } + locals { ["localState"]: uint64 } approvalProgram(): bool diff --git a/tests/approvals/out/jsdoc/jsdoc.awst.json b/tests/approvals/out/jsdoc/jsdoc.awst.json index b21d3902..cc2b503b 100644 --- a/tests/approvals/out/jsdoc/jsdoc.awst.json +++ b/tests/approvals/out/jsdoc/jsdoc.awst.json @@ -1175,7 +1175,7 @@ "end_column": 12 }, "member_name": "localState", - "kind": 1, + "kind": 2, "storage_wtype": { "_type": "WType", "name": "uint64", diff --git a/tests/approvals/out/local-state/LocalStateDemo.arc32.json b/tests/approvals/out/local-state/LocalStateDemo.arc32.json index 587a5a02..16b75930 100644 --- a/tests/approvals/out/local-state/LocalStateDemo.arc32.json +++ b/tests/approvals/out/local-state/LocalStateDemo.arc32.json @@ -64,16 +64,20 @@ }, "state": { "global": { - "num_byte_slices": 3, - "num_uints": 2 - }, - "local": { "num_byte_slices": 0, "num_uints": 0 + }, + "local": { + "num_byte_slices": 3, + "num_uints": 2 } }, "schema": { "global": { + "declared": {}, + "reserved": {} + }, + "local": { "declared": { "localBytes": { "type": "bytes", @@ -97,10 +101,6 @@ } }, "reserved": {} - }, - "local": { - "declared": {}, - "reserved": {} } }, "contract": { diff --git a/tests/approvals/out/local-state/LocalStateDemo.arc56.json b/tests/approvals/out/local-state/LocalStateDemo.arc56.json index a244ec5d..c2d3ea58 100644 --- a/tests/approvals/out/local-state/LocalStateDemo.arc56.json +++ b/tests/approvals/out/local-state/LocalStateDemo.arc56.json @@ -103,16 +103,17 @@ "state": { "schema": { "global": { - "ints": 2, - "bytes": 3 - }, - "local": { "ints": 0, "bytes": 0 + }, + "local": { + "ints": 2, + "bytes": 3 } }, "keys": { - "global": { + "global": {}, + "local": { "localUint": { "keyType": "AVMString", "valueType": "AVMUint64", @@ -139,7 +140,6 @@ "key": "bG9jYWxFbmNvZGVk" } }, - "local": {}, "box": {} }, "maps": { diff --git a/tests/approvals/out/local-state/local-state.awst b/tests/approvals/out/local-state/local-state.awst index e9e7c4d1..f0efa836 100644 --- a/tests/approvals/out/local-state/local-state.awst +++ b/tests/approvals/out/local-state/local-state.awst @@ -1,6 +1,6 @@ contract LocalStateDemo { - globals { + locals { ["l1"]: uint64 ["localUint2"]: uint64 ["b1"]: bytes diff --git a/tests/approvals/out/local-state/local-state.awst.json b/tests/approvals/out/local-state/local-state.awst.json index 9aebb516..377489d7 100644 --- a/tests/approvals/out/local-state/local-state.awst.json +++ b/tests/approvals/out/local-state/local-state.awst.json @@ -4808,7 +4808,7 @@ "end_column": 11 }, "member_name": "localUint", - "kind": 1, + "kind": 2, "storage_wtype": { "_type": "WType", "name": "uint64", @@ -4848,7 +4848,7 @@ "end_column": 12 }, "member_name": "localUint2", - "kind": 1, + "kind": 2, "storage_wtype": { "_type": "WType", "name": "uint64", @@ -4888,7 +4888,7 @@ "end_column": 12 }, "member_name": "localBytes", - "kind": 1, + "kind": 2, "storage_wtype": { "_type": "WType", "name": "bytes", @@ -4928,7 +4928,7 @@ "end_column": 13 }, "member_name": "localBytes2", - "kind": 1, + "kind": 2, "storage_wtype": { "_type": "WType", "name": "bytes", @@ -4968,7 +4968,7 @@ "end_column": 14 }, "member_name": "localEncoded", - "kind": 1, + "kind": 2, "storage_wtype": { "_type": "ARC4StaticArray", "name": "arc4.static_array", From 204a9f1378b7c7f8ec515f5b48114fd5956f6df4 Mon Sep 17 00:00:00 2001 From: Tristan Menzel Date: Thu, 5 Dec 2024 16:10:35 -0800 Subject: [PATCH 3/7] feat: AVM11 Support --- langspec.puya.json | 16149 ++++++++-------- package-lock.json | 2 +- package.json | 2 +- packages/algo-ts/package.json | 2 +- packages/algo-ts/src/base-contract.ts | 68 + packages/algo-ts/src/index.ts | 4 +- packages/algo-ts/src/logic-sig.ts | 25 + packages/algo-ts/src/op-types.ts | 557 +- packages/algo-ts/src/op.ts | 7 + scripts/build-op-module.ts | 23 +- scripts/generate-op-types.ts | 12 +- .../ast-visitors/contract-method-visitor.ts | 19 +- .../ast-visitors/contract-visitor.ts | 11 +- .../ast-visitors/decorator-visitor.ts | 106 +- .../ast-visitors/logic-sig-visitor.ts | 6 +- .../eb/arc4-bare-method-decorator-builder.ts | 20 +- src/awst_build/eb/contract-builder.ts | 45 +- src/awst_build/eb/index.ts | 17 + src/awst_build/eb/logic-sig-builder.ts | 36 +- src/awst_build/eb/util/avm-version.ts | 11 + src/awst_build/lib/index.ts | 6 +- src/awst_build/models/contract-class-model.ts | 41 +- src/awst_build/models/decorator-data.ts | 61 + .../models/logic-sig-class-model.ts | 7 +- src/awst_build/op-metadata.ts | 215 + src/awst_build/ptypes/index.ts | 10 + src/awst_build/ptypes/register.ts | 8 +- src/constants.ts | 7 + src/util/index.ts | 2 +- tests/approvals/avm11.algo.ts | 44 + .../abi-decorators/abi-decorators.awst.json | 9 +- .../approvals/out/accounts/accounts.awst.json | 9 +- .../out/arc28-events/arc28-events.awst.json | 9 +- .../arc4-encode-decode.awst.json | 9 +- .../out/arc4-struct/arc4-struct.awst.json | 9 +- .../out/arc4-types/arc4-types.awst.json | 9 +- .../out/assert-match/assert-match.awst.json | 9 +- .../out/avm11/AVM11Contract.approval.teal | 199 + .../out/avm11/AVM11Contract.arc32.json | 50 + .../out/avm11/AVM11Contract.arc56.json | 168 + .../out/avm11/AVM11Contract.clear.teal | 5 + tests/approvals/out/avm11/AVM11SIG.teal | 9 + .../approvals/out/avm11/Avm11Contract.ssa.ir | 125 + tests/approvals/out/avm11/Avm11Sig.ssa.ir | 6 + tests/approvals/out/avm11/avm11.awst | 63 + tests/approvals/out/avm11/avm11.awst.json | 2857 +++ .../biguint-expressions.awst.json | 9 +- .../byte-expressions.awst.json | 9 +- .../call-expressions.awst.json | 9 +- .../out/ensure-budget/ensure-budget.awst.json | 9 +- .../out/global-state/global-state.awst.json | 9 +- .../implicit-create/implicit-create.awst.json | 54 +- .../out/inheritance-b/inheritance-b.awst.json | 18 +- tests/approvals/out/itxn/itxn.awst.json | 9 +- tests/approvals/out/jsdoc/jsdoc.awst.json | 9 +- .../out/local-state/local-state.awst.json | 9 +- .../out/logic-sig/logic-sig.awst.json | 4 +- .../out/named-types/named-types.awst.json | 9 +- .../approvals/out/non-arc4/non-arc4.awst.json | 9 +- .../pre-approved-sale.awst.json | 2 +- .../precompiled-apps.awst.json | 38 +- .../precompiled-factory.awst.json | 9 +- .../property-ordering.awst.json | 9 +- .../shadowed-variables.awst.json | 9 +- tests/approvals/out/strings/strings.awst.json | 9 +- .../uint64-expressions.awst.json | 9 +- tests/expected-output/abi-decorators.algo.ts | 2 +- 67 files changed, 13115 insertions(+), 8206 deletions(-) create mode 100644 src/awst_build/eb/util/avm-version.ts create mode 100644 src/awst_build/models/decorator-data.ts create mode 100644 tests/approvals/avm11.algo.ts create mode 100644 tests/approvals/out/avm11/AVM11Contract.approval.teal create mode 100644 tests/approvals/out/avm11/AVM11Contract.arc32.json create mode 100644 tests/approvals/out/avm11/AVM11Contract.arc56.json create mode 100644 tests/approvals/out/avm11/AVM11Contract.clear.teal create mode 100644 tests/approvals/out/avm11/AVM11SIG.teal create mode 100644 tests/approvals/out/avm11/Avm11Contract.ssa.ir create mode 100644 tests/approvals/out/avm11/Avm11Sig.ssa.ir create mode 100644 tests/approvals/out/avm11/avm11.awst create mode 100644 tests/approvals/out/avm11/avm11.awst.json diff --git a/langspec.puya.json b/langspec.puya.json index d406c14f..a50bdde4 100644 --- a/langspec.puya.json +++ b/langspec.puya.json @@ -1,7944 +1,8211 @@ { - "ops": { - "!": { - "name": "!", - "size": 1, - "doc": [ - "A == 0 yields 1; else 0" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "!=": { - "name": "!=", - "size": 1, - "doc": [ - "A is not equal to B => {0 or 1}" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - }, - { - "name": "B", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "%": { - "name": "%", - "size": 1, - "doc": [ - "A modulo B. Fail if B == 0." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "&": { - "name": "&", - "size": 1, - "doc": [ - "A bitwise-and B" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "&&": { - "name": "&&", - "size": 1, - "doc": [ - "A is not zero and B is not zero => {0 or 1}" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "*": { - "name": "*", - "size": 1, - "doc": [ - "A times B. Fail on overflow.", - "Overflow is an error condition which halts execution and fails the transaction. Full precision is available from `mulw`." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "+": { - "name": "+", - "size": 1, - "doc": [ - "A plus B. Fail on overflow.", - "Overflow is an error condition which halts execution and fails the transaction. Full precision is available from `addw`." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "-": { - "name": "-", - "size": 1, - "doc": [ - "A minus B. Fail if B > A." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "/": { - "name": "/", - "size": 1, - "doc": [ - "A divided by B (truncated division). Fail if B == 0.", - "`divmodw` is available to divide the two-element values produced by `mulw` and `addw`." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "<": { - "name": "<", - "size": 1, - "doc": [ - "A less than B => {0 or 1}" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "<=": { - "name": "<=", - "size": 1, - "doc": [ - "A less than or equal to B => {0 or 1}" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "==": { - "name": "==", - "size": 1, - "doc": [ - "A is equal to B => {0 or 1}" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - }, - { - "name": "B", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - ">": { - "name": ">", - "size": 1, - "doc": [ - "A greater than B => {0 or 1}" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - ">=": { - "name": ">=", - "size": 1, - "doc": [ - "A greater than or equal to B => {0 or 1}" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "^": { - "name": "^", - "size": 1, - "doc": [ - "A bitwise-xor B" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "acct_params_get": { - "name": "acct_params_get", - "size": 2, - "doc": [ - "X is field F from account A. Y is 1 if A owns positive algos, else 0" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 6, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "address_or_index", - "doc": null - } - ], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "acct_params", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "account params field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - }, - { - "name": "Y", - "stack_type": "bool", - "doc": null - } - ] - }, - "addw": { - "name": "addw", - "size": 1, - "doc": [ - "A plus B as a 128-bit result. X is the carry-bit, Y is the low-order 64 bits." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - }, - { - "name": "Y", - "stack_type": "uint64", - "doc": null - } - ] - }, - "app_global_del": { - "name": "app_global_del", - "size": 1, - "doc": [ - "delete key A from the global state of the current application", - "params: state key.", - "", - "Deleting a key which is already absent has no effect on the application global state. (In particular, it does _not_ cause the program to fail.)" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "stateKey", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [] - }, - "app_global_get": { - "name": "app_global_get", - "size": 1, - "doc": [ - "global state of the key A in the current application", - "params: state key. Return: value. The value is zero (of type uint64) if the key does not exist." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "stateKey", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "app_global_get_ex": { - "name": "app_global_get_ex", - "size": 1, - "doc": [ - "X is the global state of application A, key B. Y is 1 if key existed, else 0", - "params: Txn.ForeignApps offset (or, since v4, an _available_ application id), state key. Return: did_exist flag (top of the stack, 1 if the application and key existed and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "application", - "doc": null - }, - { - "name": "B", - "stack_type": "stateKey", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - }, - { - "name": "Y", - "stack_type": "bool", - "doc": null - } - ] - }, - "app_global_put": { - "name": "app_global_put", - "size": 1, - "doc": [ - "write B to key A in the global state of the current application" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "stateKey", - "doc": null - }, - { - "name": "B", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [] - }, - "app_local_del": { - "name": "app_local_del", - "size": 1, - "doc": [ - "delete key B from account A's local state of the current application", - "params: Txn.Accounts offset (or, since v4, an _available_ account address), state key.", - "", - "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.)" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "address_or_index", - "doc": null - }, - { - "name": "B", - "stack_type": "stateKey", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [] - }, - "app_local_get": { - "name": "app_local_get", - "size": 1, - "doc": [ - "local state of the key B in the current application in account A", - "params: Txn.Accounts offset (or, since v4, an _available_ account address), state key. Return: value. The value is zero (of type uint64) if the key does not exist." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "address_or_index", - "doc": null - }, - { - "name": "B", - "stack_type": "stateKey", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "app_local_get_ex": { - "name": "app_local_get_ex", - "size": 1, - "doc": [ - "X is the local state of application B, key C in account A. Y is 1 if key existed, else 0", - "params: Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset), state key. Return: did_exist flag (top of the stack, 1 if the application and key existed and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "address_or_index", - "doc": null - }, - { - "name": "B", - "stack_type": "application", - "doc": null - }, - { - "name": "C", - "stack_type": "stateKey", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - }, - { - "name": "Y", - "stack_type": "bool", - "doc": null - } - ] - }, - "app_local_put": { - "name": "app_local_put", - "size": 1, - "doc": [ - "write C to key B in account A's local state of the current application", - "params: Txn.Accounts offset (or, since v4, an _available_ account address), state key, value." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "address_or_index", - "doc": null - }, - { - "name": "B", - "stack_type": "stateKey", - "doc": null - }, - { - "name": "C", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [] - }, - "app_opted_in": { - "name": "app_opted_in", - "size": 1, - "doc": [ - "1 if account A is opted in to application B, else 0", - "params: Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset). Return: 1 if opted in and 0 otherwise." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "address_or_index", - "doc": null - }, - { - "name": "B", - "stack_type": "application", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "app_params_get": { - "name": "app_params_get", - "size": 2, - "doc": [ - "X is field F from app A. Y is 1 if A exists, else 0", - "params: Txn.ForeignApps offset or an _available_ app id. Return: did_exist flag (1 if the application existed and 0 otherwise), value." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "application", - "doc": null - } - ], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "app_params", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "app params field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - }, - { - "name": "Y", - "stack_type": "bool", - "doc": null - } - ] - }, - "arg": { - "name": "arg", - "size": 2, - "doc": [ - "Nth LogicSig argument" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "sig", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "N", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "an arg index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "arg_0": { - "name": "arg_0", - "size": 1, - "doc": [ - "LogicSig argument 0" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "sig", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "arg_1": { - "name": "arg_1", - "size": 1, - "doc": [ - "LogicSig argument 1" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "sig", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "arg_2": { - "name": "arg_2", - "size": 1, - "doc": [ - "LogicSig argument 2" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "sig", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "arg_3": { - "name": "arg_3", - "size": 1, - "doc": [ - "LogicSig argument 3" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "sig", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "args": { - "name": "args", - "size": 1, - "doc": [ - "Ath LogicSig argument" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "sig", - "groups": [ - "Loading Values" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "assert": { - "name": "assert", - "size": 1, - "doc": [ - "immediately fail unless A is a non-zero number" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 3, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [] - }, - "asset_holding_get": { - "name": "asset_holding_get", - "size": 2, - "doc": [ - "X is field F from account A's holding of asset B. Y is 1 if A is opted into B, else 0", - "params: Txn.Accounts offset (or, since v4, an _available_ address), asset id (or, since v4, a Txn.ForeignAssets offset). Return: did_exist flag (1 if the asset existed and 0 otherwise), value." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "address_or_index", - "doc": null - }, - { - "name": "B", - "stack_type": "asset", - "doc": null - } - ], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "asset_holding", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "asset holding field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - }, - { - "name": "Y", - "stack_type": "bool", - "doc": null - } - ] - }, - "asset_params_get": { - "name": "asset_params_get", - "size": 2, - "doc": [ - "X is field F from asset A. Y is 1 if A exists, else 0", - "params: Txn.ForeignAssets offset (or, since v4, an _available_ asset id. Return: did_exist flag (1 if the asset existed and 0 otherwise), value." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "asset", - "doc": null - } - ], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "asset_params", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "asset params field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - }, - { - "name": "Y", - "stack_type": "bool", - "doc": null - } - ] - }, - "b": { - "name": "b", - "size": 3, - "doc": [ - "branch unconditionally to TARGET", - "See `bnz` for details on how branches work. `b` always jumps to the offset." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "TARGET", - "immediate_type": "label", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "branch offset" - } - ], - "stack_outputs": [] - }, - "b!=": { - "name": "b!=", - "size": 1, - "doc": [ - "0 if A is equal to B, else 1. A and B are interpreted as big-endian unsigned integers" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "bigint", - "doc": null - }, - { - "name": "B", - "stack_type": "bigint", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "b%": { - "name": "b%", - "size": 1, - "doc": [ - "A modulo B. A and B are interpreted as big-endian unsigned integers. Fail if B is zero." - ], - "cost": { - "value": 20, - "doc": "20" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "bigint", - "doc": null - }, - { - "name": "B", - "stack_type": "bigint", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bigint", - "doc": null - } - ] - }, - "b&": { - "name": "b&", - "size": 1, - "doc": [ - "A bitwise-and B. A and B are zero-left extended to the greater of their lengths" - ], - "cost": { - "value": 6, - "doc": "6" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Logic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "b*": { - "name": "b*", - "size": 1, - "doc": [ - "A times B. A and B are interpreted as big-endian unsigned integers." - ], - "cost": { - "value": 20, - "doc": "20" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "bigint", - "doc": null - }, - { - "name": "B", - "stack_type": "bigint", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "b+": { - "name": "b+", - "size": 1, - "doc": [ - "A plus B. A and B are interpreted as big-endian unsigned integers" - ], - "cost": { - "value": 10, - "doc": "10" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "bigint", - "doc": null - }, - { - "name": "B", - "stack_type": "bigint", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "b-": { - "name": "b-", - "size": 1, - "doc": [ - "A minus B. A and B are interpreted as big-endian unsigned integers. Fail on underflow." - ], - "cost": { - "value": 10, - "doc": "10" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "bigint", - "doc": null - }, - { - "name": "B", - "stack_type": "bigint", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bigint", - "doc": null - } - ] - }, - "b/": { - "name": "b/", - "size": 1, - "doc": [ - "A divided by B (truncated division). A and B are interpreted as big-endian unsigned integers. Fail if B is zero." - ], - "cost": { - "value": 20, - "doc": "20" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "bigint", - "doc": null - }, - { - "name": "B", - "stack_type": "bigint", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bigint", - "doc": null - } - ] - }, - "b<": { - "name": "b<", - "size": 1, - "doc": [ - "1 if A is less than B, else 0. A and B are interpreted as big-endian unsigned integers" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "bigint", - "doc": null - }, - { - "name": "B", - "stack_type": "bigint", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "b<=": { - "name": "b<=", - "size": 1, - "doc": [ - "1 if A is less than or equal to B, else 0. A and B are interpreted as big-endian unsigned integers" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "bigint", - "doc": null - }, - { - "name": "B", - "stack_type": "bigint", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "b==": { - "name": "b==", - "size": 1, - "doc": [ - "1 if A is equal to B, else 0. A and B are interpreted as big-endian unsigned integers" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "bigint", - "doc": null - }, - { - "name": "B", - "stack_type": "bigint", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "b>": { - "name": "b>", - "size": 1, - "doc": [ - "1 if A is greater than B, else 0. A and B are interpreted as big-endian unsigned integers" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "bigint", - "doc": null - }, - { - "name": "B", - "stack_type": "bigint", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "b>=": { - "name": "b>=", - "size": 1, - "doc": [ - "1 if A is greater than or equal to B, else 0. A and B are interpreted as big-endian unsigned integers" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "bigint", - "doc": null - }, - { - "name": "B", - "stack_type": "bigint", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "b^": { - "name": "b^", - "size": 1, - "doc": [ - "A bitwise-xor B. A and B are zero-left extended to the greater of their lengths" - ], - "cost": { - "value": 6, - "doc": "6" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Logic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "balance": { - "name": "balance", - "size": 1, - "doc": [ - "balance for 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. Changes caused by inner transactions are observable immediately following `itxn_submit`", - "params: Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset). Return: value." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "address_or_index", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "base64_decode": { - "name": "base64_decode", - "size": 2, - "doc": [ - "decode A which was base64-encoded using _encoding_ E. Fail if A is not base64 encoded with encoding E", - "*Warning*: Usage should be restricted to very rare use cases. In almost all cases, smart contracts should directly handle non-encoded byte-strings.\tThis opcode should only be used in cases where base64 is the only available option, e.g. interoperability with a third-party that only signs base64 strings.", - "", - " Decodes A using the base64 encoding E. Specify the encoding with an immediate arg either as URL and Filename Safe (`URLEncoding`) or Standard (`StdEncoding`). See [RFC 4648 sections 4 and 5](https://rfc-editor.org/rfc/rfc4648.html#section-4). It is assumed that the encoding ends with the exact number of `=` padding characters as required by the RFC. When padding occurs, any unused pad bits in the encoding must be set to zero or the decoding will fail. The special cases of `\\n` and `\\r` are allowed but completely ignored. An error will result when attempting to decode a string with a character that is not in the encoding alphabet or not one of `=`, `\\r`, or `\\n`." - ], - "cost": { - "value": null, - "doc": "1 + 1 per 16 bytes of A" - }, - "min_avm_version": 7, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "E", - "immediate_type": "arg_enum", - "arg_enum": "base64", - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "encoding index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "bitlen": { - "name": "bitlen", - "size": 1, - "doc": [ - "The highest set bit in A. If A is a byte-array, it is interpreted as a big-endian unsigned integer. bitlen of 0 is 0, bitlen of 8 is 4", - "bitlen interprets arrays as big-endian integers, unlike setbit/getbit" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "block": { - "name": "block", - "size": 2, - "doc": [ - "field F of block A. Fail unless A falls between txn.LastValid-1002 and txn.FirstValid (exclusive)" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 7, - "halts": false, - "mode": "any", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "block", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": " block field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "bnz": { - "name": "bnz", - "size": 3, - "doc": [ - "branch to TARGET if value A is not zero", - "The `bnz` instruction opcode 0x40 is followed by two immediate data bytes which are a high byte first and low byte second which together form a 16 bit offset which the instruction may branch to. For a bnz instruction at `pc`, if the last element of the stack is not zero then branch to instruction at `pc + 3 + N`, else proceed to next instruction at `pc + 3`. Branch targets must be aligned instructions. (e.g. Branching to the second byte of a 2 byte op will be rejected.) Starting at v4, the offset is treated as a signed 16 bit integer allowing for backward branches and looping. In prior version (v1 to v3), branch offsets are limited to forward branches only, 0-0x7fff.", - "", - "At v2 it became allowed to branch to the end of the program exactly after the last instruction: bnz to byte N (with 0-indexing) was illegal for a TEAL program with N bytes before v2, and is legal after it. This change eliminates the need for a last instruction of no-op as a branch target at the end. (Branching beyond the end--in other words, to a byte larger than N--is still illegal and will cause the program to fail.)" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [ - { - "name": "TARGET", - "immediate_type": "label", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "branch offset" - } - ], - "stack_outputs": [] - }, - "box_create": { - "name": "box_create", - "size": 1, - "doc": [ - "create a box named A, of length B. Fail if the name A is empty or B exceeds 32,768. Returns 0 if A already existed, else 1", - "Newly created boxes are filled with 0 bytes. `box_create` will fail if the referenced box already exists with a different size. Otherwise, existing boxes are unchanged by `box_create`." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "app", - "groups": [ - "Box Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "boxName", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "box_del": { - "name": "box_del", - "size": 1, - "doc": [ - "delete box named A if it exists. Return 1 if A existed, 0 otherwise" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "app", - "groups": [ - "Box Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "boxName", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "box_extract": { - "name": "box_extract", - "size": 1, - "doc": [ - "read C bytes from box A, starting at offset B. Fail if A does not exist, or the byte range is outside A's size." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "app", - "groups": [ - "Box Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "boxName", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - }, - { - "name": "C", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "box_get": { - "name": "box_get", - "size": 1, - "doc": [ - "X is the contents of box A if A exists, else ''. Y is 1 if A exists, else 0.", - "For boxes that exceed 4,096 bytes, consider `box_create`, `box_extract`, and `box_replace`" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "app", - "groups": [ - "Box Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "boxName", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "Y", - "stack_type": "bool", - "doc": null - } - ] - }, - "box_len": { - "name": "box_len", - "size": 1, - "doc": [ - "X is the length of box A if A exists, else 0. Y is 1 if A exists, else 0." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "app", - "groups": [ - "Box Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "boxName", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - }, - { - "name": "Y", - "stack_type": "bool", - "doc": null - } - ] - }, - "box_put": { - "name": "box_put", - "size": 1, - "doc": [ - "replaces the contents of box A with byte-array B. Fails if A exists and len(B) != len(box A). Creates A if it does not exist", - "For boxes that exceed 4,096 bytes, consider `box_create`, `box_extract`, and `box_replace`" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "app", - "groups": [ - "Box Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "boxName", - "doc": null - }, - { - "name": "B", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [] - }, - "box_replace": { - "name": "box_replace", - "size": 1, - "doc": [ - "write byte-array C into box A, starting at offset B. Fail if A does not exist, or the byte range is outside A's size." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "app", - "groups": [ - "Box Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "boxName", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - }, - { - "name": "C", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [] - }, - "box_resize": { - "name": "box_resize", - "size": 1, - "doc": [ - "change the size of box named A to be of length B, adding zero bytes to end or removing bytes from the end, as needed. Fail if the name A is empty, A is not an existing box, or B exceeds 32,768." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 10, - "halts": false, - "mode": "app", - "groups": [ - "Box Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "boxName", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [] - }, - "box_splice": { - "name": "box_splice", - "size": 1, - "doc": [ - "set box A to contain its previous bytes up to index B, followed by D, followed by the original bytes of A that began at index B+C.", - "Boxes are of constant length. If C < len(D), then len(D)-C bytes will be removed from the end. If C > len(D), zero bytes will be appended to the end to reach the box length." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 10, - "halts": false, - "mode": "app", - "groups": [ - "Box Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "boxName", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - }, - { - "name": "C", - "stack_type": "uint64", - "doc": null - }, - { - "name": "D", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [] - }, - "bsqrt": { - "name": "bsqrt", - "size": 1, - "doc": [ - "The largest integer I such that I^2 <= A. A and I are interpreted as big-endian unsigned integers" - ], - "cost": { - "value": 40, - "doc": "40" - }, - "min_avm_version": 6, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "bigint", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bigint", - "doc": null - } - ] - }, - "btoi": { - "name": "btoi", - "size": 1, - "doc": [ - "converts big-endian byte array A to uint64. Fails if len(A) > 8. Padded by leading 0s if len(A) < 8.", - "`btoi` fails if the input is longer than 8 bytes." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "bury": { - "name": "bury", - "size": 2, - "doc": [ - "replace the Nth value from the top of the stack with A. bury 0 fails." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [ - { - "name": "N", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "depth" - } - ], - "stack_outputs": [] - }, - "bytec": { - "name": "bytec", - "size": 2, - "doc": [ - "Ith constant from bytecblock" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "I", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "an index in the bytecblock" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "bytec_0": { - "name": "bytec_0", - "size": 1, - "doc": [ - "constant 0 from bytecblock" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "bytec_1": { - "name": "bytec_1", - "size": 1, - "doc": [ - "constant 1 from bytecblock" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "bytec_2": { - "name": "bytec_2", - "size": 1, - "doc": [ - "constant 2 from bytecblock" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "bytec_3": { - "name": "bytec_3", - "size": 1, - "doc": [ - "constant 3 from bytecblock" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "bytecblock": { - "name": "bytecblock", - "size": 0, - "doc": [ - "prepare block of byte-array constants for use by bytec", - "`bytecblock` loads the following program bytes into an array of byte-array constants in the evaluator. These constants can be referred to by `bytec` and `bytec_*` which will push the value onto the stack. Subsequent calls to `bytecblock` reset and replace the bytes constants available to the script." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "BYTES ...", - "immediate_type": "bytes_array", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "a block of byte constant values" - } - ], - "stack_outputs": [] - }, - "bz": { - "name": "bz", - "size": 3, - "doc": [ - "branch to TARGET if value A is zero", - "See `bnz` for details on how branches work. `bz` inverts the behavior of `bnz`." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [ - { - "name": "TARGET", - "immediate_type": "label", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "branch offset" - } - ], - "stack_outputs": [] - }, - "bzero": { - "name": "bzero", - "size": 1, - "doc": [ - "zero filled byte-array of length A" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "b|": { - "name": "b|", - "size": 1, - "doc": [ - "A bitwise-or B. A and B are zero-left extended to the greater of their lengths" - ], - "cost": { - "value": 6, - "doc": "6" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Logic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "b~": { - "name": "b~", - "size": 1, - "doc": [ - "A with all bits inverted" - ], - "cost": { - "value": 4, - "doc": "4" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Logic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "callsub": { - "name": "callsub", - "size": 3, - "doc": [ - "branch unconditionally to TARGET, saving the next instruction on the call stack", - "The call stack is separate from the data stack. Only `callsub`, `retsub`, and `proto` manipulate it." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "TARGET", - "immediate_type": "label", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "branch offset" - } - ], - "stack_outputs": [] - }, - "concat": { - "name": "concat", - "size": 1, - "doc": [ - "join A and B", - "`concat` fails if the result would be greater than 4096 bytes." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "cover": { - "name": "cover", - "size": 2, - "doc": [ - "remove top of stack, and place it deeper in the stack such that N elements are above it. Fails if stack depth <= N." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [ - { - "name": "N", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "depth" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "dig": { - "name": "dig", - "size": 2, - "doc": [ - "Nth value from the top of the stack. dig 0 is equivalent to dup" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 3, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [ - { - "name": "N", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "depth" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - }, - { - "name": "Y", - "stack_type": "any", - "doc": null - } - ] - }, - "divmodw": { - "name": "divmodw", - "size": 1, - "doc": [ - "W,X = (A,B / C,D); Y,Z = (A,B modulo C,D)", - "The notation J,K indicates that two uint64 values J and K are interpreted as a uint128 value, with J as the high uint64 and K the low." - ], - "cost": { - "value": 20, - "doc": "20" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - }, - { - "name": "C", - "stack_type": "uint64", - "doc": null - }, - { - "name": "D", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "W", - "stack_type": "uint64", - "doc": null - }, - { - "name": "X", - "stack_type": "uint64", - "doc": null - }, - { - "name": "Y", - "stack_type": "uint64", - "doc": null - }, - { - "name": "Z", - "stack_type": "uint64", - "doc": null - } - ] - }, - "divw": { - "name": "divw", - "size": 1, - "doc": [ - "A,B / C. Fail if C == 0 or if result overflows.", - "The notation A,B indicates that A and B are interpreted as a uint128 value, with A as the high uint64 and B the low." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 6, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - }, - { - "name": "C", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "dup": { - "name": "dup", - "size": 1, - "doc": [ - "duplicate A" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - }, - { - "name": "Y", - "stack_type": "any", - "doc": null - } - ] - }, - "dup2": { - "name": "dup2", - "size": 1, - "doc": [ - "duplicate A and B" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - }, - { - "name": "B", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "W", - "stack_type": "any", - "doc": null - }, - { - "name": "X", - "stack_type": "any", - "doc": null - }, - { - "name": "Y", - "stack_type": "any", - "doc": null - }, - { - "name": "Z", - "stack_type": "any", - "doc": null - } - ] - }, - "dupn": { - "name": "dupn", - "size": 2, - "doc": [ - "duplicate A, N times" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [ - { - "name": "N", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "copy count" - } - ], - "stack_outputs": [] - }, - "ec_add": { - "name": "ec_add", - "size": 2, - "doc": [ - "for curve points A and B, return the curve point A + B", - "A and B are curve points in affine representation: field element X concatenated with field element Y. Field element `Z` is encoded as follows.", - "For the base field elements (Fp), `Z` is encoded as a big-endian number and must be lower than the field modulus.", - "For the quadratic field extension (Fp2), `Z` is encoded as the concatenation of the individual encoding of the coefficients. For an Fp2 element of the form `Z = Z0 + Z1 i`, where `i` is a formal quadratic non-residue, the encoding of Z is the concatenation of the encoding of `Z0` and `Z1` in this order. (`Z0` and `Z1` must be less than the field modulus).", - "", - "The point at infinity is encoded as `(X,Y) = (0,0)`.", - "Groups G1 and G2 are denoted additively.", - "", - "Fails if A or B is not in G.", - "A and/or B are allowed to be the point at infinity.", - "Does _not_ check if A and B are in the main prime-order subgroup." - ], - "cost": { - "value": null, - "doc": "BN254g1=125; BN254g2=170; BLS12_381g1=205; BLS12_381g2=290" - }, - "min_avm_version": 10, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "G", - "immediate_type": "arg_enum", - "arg_enum": "EC", - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "curve index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "ec_map_to": { - "name": "ec_map_to", - "size": 2, - "doc": [ - "maps field element A to group G", - "BN254 points are mapped by the SVDW map. BLS12-381 points are mapped by the SSWU map.", - "G1 element inputs are base field elements and G2 element inputs are quadratic field elements, with nearly the same encoding rules (for field elements) as defined in `ec_add`. There is one difference of encoding rule: G1 element inputs do not need to be 0-padded if they fit in less than 32 bytes for BN254 and less than 48 bytes for BLS12-381. (As usual, the empty byte array represents 0.) G2 elements inputs need to be always have the required size." - ], - "cost": { - "value": null, - "doc": "BN254g1=630; BN254g2=3300; BLS12_381g1=1950; BLS12_381g2=8150" - }, - "min_avm_version": 10, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "G", - "immediate_type": "arg_enum", - "arg_enum": "EC", - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "curve index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "ec_multi_scalar_mul": { - "name": "ec_multi_scalar_mul", - "size": 2, - "doc": [ - "for curve points A and scalars B, return curve point B0A0 + B1A1 + B2A2 + ... + BnAn", - "A is a list of concatenated points, encoded and checked as described in `ec_add`. B is a list of concatenated scalars which, unlike ec_scalar_mul, must all be exactly 32 bytes long.", - "The name `ec_multi_scalar_mul` was chosen to reflect common usage, but a more consistent name would be `ec_multi_scalar_mul`. AVM values are limited to 4096 bytes, so `ec_multi_scalar_mul` is limited by the size of the points in the group being operated upon." - ], - "cost": { - "value": null, - "doc": "BN254g1=3600 + 90 per 32 bytes of B; BN254g2=7200 + 270 per 32 bytes of B; BLS12_381g1=6500 + 95 per 32 bytes of B; BLS12_381g2=14850 + 485 per 32 bytes of B" - }, - "min_avm_version": 10, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "G", - "immediate_type": "arg_enum", - "arg_enum": "EC", - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "curve index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "ec_pairing_check": { - "name": "ec_pairing_check", - "size": 2, - "doc": [ - "1 if the product of the pairing of each point in A with its respective point in B is equal to the identity element of the target group Gt, else 0", - "A and B are concatenated points, encoded and checked as described in `ec_add`. A contains points of the group G, B contains points of the associated group (G2 if G is G1, and vice versa). Fails if A and B have a different number of points, or if any point is not in its described group or outside the main prime-order subgroup - a stronger condition than other opcodes. AVM values are limited to 4096 bytes, so `ec_pairing_check` is limited by the size of the points in the groups being operated upon." - ], - "cost": { - "value": null, - "doc": "BN254g1=8000 + 7400 per 64 bytes of B; BN254g2=8000 + 7400 per 128 bytes of B; BLS12_381g1=13000 + 10000 per 96 bytes of B; BLS12_381g2=13000 + 10000 per 192 bytes of B" - }, - "min_avm_version": 10, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "G", - "immediate_type": "arg_enum", - "arg_enum": "EC", - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "curve index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "ec_scalar_mul": { - "name": "ec_scalar_mul", - "size": 2, - "doc": [ - "for curve point A and scalar B, return the curve point BA, the point A multiplied by the scalar B.", - "A is a curve point encoded and checked as described in `ec_add`. Scalar B is interpreted as a big-endian unsigned integer. Fails if B exceeds 32 bytes." - ], - "cost": { - "value": null, - "doc": "BN254g1=1810; BN254g2=3430; BLS12_381g1=2950; BLS12_381g2=6530" - }, - "min_avm_version": 10, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "G", - "immediate_type": "arg_enum", - "arg_enum": "EC", - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "curve index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "ec_subgroup_check": { - "name": "ec_subgroup_check", - "size": 2, - "doc": [ - "1 if A is in the main prime-order subgroup of G (including the point at infinity) else 0. Program fails if A is not in G at all." - ], - "cost": { - "value": null, - "doc": "BN254g1=20; BN254g2=3100; BLS12_381g1=1850; BLS12_381g2=2340" - }, - "min_avm_version": 10, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "G", - "immediate_type": "arg_enum", - "arg_enum": "EC", - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "curve index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "ecdsa_pk_decompress": { - "name": "ecdsa_pk_decompress", - "size": 2, - "doc": [ - "decompress pubkey A into components X, Y", - "The 33 byte public key in a compressed form to be decompressed into X and Y (top) components. All values are big-endian encoded." - ], - "cost": { - "value": null, - "doc": "Secp256k1=650; Secp256r1=2400" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[33]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "V", - "immediate_type": "arg_enum", - "arg_enum": "ECDSA", - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "curve index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[32]byte", - "doc": null - }, - { - "name": "Y", - "stack_type": "[32]byte", - "doc": null - } - ] - }, - "ecdsa_pk_recover": { - "name": "ecdsa_pk_recover", - "size": 2, - "doc": [ - "for (data A, recovery id B, signature C, D) recover a public key", - "S (top) and R elements of a signature, recovery id and data (bottom) are expected on the stack and used to deriver a public key. All values are big-endian encoded. The signed data must be 32 bytes long." - ], - "cost": { - "value": 2000, - "doc": "2000" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[32]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - }, - { - "name": "C", - "stack_type": "[32]byte", - "doc": null - }, - { - "name": "D", - "stack_type": "[32]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "V", - "immediate_type": "arg_enum", - "arg_enum": "ECDSA", - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "curve index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[32]byte", - "doc": null - }, - { - "name": "Y", - "stack_type": "[32]byte", - "doc": null - } - ] - }, - "ecdsa_verify": { - "name": "ecdsa_verify", - "size": 2, - "doc": [ - "for (data A, signature B, C and pubkey D, E) verify the signature of the data against the pubkey => {0 or 1}", - "The 32 byte Y-component of a public key is the last element on the stack, preceded by X-component of a pubkey, preceded by S and R components of a signature, preceded by the data that is fifth element on the stack. All values are big-endian encoded. The signed data must be 32 bytes long, and signatures in lower-S form are only accepted." - ], - "cost": { - "value": null, - "doc": "Secp256k1=1700; Secp256r1=2500" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[32]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[32]byte", - "doc": null - }, - { - "name": "C", - "stack_type": "[32]byte", - "doc": null - }, - { - "name": "D", - "stack_type": "[32]byte", - "doc": null - }, - { - "name": "E", - "stack_type": "[32]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "V", - "immediate_type": "arg_enum", - "arg_enum": "ECDSA", - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "curve index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "ed25519verify": { - "name": "ed25519verify", - "size": 1, - "doc": [ - "for (data A, signature B, pubkey C) verify the signature of (\"ProgData\" || program_hash || data) against the pubkey => {0 or 1}", - "The 32 byte public key is the last element on the stack, preceded by the 64 byte signature at the second-to-last element on the stack, preceded by the data which was signed at the third-to-last element on the stack." - ], - "cost": { - "value": 1900, - "doc": "1900" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[64]byte", - "doc": null - }, - { - "name": "C", - "stack_type": "[32]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "ed25519verify_bare": { - "name": "ed25519verify_bare", - "size": 1, - "doc": [ - "for (data A, signature B, pubkey C) verify the signature of the data against the pubkey => {0 or 1}" - ], - "cost": { - "value": 1900, - "doc": "1900" - }, - "min_avm_version": 7, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[64]byte", - "doc": null - }, - { - "name": "C", - "stack_type": "[32]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "err": { - "name": "err", - "size": 1, - "doc": [ - "Fail immediately." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": true, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [] - }, - "exp": { - "name": "exp", - "size": 1, - "doc": [ - "A raised to the Bth power. Fail if A == B == 0 and on overflow" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "expw": { - "name": "expw", - "size": 1, - "doc": [ - "A raised to the Bth power as a 128-bit result in two uint64s. X is the high 64 bits, Y is the low. Fail if A == B == 0 or if the results exceeds 2^128-1" - ], - "cost": { - "value": 10, - "doc": "10" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - }, - { - "name": "Y", - "stack_type": "uint64", - "doc": null - } - ] - }, - "extract": { - "name": "extract", - "size": 3, - "doc": [ - "A range of bytes from A starting at S up to but not including S+L. If L is 0, then extract to the end of the string. If S or S+L is larger than the array length, the program fails" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "S", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "start position" - }, - { - "name": "L", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "length" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "extract3": { - "name": "extract3", - "size": 1, - "doc": [ - "A range of bytes from A starting at B up to but not including B+C. If B+C is larger than the array length, the program fails", - "`extract3` can be called using `extract` with no immediates." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - }, - { - "name": "C", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "extract_uint16": { - "name": "extract_uint16", - "size": 1, - "doc": [ - "A uint16 formed from a range of big-endian bytes from A starting at B up to but not including B+2. If B+2 is larger than the array length, the program fails" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "extract_uint32": { - "name": "extract_uint32", - "size": 1, - "doc": [ - "A uint32 formed from a range of big-endian bytes from A starting at B up to but not including B+4. If B+4 is larger than the array length, the program fails" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "extract_uint64": { - "name": "extract_uint64", - "size": 1, - "doc": [ - "A uint64 formed from a range of big-endian bytes from A starting at B up to but not including B+8. If B+8 is larger than the array length, the program fails" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "frame_bury": { - "name": "frame_bury", - "size": 2, - "doc": [ - "replace the Nth (signed) value from the frame pointer in the stack with A" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [ - { - "name": "I", - "immediate_type": "int8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "frame slot" - } - ], - "stack_outputs": [] - }, - "frame_dig": { - "name": "frame_dig", - "size": 2, - "doc": [ - "Nth (signed) value from the frame pointer." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "I", - "immediate_type": "int8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "frame slot" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "gaid": { - "name": "gaid", - "size": 2, - "doc": [ - "ID of the asset or application created in the Tth transaction of the current group", - "`gaid` fails unless the requested transaction created an asset or application and T < GroupIndex." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "app", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "T", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "transaction group index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "gaids": { - "name": "gaids", - "size": 1, - "doc": [ - "ID of the asset or application created in the Ath transaction of the current group", - "`gaids` fails unless the requested transaction created an asset or application and A < GroupIndex." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "app", - "groups": [ - "Loading Values" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "getbit": { - "name": "getbit", - "size": 1, - "doc": [ - "Bth bit of (byte-array or integer) A. If B is greater than or equal to the bit length of the value (8*byte length), the program fails", - "see explanation of bit ordering in setbit" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 3, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "getbyte": { - "name": "getbyte", - "size": 1, - "doc": [ - "Bth byte of A, as an integer. If B is greater than or equal to the array length, the program fails" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 3, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "gitxn": { - "name": "gitxn", - "size": 3, - "doc": [ - "field F of the Tth transaction in the last inner group submitted" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 6, - "halts": false, - "mode": "app", - "groups": [ - "Inner Transactions" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "T", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "transaction group index" - }, - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txn", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "gitxna": { - "name": "gitxna", - "size": 4, - "doc": [ - "Ith value of the array field F from the Tth transaction in the last inner group submitted" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 6, - "halts": false, - "mode": "app", - "groups": [ - "Inner Transactions" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "T", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "transaction group index" - }, - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txna", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - }, - { - "name": "I", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "transaction field array index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "gitxnas": { - "name": "gitxnas", - "size": 3, - "doc": [ - "Ath value of the array field F from the Tth transaction in the last inner group submitted" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 6, - "halts": false, - "mode": "app", - "groups": [ - "Inner Transactions" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [ - { - "name": "T", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "transaction group index" - }, - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txna", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "gload": { - "name": "gload", - "size": 3, - "doc": [ - "Ith scratch space value of the Tth transaction in the current group", - "`gload` fails unless the requested transaction is an ApplicationCall and T < GroupIndex." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "app", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "T", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "transaction group index" - }, - { - "name": "I", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "position in scratch space to load from" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "gloads": { - "name": "gloads", - "size": 2, - "doc": [ - "Ith scratch space value of the Ath transaction in the current group", - "`gloads` fails unless the requested transaction is an ApplicationCall and A < GroupIndex." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "app", - "groups": [ - "Loading Values" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [ - { - "name": "I", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "position in scratch space to load from" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "gloadss": { - "name": "gloadss", - "size": 1, - "doc": [ - "Bth scratch space value of the Ath transaction in the current group" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 6, - "halts": false, - "mode": "app", - "groups": [ - "Loading Values" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "global": { - "name": "global", - "size": 2, - "doc": [ - "global field F" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "global", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "a global field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "gtxn": { - "name": "gtxn", - "size": 3, - "doc": [ - "field F of the Tth transaction in the current group", - "for notes on transaction fields available, see `txn`. If this transaction is _i_ in the group, `gtxn i field` is equivalent to `txn field`." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "T", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "transaction group index" - }, - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txn", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "gtxna": { - "name": "gtxna", - "size": 4, - "doc": [ - "Ith value of the array field F from the Tth transaction in the current group", - "`gtxna` can be called using `gtxn` with 3 immediates." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "T", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "transaction group index" - }, - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txna", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - }, - { - "name": "I", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "transaction field array index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "gtxnas": { - "name": "gtxnas", - "size": 3, - "doc": [ - "Ath value of the array field F from the Tth transaction in the current group" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [ - { - "name": "T", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "transaction group index" - }, - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txna", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "gtxns": { - "name": "gtxns", - "size": 2, - "doc": [ - "field F of the Ath transaction in the current group", - "for notes on transaction fields available, see `txn`. If top of stack is _i_, `gtxns field` is equivalent to `gtxn _i_ field`. gtxns exists so that _i_ can be calculated, often based on the index of the current transaction." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 3, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txn", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "gtxnsa": { - "name": "gtxnsa", - "size": 3, - "doc": [ - "Ith value of the array field F from the Ath transaction in the current group", - "`gtxnsa` can be called using `gtxns` with 2 immediates." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 3, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txna", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - }, - { - "name": "I", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "transaction field array index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "gtxnsas": { - "name": "gtxnsas", - "size": 2, - "doc": [ - "Bth value of the array field F from the Ath transaction in the current group" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txna", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "intc": { - "name": "intc", - "size": 2, - "doc": [ - "Ith constant from intcblock" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "I", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "an index in the intcblock" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "intc_0": { - "name": "intc_0", - "size": 1, - "doc": [ - "constant 0 from intcblock" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "intc_1": { - "name": "intc_1", - "size": 1, - "doc": [ - "constant 1 from intcblock" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "intc_2": { - "name": "intc_2", - "size": 1, - "doc": [ - "constant 2 from intcblock" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "intc_3": { - "name": "intc_3", - "size": 1, - "doc": [ - "constant 3 from intcblock" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "intcblock": { - "name": "intcblock", - "size": 0, - "doc": [ - "prepare block of uint64 constants for use by intc", - "`intcblock` loads following program bytes into an array of integer constants in the evaluator. These integer constants can be referred to by `intc` and `intc_*` which will push the value onto the stack. Subsequent calls to `intcblock` reset and replace the integer constants available to the script." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "UINT ...", - "immediate_type": "uint64_array", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "a block of int constant values" - } - ], - "stack_outputs": [] - }, - "itob": { - "name": "itob", - "size": 1, - "doc": [ - "converts uint64 A to big-endian byte array, always of length 8" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[8]byte", - "doc": null - } - ] - }, - "itxn": { - "name": "itxn", - "size": 2, - "doc": [ - "field F of the last inner transaction" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "app", - "groups": [ - "Inner Transactions" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txn", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "itxn_begin": { - "name": "itxn_begin", - "size": 1, - "doc": [ - "begin preparation of a new inner transaction in a new transaction group", - "`itxn_begin` initializes Sender to the application address; Fee to the minimum allowable, taking into account MinTxnFee and credit from overpaying in earlier transactions; FirstValid/LastValid to the values in the invoking transaction, and all other fields to zero or empty values." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "app", - "groups": [ - "Inner Transactions" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [] - }, - "itxn_field": { - "name": "itxn_field", - "size": 2, - "doc": [ - "set field F of the current inner transaction to A", - "`itxn_field` fails if A is of the wrong type for F, including a byte array of the wrong size for use as an address when F is an address field. `itxn_field` also fails if A is an account, asset, or app that is not _available_, or an attempt is made extend an array field beyond the limit imposed by consensus parameters. (Addresses set into asset params of acfg transactions need not be _available_.)" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "app", - "groups": [ - "Inner Transactions" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "itxn_field", - "modifies_stack_input": 0, - "modifies_stack_output": null, - "doc": "transaction field index" - } - ], - "stack_outputs": [] - }, - "itxn_next": { - "name": "itxn_next", - "size": 1, - "doc": [ - "begin preparation of a new inner transaction in the same transaction group", - "`itxn_next` initializes the transaction exactly as `itxn_begin` does" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 6, - "halts": false, - "mode": "app", - "groups": [ - "Inner Transactions" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [] - }, - "itxn_submit": { - "name": "itxn_submit", - "size": 1, - "doc": [ - "execute the current inner transaction group. Fail if executing this group would exceed the inner transaction limit, or if any transaction in the group fails.", - "`itxn_submit` resets the current transaction so that it can not be resubmitted. A new `itxn_begin` is required to prepare another inner transaction." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "app", - "groups": [ - "Inner Transactions" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [] - }, - "itxna": { - "name": "itxna", - "size": 3, - "doc": [ - "Ith value of the array field F of the last inner transaction" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "app", - "groups": [ - "Inner Transactions" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txna", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - }, - { - "name": "I", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "a transaction field array index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "itxnas": { - "name": "itxnas", - "size": 2, - "doc": [ - "Ath value of the array field F of the last inner transaction" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 6, - "halts": false, - "mode": "app", - "groups": [ - "Inner Transactions" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txna", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "json_ref": { - "name": "json_ref", - "size": 2, - "doc": [ - "key B's value, of type R, from a [valid](jsonspec.md) utf-8 encoded json object A", - "*Warning*: Usage should be restricted to very rare use cases, as JSON decoding is expensive and quite limited. In addition, JSON objects are large and not optimized for size.", - "", - "Almost all smart contracts should use simpler and smaller methods (such as the [ABI](https://arc.algorand.foundation/ARCs/arc-0004). This opcode should only be used in cases where JSON is only available option, e.g. when a third-party only signs JSON." - ], - "cost": { - "value": null, - "doc": "25 + 2 per 7 bytes of A" - }, - "min_avm_version": 7, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "R", - "immediate_type": "arg_enum", - "arg_enum": "json_ref", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "return type index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "keccak256": { - "name": "keccak256", - "size": 1, - "doc": [ - "Keccak256 hash of value A, yields [32]byte" - ], - "cost": { - "value": 130, - "doc": "130" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[32]byte", - "doc": null - } - ] - }, - "len": { - "name": "len", - "size": 1, - "doc": [ - "yields length of byte value A" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "load": { - "name": "load", - "size": 2, - "doc": [ - "Ith scratch space value. All scratch spaces are 0 at program start." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "I", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "position in scratch space to load from" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "loads": { - "name": "loads", - "size": 1, - "doc": [ - "Ath scratch space value. All scratch spaces are 0 at program start." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "log": { - "name": "log", - "size": 1, - "doc": [ - "write A to log state of the current application", - "`log` fails if called more than MaxLogCalls times in a program, or if the sum of logged bytes exceeds 1024 bytes." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [] - }, - "match": { - "name": "match", - "size": 0, - "doc": [ - "given match cases from A[1] to A[N], branch to the Ith label where A[I] = B. Continue to the following instruction if no matches are found.", - "`match` consumes N+1 values from the stack. Let the top stack value be B. The following N values represent an ordered list of match cases/constants (A), where the first value (A[0]) is the deepest in the stack. The immediate arguments are an ordered list of N labels (T). `match` will branch to target T[I], where A[I] = B. If there are no matches then execution continues on to the next instruction." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "TARGET ...", - "immediate_type": "label_array", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "list of labels" - } - ], - "stack_outputs": [] - }, - "min_balance": { - "name": "min_balance", - "size": 1, - "doc": [ - "minimum required balance for account A, in microalgos. Required balance is affected by ASA, App, and Box 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. Changes caused by inner transactions or box usage are observable immediately following the opcode effecting the change.", - "params: Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset). Return: value." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 3, - "halts": false, - "mode": "app", - "groups": [ - "State Access" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "address_or_index", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "mulw": { - "name": "mulw", - "size": 1, - "doc": [ - "A times B as a 128-bit result in two uint64s. X is the high 64 bits, Y is the low" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - }, - { - "name": "Y", - "stack_type": "uint64", - "doc": null - } - ] - }, - "pop": { - "name": "pop", - "size": 1, - "doc": [ - "discard A" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [] - }, - "popn": { - "name": "popn", - "size": 2, - "doc": [ - "remove N values from the top of the stack" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "N", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "stack depth" - } - ], - "stack_outputs": [] - }, - "proto": { - "name": "proto", - "size": 3, - "doc": [ - "Prepare top call frame for a retsub that will assume A args and R return values.", - "Fails unless the last instruction executed was a `callsub`." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "A", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "number of arguments" - }, - { - "name": "R", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "number of return values" - } - ], - "stack_outputs": [] - }, - "pushbytes": { - "name": "pushbytes", - "size": 0, - "doc": [ - "immediate BYTES", - "pushbytes args are not added to the bytecblock during assembly processes" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 3, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "BYTES", - "immediate_type": "bytes", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "a byte constant" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "pushbytess": { - "name": "pushbytess", - "size": 0, - "doc": [ - "push sequences of immediate byte arrays to stack (first byte array being deepest)", - "pushbytess args are not added to the bytecblock during assembly processes" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "BYTES ...", - "immediate_type": "bytes_array", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "a list of byte constants" - } - ], - "stack_outputs": [] - }, - "pushint": { - "name": "pushint", - "size": 0, - "doc": [ - "immediate UINT", - "pushint args are not added to the intcblock during assembly processes" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 3, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "UINT", - "immediate_type": "uint64", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "an int constant" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "pushints": { - "name": "pushints", - "size": 0, - "doc": [ - "push sequence of immediate uints to stack in the order they appear (first uint being deepest)", - "pushints args are not added to the intcblock during assembly processes" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "UINT ...", - "immediate_type": "uint64_array", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "a list of int constants" - } - ], - "stack_outputs": [] - }, - "replace2": { - "name": "replace2", - "size": 2, - "doc": [ - "Copy of A with the bytes starting at S replaced by the bytes of B. Fails if S+len(B) exceeds len(A)", - "`replace2` can be called using `replace` with 1 immediate." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 7, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "S", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "start position" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "replace3": { - "name": "replace3", - "size": 1, - "doc": [ - "Copy of A with the bytes starting at B replaced by the bytes of C. Fails if B+len(C) exceeds len(A)", - "`replace3` can be called using `replace` with no immediates." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 7, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - }, - { - "name": "C", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "retsub": { - "name": "retsub", - "size": 1, - "doc": [ - "pop the top instruction from the call stack and branch to it", - "If the current frame was prepared by `proto A R`, `retsub` will remove the 'A' arguments from the stack, move the `R` return values down, and pop any stack locations above the relocated return values." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [], - "immediate_args": [], - "stack_outputs": [] - }, - "return": { - "name": "return", - "size": 1, - "doc": [ - "use A as success value; end" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": true, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [] - }, - "select": { - "name": "select", - "size": 1, - "doc": [ - "selects one of two values based on top-of-stack: B if C != 0, else A" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 3, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - }, - { - "name": "B", - "stack_type": "any", - "doc": null - }, - { - "name": "C", - "stack_type": "bool", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "setbit": { - "name": "setbit", - "size": 1, - "doc": [ - "Copy of (byte-array or integer) A, with the Bth bit set to (0 or 1) C. If B is greater than or equal to the bit length of the value (8*byte length), the program fails", - "When A is a uint64, index 0 is the least significant bit. Setting bit 3 to 1 on the integer 0 yields 8, or 2^3. When A is a byte array, index 0 is the leftmost bit of the leftmost byte. Setting bits 0 through 11 to 1 in a 4-byte-array of 0s yields the byte array 0xfff00000. Setting bit 3 to 1 on the 1-byte-array 0x00 yields the byte array 0x10." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 3, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - }, - { - "name": "C", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "setbyte": { - "name": "setbyte", - "size": 1, - "doc": [ - "Copy of A with the Bth byte set to small integer (between 0..255) C. If B is greater than or equal to the array length, the program fails" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 3, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - }, - { - "name": "C", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "sha256": { - "name": "sha256", - "size": 1, - "doc": [ - "SHA256 hash of value A, yields [32]byte" - ], - "cost": { - "value": 35, - "doc": "35" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[32]byte", - "doc": null - } - ] - }, - "sha3_256": { - "name": "sha3_256", - "size": 1, - "doc": [ - "SHA3_256 hash of value A, yields [32]byte" - ], - "cost": { - "value": 130, - "doc": "130" - }, - "min_avm_version": 7, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[32]byte", - "doc": null - } - ] - }, - "sha512_256": { - "name": "sha512_256", - "size": 1, - "doc": [ - "SHA512_256 hash of value A, yields [32]byte" - ], - "cost": { - "value": 45, - "doc": "45" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[32]byte", - "doc": null - } - ] - }, - "shl": { - "name": "shl", - "size": 1, - "doc": [ - "A times 2^B, modulo 2^64" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "shr": { - "name": "shr", - "size": 1, - "doc": [ - "A divided by 2^B" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "sqrt": { - "name": "sqrt", - "size": 1, - "doc": [ - "The largest integer I such that I^2 <= A" - ], - "cost": { - "value": 4, - "doc": "4" - }, - "min_avm_version": 4, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "store": { - "name": "store", - "size": 2, - "doc": [ - "store A to the Ith scratch space" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [ - { - "name": "I", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "position in scratch space to store to" - } - ], - "stack_outputs": [] - }, - "stores": { - "name": "stores", - "size": 1, - "doc": [ - "store B to the Ath scratch space" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [] - }, - "substring": { - "name": "substring", - "size": 3, - "doc": [ - "A range of bytes from A starting at S up to but not including E. If E < S, or either is larger than the array length, the program fails" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "S", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "start position" - }, - { - "name": "E", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "end position" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "substring3": { - "name": "substring3", - "size": 1, - "doc": [ - "A range of bytes from A starting at B up to but not including C. If C < B, or either is larger than the array length, the program fails" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "any", - "groups": [ - "Byte Array Manipulation" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - }, - { - "name": "C", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[]byte", - "doc": null - } - ] - }, - "swap": { - "name": "swap", - "size": 1, - "doc": [ - "swaps A and B on stack" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 3, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - }, - { - "name": "B", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - }, - { - "name": "Y", - "stack_type": "any", - "doc": null - } - ] - }, - "switch": { - "name": "switch", - "size": 0, - "doc": [ - "branch to the Ath label. Continue at following instruction if index A exceeds the number of labels." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 8, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [ - { - "name": "TARGET ...", - "immediate_type": "label_array", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "list of labels" - } - ], - "stack_outputs": [] - }, - "txn": { - "name": "txn", - "size": 2, - "doc": [ - "field F of current transaction" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txn", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "txna": { - "name": "txna", - "size": 3, - "doc": [ - "Ith value of the array field F of the current transaction", - "`txna` can be called using `txn` with 2 immediates." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 2, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txna", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - }, - { - "name": "I", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "transaction field array index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "txnas": { - "name": "txnas", - "size": 2, - "doc": [ - "Ath value of the array field F of the current transaction" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Loading Values" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [ - { - "name": "F", - "immediate_type": "arg_enum", - "arg_enum": "txna", - "modifies_stack_input": null, - "modifies_stack_output": 0, - "doc": "transaction field index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "uncover": { - "name": "uncover", - "size": 2, - "doc": [ - "remove the value at depth N in the stack and shift above items down so the Nth deep value is on top of the stack. Fails if stack depth <= N." - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 5, - "halts": false, - "mode": "any", - "groups": [ - "Flow Control" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "any", - "doc": null - } - ], - "immediate_args": [ - { - "name": "N", - "immediate_type": "uint8", - "arg_enum": null, - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": "depth" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "any", - "doc": null - } - ] - }, - "vrf_verify": { - "name": "vrf_verify", - "size": 2, - "doc": [ - "Verify the proof B of message A against pubkey C. Returns vrf output and verification flag.", - "`VrfAlgorand` is the VRF used in Algorand. It is ECVRF-ED25519-SHA512-Elligator2, specified in the IETF internet draft [draft-irtf-cfrg-vrf-03](https://datatracker.ietf.org/doc/draft-irtf-cfrg-vrf/03/)." - ], - "cost": { - "value": 5700, - "doc": "5700" - }, - "min_avm_version": 7, - "halts": false, - "mode": "any", - "groups": [ - "Cryptography" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "[]byte", - "doc": null - }, - { - "name": "B", - "stack_type": "[80]byte", - "doc": null - }, - { - "name": "C", - "stack_type": "[32]byte", - "doc": null - } - ], - "immediate_args": [ - { - "name": "S", - "immediate_type": "arg_enum", - "arg_enum": "vrf_verify", - "modifies_stack_input": null, - "modifies_stack_output": null, - "doc": " parameters index" - } - ], - "stack_outputs": [ - { - "name": "X", - "stack_type": "[64]byte", - "doc": null - }, - { - "name": "Y", - "stack_type": "bool", - "doc": null - } - ] - }, - "|": { - "name": "|", - "size": 1, - "doc": [ - "A bitwise-or B" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - }, - "||": { - "name": "||", - "size": 1, - "doc": [ - "A is not zero or B is not zero => {0 or 1}" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - }, - { - "name": "B", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "bool", - "doc": null - } - ] - }, - "~": { - "name": "~", - "size": 1, - "doc": [ - "bitwise invert value A" - ], - "cost": { - "value": 1, - "doc": "1" - }, - "min_avm_version": 1, - "halts": false, - "mode": "any", - "groups": [ - "Arithmetic" - ], - "stack_inputs": [ - { - "name": "A", - "stack_type": "uint64", - "doc": null - } - ], - "immediate_args": [], - "stack_outputs": [ - { - "name": "X", - "stack_type": "uint64", - "doc": null - } - ] - } - }, - "arg_enums": { - "acct_params": [ - { - "name": "AcctBalance", - "doc": "Account balance in microalgos", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AcctMinBalance", - "doc": "Minimum required balance for account, in microalgos", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AcctAuthAddr", - "doc": "Address the account is rekeyed to.", - "stack_type": "address", - "mode": "app" - }, - { - "name": "AcctTotalNumUint", - "doc": "The total number of uint64 values allocated by this account in Global and Local States.", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AcctTotalNumByteSlice", - "doc": "The total number of byte array values allocated by this account in Global and Local States.", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AcctTotalExtraAppPages", - "doc": "The number of extra app code pages used by this account.", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AcctTotalAppsCreated", - "doc": "The number of existing apps created by this account.", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AcctTotalAppsOptedIn", - "doc": "The number of apps this account is opted into.", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AcctTotalAssetsCreated", - "doc": "The number of existing ASAs created by this account.", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AcctTotalAssets", - "doc": "The numbers of ASAs held by this account (including ASAs this account created).", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AcctTotalBoxes", - "doc": "The number of existing boxes created by this account's app.", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AcctTotalBoxBytes", - "doc": "The total number of bytes used by this account's app's box keys and values.", - "stack_type": "uint64", - "mode": "app" - } - ], - "app_params": [ - { - "name": "AppApprovalProgram", - "doc": "Bytecode of Approval Program", - "stack_type": "[]byte", - "mode": "app" - }, - { - "name": "AppClearStateProgram", - "doc": "Bytecode of Clear State Program", - "stack_type": "[]byte", - "mode": "app" - }, - { - "name": "AppGlobalNumUint", - "doc": "Number of uint64 values allowed in Global State", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AppGlobalNumByteSlice", - "doc": "Number of byte array values allowed in Global State", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AppLocalNumUint", - "doc": "Number of uint64 values allowed in Local State", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AppLocalNumByteSlice", - "doc": "Number of byte array values allowed in Local State", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AppExtraProgramPages", - "doc": "Number of Extra Program Pages of code space", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AppCreator", - "doc": "Creator address", - "stack_type": "address", - "mode": "app" - }, - { - "name": "AppAddress", - "doc": "Address for which this application has authority", - "stack_type": "address", - "mode": "app" - } - ], - "asset_holding": [ - { - "name": "AssetBalance", - "doc": "Amount of the asset unit held by this account", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AssetFrozen", - "doc": "Is the asset frozen or not", - "stack_type": "bool", - "mode": "app" - } - ], - "asset_params": [ - { - "name": "AssetTotal", - "doc": "Total number of units of this asset", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AssetDecimals", - "doc": "See AssetParams.Decimals", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "AssetDefaultFrozen", - "doc": "Frozen by default or not", - "stack_type": "bool", - "mode": "app" - }, - { - "name": "AssetUnitName", - "doc": "Asset unit name", - "stack_type": "[]byte", - "mode": "app" - }, - { - "name": "AssetName", - "doc": "Asset name", - "stack_type": "[]byte", - "mode": "app" - }, - { - "name": "AssetURL", - "doc": "URL with additional info about the asset", - "stack_type": "[]byte", - "mode": "app" - }, - { - "name": "AssetMetadataHash", - "doc": "Arbitrary commitment", - "stack_type": "[32]byte", - "mode": "app" - }, - { - "name": "AssetManager", - "doc": "Manager address", - "stack_type": "address", - "mode": "app" - }, - { - "name": "AssetReserve", - "doc": "Reserve address", - "stack_type": "address", - "mode": "app" - }, - { - "name": "AssetFreeze", - "doc": "Freeze address", - "stack_type": "address", - "mode": "app" - }, - { - "name": "AssetClawback", - "doc": "Clawback address", - "stack_type": "address", - "mode": "app" - }, - { - "name": "AssetCreator", - "doc": "Creator address", - "stack_type": "address", - "mode": "app" - } - ], - "base64": [ - { - "name": "URLEncoding", - "doc": null, - "stack_type": null, - "mode": "any" - }, - { - "name": "StdEncoding", - "doc": null, - "stack_type": null, - "mode": "any" - } - ], - "block": [ - { - "name": "BlkSeed", - "doc": null, - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "BlkTimestamp", - "doc": null, - "stack_type": "uint64", - "mode": "any" - } - ], - "EC": [ - { - "name": "BN254g1", - "doc": "G1 of the BN254 curve. Points encoded as 32 byte X following by 32 byte Y", - "stack_type": null, - "mode": "any" - }, - { - "name": "BN254g2", - "doc": "G2 of the BN254 curve. Points encoded as 64 byte X following by 64 byte Y", - "stack_type": null, - "mode": "any" - }, - { - "name": "BLS12_381g1", - "doc": "G1 of the BLS 12-381 curve. Points encoded as 48 byte X following by 48 byte Y", - "stack_type": null, - "mode": "any" - }, - { - "name": "BLS12_381g2", - "doc": "G2 of the BLS 12-381 curve. Points encoded as 96 byte X following by 96 byte Y", - "stack_type": null, - "mode": "any" - } - ], - "ECDSA": [ - { - "name": "Secp256k1", - "doc": "secp256k1 curve, used in Bitcoin", - "stack_type": null, - "mode": "any" - }, - { - "name": "Secp256r1", - "doc": "secp256r1 curve, NIST standard", - "stack_type": null, - "mode": "any" - } - ], - "txn": [ - { - "name": "Sender", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "Fee", - "doc": "microalgos", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "FirstValid", - "doc": "round number", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "FirstValidTime", - "doc": "UNIX timestamp of block before txn.FirstValid. Fails if negative", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "LastValid", - "doc": "round number", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "Note", - "doc": "Any data up to 1024 bytes", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "Lease", - "doc": "32 byte lease value", - "stack_type": "[32]byte", - "mode": "any" - }, - { - "name": "Receiver", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "Amount", - "doc": "microalgos", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "CloseRemainderTo", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "VotePK", - "doc": "32 byte address", - "stack_type": "[32]byte", - "mode": "any" - }, - { - "name": "SelectionPK", - "doc": "32 byte address", - "stack_type": "[32]byte", - "mode": "any" - }, - { - "name": "VoteFirst", - "doc": "The first round that the participation key is valid.", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "VoteLast", - "doc": "The last round that the participation key is valid.", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "VoteKeyDilution", - "doc": "Dilution for the 2-level participation key", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "Type", - "doc": "Transaction type as bytes", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "TypeEnum", - "doc": "Transaction type as integer", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "XferAsset", - "doc": "Asset ID", - "stack_type": "asset", - "mode": "any" - }, - { - "name": "AssetAmount", - "doc": "value in Asset's units", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "AssetSender", - "doc": "32 byte address. Source of assets if Sender is the Asset's Clawback address.", - "stack_type": "address", - "mode": "any" - }, - { - "name": "AssetReceiver", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "AssetCloseTo", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "GroupIndex", - "doc": "Position of this transaction within an atomic transaction group. A stand-alone transaction is implicitly element 0 in a group of 1", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "TxID", - "doc": "The computed ID for this transaction. 32 bytes.", - "stack_type": "[32]byte", - "mode": "any" - }, - { - "name": "ApplicationID", - "doc": "ApplicationID from ApplicationCall transaction", - "stack_type": "application", - "mode": "any" - }, - { - "name": "OnCompletion", - "doc": "ApplicationCall transaction on completion action", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "ApplicationArgs", - "doc": "Arguments passed to the application in the ApplicationCall transaction", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "NumAppArgs", - "doc": "Number of ApplicationArgs", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "Accounts", - "doc": "Accounts listed in the ApplicationCall transaction", - "stack_type": "address", - "mode": "any" - }, - { - "name": "NumAccounts", - "doc": "Number of Accounts", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "ApprovalProgram", - "doc": "Approval program", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "ClearStateProgram", - "doc": "Clear state program", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "RekeyTo", - "doc": "32 byte Sender's new AuthAddr", - "stack_type": "address", - "mode": "any" - }, - { - "name": "ConfigAsset", - "doc": "Asset ID in asset config transaction", - "stack_type": "asset", - "mode": "any" - }, - { - "name": "ConfigAssetTotal", - "doc": "Total number of units of this asset created", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "ConfigAssetDecimals", - "doc": "Number of digits to display after the decimal place when displaying the asset", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "ConfigAssetDefaultFrozen", - "doc": "Whether the asset's slots are frozen by default or not, 0 or 1", - "stack_type": "bool", - "mode": "any" - }, - { - "name": "ConfigAssetUnitName", - "doc": "Unit name of the asset", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "ConfigAssetName", - "doc": "The asset name", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "ConfigAssetURL", - "doc": "URL", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "ConfigAssetMetadataHash", - "doc": "32 byte commitment to unspecified asset metadata", - "stack_type": "[32]byte", - "mode": "any" - }, - { - "name": "ConfigAssetManager", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "ConfigAssetReserve", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "ConfigAssetFreeze", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "ConfigAssetClawback", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "FreezeAsset", - "doc": "Asset ID being frozen or un-frozen", - "stack_type": "asset", - "mode": "any" - }, - { - "name": "FreezeAssetAccount", - "doc": "32 byte address of the account whose asset slot is being frozen or un-frozen", - "stack_type": "address", - "mode": "any" - }, - { - "name": "FreezeAssetFrozen", - "doc": "The new frozen value, 0 or 1", - "stack_type": "bool", - "mode": "any" - }, - { - "name": "Assets", - "doc": "Foreign Assets listed in the ApplicationCall transaction", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "NumAssets", - "doc": "Number of Assets", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "Applications", - "doc": "Foreign Apps listed in the ApplicationCall transaction", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "NumApplications", - "doc": "Number of Applications", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "GlobalNumUint", - "doc": "Number of global state integers in ApplicationCall", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "GlobalNumByteSlice", - "doc": "Number of global state byteslices in ApplicationCall", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "LocalNumUint", - "doc": "Number of local state integers in ApplicationCall", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "LocalNumByteSlice", - "doc": "Number of local state byteslices in ApplicationCall", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "ExtraProgramPages", - "doc": "Number of additional pages for each of the application's approval and clear state programs. An ExtraProgramPages of 1 means 2048 more total bytes, or 1024 for each program.", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "Nonparticipation", - "doc": "Marks an account nonparticipating for rewards", - "stack_type": "bool", - "mode": "any" - }, - { - "name": "Logs", - "doc": "Log messages emitted by an application call (only with `itxn` in v5). Application mode only", - "stack_type": "[]byte", - "mode": "app" - }, - { - "name": "NumLogs", - "doc": "Number of Logs (only with `itxn` in v5). Application mode only", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "CreatedAssetID", - "doc": "Asset ID allocated by the creation of an ASA (only with `itxn` in v5). Application mode only", - "stack_type": "asset", - "mode": "app" - }, - { - "name": "CreatedApplicationID", - "doc": "ApplicationID allocated by the creation of an application (only with `itxn` in v5). Application mode only", - "stack_type": "application", - "mode": "app" - }, - { - "name": "LastLog", - "doc": "The last message emitted. Empty bytes if none were emitted. Application mode only", - "stack_type": "[]byte", - "mode": "app" - }, - { - "name": "StateProofPK", - "doc": "64 byte state proof public key", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "ApprovalProgramPages", - "doc": "Approval Program as an array of pages", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "NumApprovalProgramPages", - "doc": "Number of Approval Program pages", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "ClearStateProgramPages", - "doc": "ClearState Program as an array of pages", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "NumClearStateProgramPages", - "doc": "Number of ClearState Program pages", - "stack_type": "uint64", - "mode": "any" - } - ], - "txna": [ - { - "name": "ApplicationArgs", - "doc": "Arguments passed to the application in the ApplicationCall transaction", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "Accounts", - "doc": "Accounts listed in the ApplicationCall transaction", - "stack_type": "address", - "mode": "any" - }, - { - "name": "Assets", - "doc": "Foreign Assets listed in the ApplicationCall transaction", - "stack_type": "asset", - "mode": "any" - }, - { - "name": "Applications", - "doc": "Foreign Apps listed in the ApplicationCall transaction", - "stack_type": "application", - "mode": "any" - }, - { - "name": "Logs", - "doc": "Log messages emitted by an application call (only with `itxn` in v5). Application mode only", - "stack_type": "[]byte", - "mode": "app" - }, - { - "name": "ApprovalProgramPages", - "doc": "Approval Program as an array of pages", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "ClearStateProgramPages", - "doc": "ClearState Program as an array of pages", - "stack_type": "[]byte", - "mode": "any" - } - ], - "global": [ - { - "name": "MinTxnFee", - "doc": "microalgos", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "MinBalance", - "doc": "microalgos", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "MaxTxnLife", - "doc": "rounds", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "ZeroAddress", - "doc": "32 byte address of all zero bytes", - "stack_type": "address", - "mode": "any" - }, - { - "name": "GroupSize", - "doc": "Number of transactions in this atomic transaction group. At least 1", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "LogicSigVersion", - "doc": "Maximum supported version", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "Round", - "doc": "Current round number. Application mode only.", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "LatestTimestamp", - "doc": "Last confirmed block UNIX timestamp. Fails if negative. Application mode only.", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "CurrentApplicationID", - "doc": "ID of current application executing. Application mode only.", - "stack_type": "application", - "mode": "app" - }, - { - "name": "CreatorAddress", - "doc": "Address of the creator of the current application. Application mode only.", - "stack_type": "address", - "mode": "app" - }, - { - "name": "CurrentApplicationAddress", - "doc": "Address that the current application controls. Application mode only.", - "stack_type": "address", - "mode": "app" - }, - { - "name": "GroupID", - "doc": "ID of the transaction group. 32 zero bytes if the transaction is not part of a group.", - "stack_type": "[32]byte", - "mode": "any" - }, - { - "name": "OpcodeBudget", - "doc": "The remaining cost that can be spent by opcodes in this program.", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "CallerApplicationID", - "doc": "The application ID of the application that called this application. 0 if this application is at the top-level. Application mode only.", - "stack_type": "uint64", - "mode": "app" - }, - { - "name": "CallerApplicationAddress", - "doc": "The application address of the application that called this application. ZeroAddress if this application is at the top-level. Application mode only.", - "stack_type": "address", - "mode": "app" - }, - { - "name": "AssetCreateMinBalance", - "doc": "The additional minimum balance required to create (and opt-in to) an asset.", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "AssetOptInMinBalance", - "doc": "The additional minimum balance required to opt-in to an asset.", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "GenesisHash", - "doc": "The Genesis Hash for the network.", - "stack_type": "[32]byte", - "mode": "any" - } - ], - "itxn_field": [ - { - "name": "Sender", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "Fee", - "doc": "microalgos", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "Note", - "doc": "Any data up to 1024 bytes", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "Receiver", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "Amount", - "doc": "microalgos", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "CloseRemainderTo", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "VotePK", - "doc": "32 byte address", - "stack_type": "[32]byte", - "mode": "any" - }, - { - "name": "SelectionPK", - "doc": "32 byte address", - "stack_type": "[32]byte", - "mode": "any" - }, - { - "name": "VoteFirst", - "doc": "The first round that the participation key is valid.", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "VoteLast", - "doc": "The last round that the participation key is valid.", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "VoteKeyDilution", - "doc": "Dilution for the 2-level participation key", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "Type", - "doc": "Transaction type as bytes", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "TypeEnum", - "doc": "Transaction type as integer", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "XferAsset", - "doc": "Asset ID", - "stack_type": "asset", - "mode": "any" - }, - { - "name": "AssetAmount", - "doc": "value in Asset's units", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "AssetSender", - "doc": "32 byte address. Source of assets if Sender is the Asset's Clawback address.", - "stack_type": "address", - "mode": "any" - }, - { - "name": "AssetReceiver", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "AssetCloseTo", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "ApplicationID", - "doc": "ApplicationID from ApplicationCall transaction", - "stack_type": "application", - "mode": "any" - }, - { - "name": "OnCompletion", - "doc": "ApplicationCall transaction on completion action", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "ApplicationArgs", - "doc": "Arguments passed to the application in the ApplicationCall transaction", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "Accounts", - "doc": "Accounts listed in the ApplicationCall transaction", - "stack_type": "address", - "mode": "any" - }, - { - "name": "ApprovalProgram", - "doc": "Approval program", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "ClearStateProgram", - "doc": "Clear state program", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "RekeyTo", - "doc": "32 byte Sender's new AuthAddr", - "stack_type": "address", - "mode": "any" - }, - { - "name": "ConfigAsset", - "doc": "Asset ID in asset config transaction", - "stack_type": "asset", - "mode": "any" - }, - { - "name": "ConfigAssetTotal", - "doc": "Total number of units of this asset created", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "ConfigAssetDecimals", - "doc": "Number of digits to display after the decimal place when displaying the asset", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "ConfigAssetDefaultFrozen", - "doc": "Whether the asset's slots are frozen by default or not, 0 or 1", - "stack_type": "bool", - "mode": "any" - }, - { - "name": "ConfigAssetUnitName", - "doc": "Unit name of the asset", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "ConfigAssetName", - "doc": "The asset name", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "ConfigAssetURL", - "doc": "URL", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "ConfigAssetMetadataHash", - "doc": "32 byte commitment to unspecified asset metadata", - "stack_type": "[32]byte", - "mode": "any" - }, - { - "name": "ConfigAssetManager", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "ConfigAssetReserve", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "ConfigAssetFreeze", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "ConfigAssetClawback", - "doc": "32 byte address", - "stack_type": "address", - "mode": "any" - }, - { - "name": "FreezeAsset", - "doc": "Asset ID being frozen or un-frozen", - "stack_type": "asset", - "mode": "any" - }, - { - "name": "FreezeAssetAccount", - "doc": "32 byte address of the account whose asset slot is being frozen or un-frozen", - "stack_type": "address", - "mode": "any" - }, - { - "name": "FreezeAssetFrozen", - "doc": "The new frozen value, 0 or 1", - "stack_type": "bool", - "mode": "any" - }, - { - "name": "Assets", - "doc": "Foreign Assets listed in the ApplicationCall transaction", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "Applications", - "doc": "Foreign Apps listed in the ApplicationCall transaction", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "GlobalNumUint", - "doc": "Number of global state integers in ApplicationCall", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "GlobalNumByteSlice", - "doc": "Number of global state byteslices in ApplicationCall", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "LocalNumUint", - "doc": "Number of local state integers in ApplicationCall", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "LocalNumByteSlice", - "doc": "Number of local state byteslices in ApplicationCall", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "ExtraProgramPages", - "doc": "Number of additional pages for each of the application's approval and clear state programs. An ExtraProgramPages of 1 means 2048 more total bytes, or 1024 for each program.", - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "Nonparticipation", - "doc": "Marks an account nonparticipating for rewards", - "stack_type": "bool", - "mode": "any" - }, - { - "name": "StateProofPK", - "doc": "64 byte state proof public key", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "ApprovalProgramPages", - "doc": "Approval Program as an array of pages", - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "ClearStateProgramPages", - "doc": "ClearState Program as an array of pages", - "stack_type": "[]byte", - "mode": "any" - } - ], - "json_ref": [ - { - "name": "JSONString", - "doc": null, - "stack_type": "[]byte", - "mode": "any" - }, - { - "name": "JSONUint64", - "doc": null, - "stack_type": "uint64", - "mode": "any" - }, - { - "name": "JSONObject", - "doc": null, - "stack_type": "[]byte", - "mode": "any" - } - ], - "vrf_verify": [ - { - "name": "VrfAlgorand", - "doc": null, - "stack_type": null, - "mode": "any" - } - ] + "ops": { + "!": { + "name": "!", + "code": 20, + "size": 1, + "doc": ["A == 0 yields 1; else 0"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "!=": { + "name": "!=", + "code": 19, + "size": 1, + "doc": ["A is not equal to B => {0 or 1}"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + }, + { + "name": "B", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "%": { + "name": "%", + "code": 24, + "size": 1, + "doc": ["A modulo B. Fail if B == 0."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "&": { + "name": "&", + "code": 26, + "size": 1, + "doc": ["A bitwise-and B"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "&&": { + "name": "&&", + "code": 16, + "size": 1, + "doc": ["A is not zero and B is not zero => {0 or 1}"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "*": { + "name": "*", + "code": 11, + "size": 1, + "doc": [ + "A times B. Fail on overflow.", + "Overflow is an error condition which halts execution and fails the transaction. Full precision is available from `mulw`." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "+": { + "name": "+", + "code": 8, + "size": 1, + "doc": [ + "A plus B. Fail on overflow.", + "Overflow is an error condition which halts execution and fails the transaction. Full precision is available from `addw`." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "-": { + "name": "-", + "code": 9, + "size": 1, + "doc": ["A minus B. Fail if B > A."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "/": { + "name": "/", + "code": 10, + "size": 1, + "doc": [ + "A divided by B (truncated division). Fail if B == 0.", + "`divmodw` is available to divide the two-element values produced by `mulw` and `addw`." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "<": { + "name": "<", + "code": 12, + "size": 1, + "doc": ["A less than B => {0 or 1}"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "<=": { + "name": "<=", + "code": 14, + "size": 1, + "doc": ["A less than or equal to B => {0 or 1}"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "==": { + "name": "==", + "code": 18, + "size": 1, + "doc": ["A is equal to B => {0 or 1}"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + }, + { + "name": "B", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + ">": { + "name": ">", + "code": 13, + "size": 1, + "doc": ["A greater than B => {0 or 1}"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + ">=": { + "name": ">=", + "code": 15, + "size": 1, + "doc": ["A greater than or equal to B => {0 or 1}"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "^": { + "name": "^", + "code": 27, + "size": 1, + "doc": ["A bitwise-xor B"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "acct_params_get": { + "name": "acct_params_get", + "code": 115, + "size": 2, + "doc": ["X is field F from account A. Y is 1 if A owns positive algos, else 0"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 6, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "address_or_index", + "doc": null + } + ], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "acct_params", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "account params field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + }, + { + "name": "Y", + "stack_type": "bool", + "doc": null + } + ] + }, + "addw": { + "name": "addw", + "code": 30, + "size": 1, + "doc": ["A plus B as a 128-bit result. X is the carry-bit, Y is the low-order 64 bits."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + }, + { + "name": "Y", + "stack_type": "uint64", + "doc": null + } + ] + }, + "app_global_del": { + "name": "app_global_del", + "code": 105, + "size": 1, + "doc": [ + "delete key A from the global state of the current application", + "params: state key.", + "", + "Deleting a key which is already absent has no effect on the application global state. (In particular, it does _not_ cause the program to fail.)" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "stateKey", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [] + }, + "app_global_get": { + "name": "app_global_get", + "code": 100, + "size": 1, + "doc": [ + "global state of the key A in the current application", + "params: state key. Return: value. The value is zero (of type uint64) if the key does not exist." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "stateKey", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "app_global_get_ex": { + "name": "app_global_get_ex", + "code": 101, + "size": 1, + "doc": [ + "X is the global state of application A, key B. Y is 1 if key existed, else 0", + "params: Txn.ForeignApps offset (or, since v4, an _available_ application id), state key. Return: did_exist flag (top of the stack, 1 if the application and key existed and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "application", + "doc": null + }, + { + "name": "B", + "stack_type": "stateKey", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + }, + { + "name": "Y", + "stack_type": "bool", + "doc": null + } + ] + }, + "app_global_put": { + "name": "app_global_put", + "code": 103, + "size": 1, + "doc": ["write B to key A in the global state of the current application"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "stateKey", + "doc": null + }, + { + "name": "B", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [] + }, + "app_local_del": { + "name": "app_local_del", + "code": 104, + "size": 1, + "doc": [ + "delete key B from account A's local state of the current application", + "params: Txn.Accounts offset (or, since v4, an _available_ account address), state key.", + "", + "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.)" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "address_or_index", + "doc": null + }, + { + "name": "B", + "stack_type": "stateKey", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [] + }, + "app_local_get": { + "name": "app_local_get", + "code": 98, + "size": 1, + "doc": [ + "local state of the key B in the current application in account A", + "params: Txn.Accounts offset (or, since v4, an _available_ account address), state key. Return: value. The value is zero (of type uint64) if the key does not exist." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "address_or_index", + "doc": null + }, + { + "name": "B", + "stack_type": "stateKey", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "app_local_get_ex": { + "name": "app_local_get_ex", + "code": 99, + "size": 1, + "doc": [ + "X is the local state of application B, key C in account A. Y is 1 if key existed, else 0", + "params: Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset), state key. Return: did_exist flag (top of the stack, 1 if the application and key existed and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "address_or_index", + "doc": null + }, + { + "name": "B", + "stack_type": "application", + "doc": null + }, + { + "name": "C", + "stack_type": "stateKey", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + }, + { + "name": "Y", + "stack_type": "bool", + "doc": null + } + ] + }, + "app_local_put": { + "name": "app_local_put", + "code": 102, + "size": 1, + "doc": [ + "write C to key B in account A's local state of the current application", + "params: Txn.Accounts offset (or, since v4, an _available_ account address), state key, value." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "address_or_index", + "doc": null + }, + { + "name": "B", + "stack_type": "stateKey", + "doc": null + }, + { + "name": "C", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [] + }, + "app_opted_in": { + "name": "app_opted_in", + "code": 97, + "size": 1, + "doc": [ + "1 if account A is opted in to application B, else 0", + "params: Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset). Return: 1 if opted in and 0 otherwise." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "address_or_index", + "doc": null + }, + { + "name": "B", + "stack_type": "application", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "app_params_get": { + "name": "app_params_get", + "code": 114, + "size": 2, + "doc": [ + "X is field F from app A. Y is 1 if A exists, else 0", + "params: Txn.ForeignApps offset or an _available_ app id. Return: did_exist flag (1 if the application existed and 0 otherwise), value." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "application", + "doc": null + } + ], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "app_params", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "app params field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + }, + { + "name": "Y", + "stack_type": "bool", + "doc": null + } + ] + }, + "arg": { + "name": "arg", + "code": 44, + "size": 2, + "doc": ["Nth LogicSig argument"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "sig", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "N", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "an arg index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "arg_0": { + "name": "arg_0", + "code": 45, + "size": 1, + "doc": ["LogicSig argument 0"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "sig", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "arg_1": { + "name": "arg_1", + "code": 46, + "size": 1, + "doc": ["LogicSig argument 1"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "sig", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "arg_2": { + "name": "arg_2", + "code": 47, + "size": 1, + "doc": ["LogicSig argument 2"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "sig", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "arg_3": { + "name": "arg_3", + "code": 48, + "size": 1, + "doc": ["LogicSig argument 3"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "sig", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "args": { + "name": "args", + "code": 195, + "size": 1, + "doc": ["Ath LogicSig argument"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "sig", + "groups": ["Loading Values"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "assert": { + "name": "assert", + "code": 68, + "size": 1, + "doc": ["immediately fail unless A is a non-zero number"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 3, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [] + }, + "asset_holding_get": { + "name": "asset_holding_get", + "code": 112, + "size": 2, + "doc": [ + "X is field F from account A's holding of asset B. Y is 1 if A is opted into B, else 0", + "params: Txn.Accounts offset (or, since v4, an _available_ address), asset id (or, since v4, a Txn.ForeignAssets offset). Return: did_exist flag (1 if the asset existed and 0 otherwise), value." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "address_or_index", + "doc": null + }, + { + "name": "B", + "stack_type": "asset", + "doc": null + } + ], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "asset_holding", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "asset holding field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + }, + { + "name": "Y", + "stack_type": "bool", + "doc": null + } + ] + }, + "asset_params_get": { + "name": "asset_params_get", + "code": 113, + "size": 2, + "doc": [ + "X is field F from asset A. Y is 1 if A exists, else 0", + "params: Txn.ForeignAssets offset (or, since v4, an _available_ asset id. Return: did_exist flag (1 if the asset existed and 0 otherwise), value." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "asset", + "doc": null + } + ], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "asset_params", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "asset params field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + }, + { + "name": "Y", + "stack_type": "bool", + "doc": null + } + ] + }, + "b": { + "name": "b", + "code": 66, + "size": 3, + "doc": ["branch unconditionally to TARGET", "See `bnz` for details on how branches work. `b` always jumps to the offset."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "TARGET", + "immediate_type": "label", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "branch offset" + } + ], + "stack_outputs": [] + }, + "b!=": { + "name": "b!=", + "code": 169, + "size": 1, + "doc": ["0 if A is equal to B, else 1. A and B are interpreted as big-endian unsigned integers"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "bigint", + "doc": null + }, + { + "name": "B", + "stack_type": "bigint", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "b%": { + "name": "b%", + "code": 170, + "size": 1, + "doc": ["A modulo B. A and B are interpreted as big-endian unsigned integers. Fail if B is zero."], + "cost": { + "value": 20, + "doc": "20" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "bigint", + "doc": null + }, + { + "name": "B", + "stack_type": "bigint", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bigint", + "doc": null + } + ] + }, + "b&": { + "name": "b&", + "code": 172, + "size": 1, + "doc": ["A bitwise-and B. A and B are zero-left extended to the greater of their lengths"], + "cost": { + "value": 6, + "doc": "6" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Logic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "b*": { + "name": "b*", + "code": 163, + "size": 1, + "doc": ["A times B. A and B are interpreted as big-endian unsigned integers."], + "cost": { + "value": 20, + "doc": "20" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "bigint", + "doc": null + }, + { + "name": "B", + "stack_type": "bigint", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bigint", + "doc": null + } + ] + }, + "b+": { + "name": "b+", + "code": 160, + "size": 1, + "doc": ["A plus B. A and B are interpreted as big-endian unsigned integers"], + "cost": { + "value": 10, + "doc": "10" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "bigint", + "doc": null + }, + { + "name": "B", + "stack_type": "bigint", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bigint", + "doc": null + } + ] + }, + "b-": { + "name": "b-", + "code": 161, + "size": 1, + "doc": ["A minus B. A and B are interpreted as big-endian unsigned integers. Fail on underflow."], + "cost": { + "value": 10, + "doc": "10" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "bigint", + "doc": null + }, + { + "name": "B", + "stack_type": "bigint", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bigint", + "doc": null + } + ] + }, + "b/": { + "name": "b/", + "code": 162, + "size": 1, + "doc": ["A divided by B (truncated division). A and B are interpreted as big-endian unsigned integers. Fail if B is zero."], + "cost": { + "value": 20, + "doc": "20" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "bigint", + "doc": null + }, + { + "name": "B", + "stack_type": "bigint", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bigint", + "doc": null + } + ] + }, + "b<": { + "name": "b<", + "code": 164, + "size": 1, + "doc": ["1 if A is less than B, else 0. A and B are interpreted as big-endian unsigned integers"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "bigint", + "doc": null + }, + { + "name": "B", + "stack_type": "bigint", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "b<=": { + "name": "b<=", + "code": 166, + "size": 1, + "doc": ["1 if A is less than or equal to B, else 0. A and B are interpreted as big-endian unsigned integers"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "bigint", + "doc": null + }, + { + "name": "B", + "stack_type": "bigint", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "b==": { + "name": "b==", + "code": 168, + "size": 1, + "doc": ["1 if A is equal to B, else 0. A and B are interpreted as big-endian unsigned integers"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "bigint", + "doc": null + }, + { + "name": "B", + "stack_type": "bigint", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "b>": { + "name": "b>", + "code": 165, + "size": 1, + "doc": ["1 if A is greater than B, else 0. A and B are interpreted as big-endian unsigned integers"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "bigint", + "doc": null + }, + { + "name": "B", + "stack_type": "bigint", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "b>=": { + "name": "b>=", + "code": 167, + "size": 1, + "doc": ["1 if A is greater than or equal to B, else 0. A and B are interpreted as big-endian unsigned integers"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "bigint", + "doc": null + }, + { + "name": "B", + "stack_type": "bigint", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "b^": { + "name": "b^", + "code": 173, + "size": 1, + "doc": ["A bitwise-xor B. A and B are zero-left extended to the greater of their lengths"], + "cost": { + "value": 6, + "doc": "6" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Logic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "balance": { + "name": "balance", + "code": 96, + "size": 1, + "doc": [ + "balance for 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. Changes caused by inner transactions are observable immediately following `itxn_submit`", + "params: Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset). Return: value." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "address_or_index", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "base64_decode": { + "name": "base64_decode", + "code": 94, + "size": 2, + "doc": [ + "decode A which was base64-encoded using _encoding_ E. Fail if A is not base64 encoded with encoding E", + "*Warning*: Usage should be restricted to very rare use cases. In almost all cases, smart contracts should directly handle non-encoded byte-strings.\tThis opcode should only be used in cases where base64 is the only available option, e.g. interoperability with a third-party that only signs base64 strings.", + "", + " Decodes A using the base64 encoding E. Specify the encoding with an immediate arg either as URL and Filename Safe (`URLEncoding`) or Standard (`StdEncoding`). See [RFC 4648 sections 4 and 5](https://rfc-editor.org/rfc/rfc4648.html#section-4). It is assumed that the encoding ends with the exact number of `=` padding characters as required by the RFC. When padding occurs, any unused pad bits in the encoding must be set to zero or the decoding will fail. The special cases of `\\n` and `\\r` are allowed but completely ignored. An error will result when attempting to decode a string with a character that is not in the encoding alphabet or not one of `=`, `\\r`, or `\\n`." + ], + "cost": { + "value": null, + "doc": "1 + 1 per 16 bytes of A" + }, + "min_avm_version": 7, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "E", + "immediate_type": "arg_enum", + "arg_enum": "base64", + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "encoding index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "bitlen": { + "name": "bitlen", + "code": 147, + "size": 1, + "doc": [ + "The highest set bit in A. If A is a byte-array, it is interpreted as a big-endian unsigned integer. bitlen of 0 is 0, bitlen of 8 is 4", + "bitlen interprets arrays as big-endian integers, unlike setbit/getbit" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "block": { + "name": "block", + "code": 209, + "size": 2, + "doc": ["field F of block A. Fail unless A falls between txn.LastValid-1002 and txn.FirstValid (exclusive)"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 7, + "halts": false, + "mode": "any", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "block", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": " block field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "bnz": { + "name": "bnz", + "code": 64, + "size": 3, + "doc": [ + "branch to TARGET if value A is not zero", + "The `bnz` instruction opcode 0x40 is followed by two immediate data bytes which are a high byte first and low byte second which together form a 16 bit offset which the instruction may branch to. For a bnz instruction at `pc`, if the last element of the stack is not zero then branch to instruction at `pc + 3 + N`, else proceed to next instruction at `pc + 3`. Branch targets must be aligned instructions. (e.g. Branching to the second byte of a 2 byte op will be rejected.) Starting at v4, the offset is treated as a signed 16 bit integer allowing for backward branches and looping. In prior version (v1 to v3), branch offsets are limited to forward branches only, 0-0x7fff.", + "", + "At v2 it became allowed to branch to the end of the program exactly after the last instruction: bnz to byte N (with 0-indexing) was illegal for a TEAL program with N bytes before v2, and is legal after it. This change eliminates the need for a last instruction of no-op as a branch target at the end. (Branching beyond the end--in other words, to a byte larger than N--is still illegal and will cause the program to fail.)" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [ + { + "name": "TARGET", + "immediate_type": "label", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "branch offset" + } + ], + "stack_outputs": [] + }, + "box_create": { + "name": "box_create", + "code": 185, + "size": 1, + "doc": [ + "create a box named A, of length B. Fail if the name A is empty or B exceeds 32,768. Returns 0 if A already existed, else 1", + "Newly created boxes are filled with 0 bytes. `box_create` will fail if the referenced box already exists with a different size. Otherwise, existing boxes are unchanged by `box_create`." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "app", + "groups": ["Box Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "boxName", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "box_del": { + "name": "box_del", + "code": 188, + "size": 1, + "doc": ["delete box named A if it exists. Return 1 if A existed, 0 otherwise"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "app", + "groups": ["Box Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "boxName", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "box_extract": { + "name": "box_extract", + "code": 186, + "size": 1, + "doc": ["read C bytes from box A, starting at offset B. Fail if A does not exist, or the byte range is outside A's size."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "app", + "groups": ["Box Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "boxName", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + }, + { + "name": "C", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "box_get": { + "name": "box_get", + "code": 190, + "size": 1, + "doc": [ + "X is the contents of box A if A exists, else ''. Y is 1 if A exists, else 0.", + "For boxes that exceed 4,096 bytes, consider `box_create`, `box_extract`, and `box_replace`" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "app", + "groups": ["Box Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "boxName", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "Y", + "stack_type": "bool", + "doc": null + } + ] + }, + "box_len": { + "name": "box_len", + "code": 189, + "size": 1, + "doc": ["X is the length of box A if A exists, else 0. Y is 1 if A exists, else 0."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "app", + "groups": ["Box Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "boxName", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + }, + { + "name": "Y", + "stack_type": "bool", + "doc": null + } + ] + }, + "box_put": { + "name": "box_put", + "code": 191, + "size": 1, + "doc": [ + "replaces the contents of box A with byte-array B. Fails if A exists and len(B) != len(box A). Creates A if it does not exist", + "For boxes that exceed 4,096 bytes, consider `box_create`, `box_extract`, and `box_replace`" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "app", + "groups": ["Box Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "boxName", + "doc": null + }, + { + "name": "B", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [] + }, + "box_replace": { + "name": "box_replace", + "code": 187, + "size": 1, + "doc": ["write byte-array C into box A, starting at offset B. Fail if A does not exist, or the byte range is outside A's size."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "app", + "groups": ["Box Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "boxName", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + }, + { + "name": "C", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [] + }, + "box_resize": { + "name": "box_resize", + "code": 211, + "size": 1, + "doc": [ + "change the size of box named A to be of length B, adding zero bytes to end or removing bytes from the end, as needed. Fail if the name A is empty, A is not an existing box, or B exceeds 32,768." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 10, + "halts": false, + "mode": "app", + "groups": ["Box Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "boxName", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [] + }, + "box_splice": { + "name": "box_splice", + "code": 210, + "size": 1, + "doc": [ + "set box A to contain its previous bytes up to index B, followed by D, followed by the original bytes of A that began at index B+C.", + "Boxes are of constant length. If C < len(D), then len(D)-C bytes will be removed from the end. If C > len(D), zero bytes will be appended to the end to reach the box length." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 10, + "halts": false, + "mode": "app", + "groups": ["Box Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "boxName", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + }, + { + "name": "C", + "stack_type": "uint64", + "doc": null + }, + { + "name": "D", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [] + }, + "bsqrt": { + "name": "bsqrt", + "code": 150, + "size": 1, + "doc": ["The largest integer I such that I^2 <= A. A and I are interpreted as big-endian unsigned integers"], + "cost": { + "value": 40, + "doc": "40" + }, + "min_avm_version": 6, + "halts": false, + "mode": "any", + "groups": ["Byte Array Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "bigint", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bigint", + "doc": null + } + ] + }, + "btoi": { + "name": "btoi", + "code": 23, + "size": 1, + "doc": [ + "converts big-endian byte array A to uint64. Fails if len(A) > 8. Padded by leading 0s if len(A) < 8.", + "`btoi` fails if the input is longer than 8 bytes." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "bury": { + "name": "bury", + "code": 69, + "size": 2, + "doc": ["replace the Nth value from the top of the stack with A. bury 0 fails."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [ + { + "name": "N", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "depth" + } + ], + "stack_outputs": [] + }, + "bytec": { + "name": "bytec", + "code": 39, + "size": 2, + "doc": ["Ith constant from bytecblock"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "I", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "an index in the bytecblock" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "bytec_0": { + "name": "bytec_0", + "code": 40, + "size": 1, + "doc": ["constant 0 from bytecblock"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "bytec_1": { + "name": "bytec_1", + "code": 41, + "size": 1, + "doc": ["constant 1 from bytecblock"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "bytec_2": { + "name": "bytec_2", + "code": 42, + "size": 1, + "doc": ["constant 2 from bytecblock"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "bytec_3": { + "name": "bytec_3", + "code": 43, + "size": 1, + "doc": ["constant 3 from bytecblock"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "bytecblock": { + "name": "bytecblock", + "code": 38, + "size": 0, + "doc": [ + "prepare block of byte-array constants for use by bytec", + "`bytecblock` loads the following program bytes into an array of byte-array constants in the evaluator. These constants can be referred to by `bytec` and `bytec_*` which will push the value onto the stack. Subsequent calls to `bytecblock` reset and replace the bytes constants available to the script." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "BYTES ...", + "immediate_type": "bytes_array", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "a block of byte constant values" + } + ], + "stack_outputs": [] + }, + "bz": { + "name": "bz", + "code": 65, + "size": 3, + "doc": ["branch to TARGET if value A is zero", "See `bnz` for details on how branches work. `bz` inverts the behavior of `bnz`."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [ + { + "name": "TARGET", + "immediate_type": "label", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "branch offset" + } + ], + "stack_outputs": [] + }, + "bzero": { + "name": "bzero", + "code": 175, + "size": 1, + "doc": ["zero filled byte-array of length A"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "b|": { + "name": "b|", + "code": 171, + "size": 1, + "doc": ["A bitwise-or B. A and B are zero-left extended to the greater of their lengths"], + "cost": { + "value": 6, + "doc": "6" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Logic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "b~": { + "name": "b~", + "code": 174, + "size": 1, + "doc": ["A with all bits inverted"], + "cost": { + "value": 4, + "doc": "4" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Byte Array Logic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "callsub": { + "name": "callsub", + "code": 136, + "size": 3, + "doc": [ + "branch unconditionally to TARGET, saving the next instruction on the call stack", + "The call stack is separate from the data stack. Only `callsub`, `retsub`, and `proto` manipulate it." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "TARGET", + "immediate_type": "label", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "branch offset" + } + ], + "stack_outputs": [] + }, + "concat": { + "name": "concat", + "code": 80, + "size": 1, + "doc": ["join A and B", "`concat` fails if the result would be greater than 4096 bytes."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "cover": { + "name": "cover", + "code": 78, + "size": 2, + "doc": ["remove top of stack, and place it deeper in the stack such that N elements are above it. Fails if stack depth <= N."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [ + { + "name": "N", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "depth" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "dig": { + "name": "dig", + "code": 75, + "size": 2, + "doc": ["Nth value from the top of the stack. dig 0 is equivalent to dup"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 3, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [ + { + "name": "N", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "depth" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + }, + { + "name": "Y", + "stack_type": "any", + "doc": null + } + ] + }, + "divmodw": { + "name": "divmodw", + "code": 31, + "size": 1, + "doc": [ + "W,X = (A,B / C,D); Y,Z = (A,B modulo C,D)", + "The notation J,K indicates that two uint64 values J and K are interpreted as a uint128 value, with J as the high uint64 and K the low." + ], + "cost": { + "value": 20, + "doc": "20" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + }, + { + "name": "C", + "stack_type": "uint64", + "doc": null + }, + { + "name": "D", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "W", + "stack_type": "uint64", + "doc": null + }, + { + "name": "X", + "stack_type": "uint64", + "doc": null + }, + { + "name": "Y", + "stack_type": "uint64", + "doc": null + }, + { + "name": "Z", + "stack_type": "uint64", + "doc": null + } + ] + }, + "divw": { + "name": "divw", + "code": 151, + "size": 1, + "doc": [ + "A,B / C. Fail if C == 0 or if result overflows.", + "The notation A,B indicates that A and B are interpreted as a uint128 value, with A as the high uint64 and B the low." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 6, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + }, + { + "name": "C", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "dup": { + "name": "dup", + "code": 73, + "size": 1, + "doc": ["duplicate A"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + }, + { + "name": "Y", + "stack_type": "any", + "doc": null + } + ] + }, + "dup2": { + "name": "dup2", + "code": 74, + "size": 1, + "doc": ["duplicate A and B"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + }, + { + "name": "B", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "W", + "stack_type": "any", + "doc": null + }, + { + "name": "X", + "stack_type": "any", + "doc": null + }, + { + "name": "Y", + "stack_type": "any", + "doc": null + }, + { + "name": "Z", + "stack_type": "any", + "doc": null + } + ] + }, + "dupn": { + "name": "dupn", + "code": 71, + "size": 2, + "doc": ["duplicate A, N times"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [ + { + "name": "N", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "copy count" + } + ], + "stack_outputs": [] + }, + "ec_add": { + "name": "ec_add", + "code": 224, + "size": 2, + "doc": [ + "for curve points A and B, return the curve point A + B", + "A and B are curve points in affine representation: field element X concatenated with field element Y. Field element `Z` is encoded as follows.", + "For the base field elements (Fp), `Z` is encoded as a big-endian number and must be lower than the field modulus.", + "For the quadratic field extension (Fp2), `Z` is encoded as the concatenation of the individual encoding of the coefficients. For an Fp2 element of the form `Z = Z0 + Z1 i`, where `i` is a formal quadratic non-residue, the encoding of Z is the concatenation of the encoding of `Z0` and `Z1` in this order. (`Z0` and `Z1` must be less than the field modulus).", + "", + "The point at infinity is encoded as `(X,Y) = (0,0)`.", + "Groups G1 and G2 are denoted additively.", + "", + "Fails if A or B is not in G.", + "A and/or B are allowed to be the point at infinity.", + "Does _not_ check if A and B are in the main prime-order subgroup." + ], + "cost": { + "value": null, + "doc": "BN254g1=125; BN254g2=170; BLS12_381g1=205; BLS12_381g2=290" + }, + "min_avm_version": 10, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "G", + "immediate_type": "arg_enum", + "arg_enum": "EC", + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "curve index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "ec_map_to": { + "name": "ec_map_to", + "code": 229, + "size": 2, + "doc": [ + "maps field element A to group G", + "BN254 points are mapped by the SVDW map. BLS12-381 points are mapped by the SSWU map.", + "G1 element inputs are base field elements and G2 element inputs are quadratic field elements, with nearly the same encoding rules (for field elements) as defined in `ec_add`. There is one difference of encoding rule: G1 element inputs do not need to be 0-padded if they fit in less than 32 bytes for BN254 and less than 48 bytes for BLS12-381. (As usual, the empty byte array represents 0.) G2 elements inputs need to be always have the required size." + ], + "cost": { + "value": null, + "doc": "BN254g1=630; BN254g2=3300; BLS12_381g1=1950; BLS12_381g2=8150" + }, + "min_avm_version": 10, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "G", + "immediate_type": "arg_enum", + "arg_enum": "EC", + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "curve index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "ec_multi_scalar_mul": { + "name": "ec_multi_scalar_mul", + "code": 227, + "size": 2, + "doc": [ + "for curve points A and scalars B, return curve point B0A0 + B1A1 + B2A2 + ... + BnAn", + "A is a list of concatenated points, encoded and checked as described in `ec_add`. B is a list of concatenated scalars which, unlike ec_scalar_mul, must all be exactly 32 bytes long.", + "The name `ec_multi_scalar_mul` was chosen to reflect common usage, but a more consistent name would be `ec_multi_scalar_mul`. AVM values are limited to 4096 bytes, so `ec_multi_scalar_mul` is limited by the size of the points in the group being operated upon." + ], + "cost": { + "value": null, + "doc": "BN254g1=3600 + 90 per 32 bytes of B; BN254g2=7200 + 270 per 32 bytes of B; BLS12_381g1=6500 + 95 per 32 bytes of B; BLS12_381g2=14850 + 485 per 32 bytes of B" + }, + "min_avm_version": 10, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "G", + "immediate_type": "arg_enum", + "arg_enum": "EC", + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "curve index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "ec_pairing_check": { + "name": "ec_pairing_check", + "code": 226, + "size": 2, + "doc": [ + "1 if the product of the pairing of each point in A with its respective point in B is equal to the identity element of the target group Gt, else 0", + "A and B are concatenated points, encoded and checked as described in `ec_add`. A contains points of the group G, B contains points of the associated group (G2 if G is G1, and vice versa). Fails if A and B have a different number of points, or if any point is not in its described group or outside the main prime-order subgroup - a stronger condition than other opcodes. AVM values are limited to 4096 bytes, so `ec_pairing_check` is limited by the size of the points in the groups being operated upon." + ], + "cost": { + "value": null, + "doc": "BN254g1=8000 + 7400 per 64 bytes of B; BN254g2=8000 + 7400 per 128 bytes of B; BLS12_381g1=13000 + 10000 per 96 bytes of B; BLS12_381g2=13000 + 10000 per 192 bytes of B" + }, + "min_avm_version": 10, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "G", + "immediate_type": "arg_enum", + "arg_enum": "EC", + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "curve index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "ec_scalar_mul": { + "name": "ec_scalar_mul", + "code": 225, + "size": 2, + "doc": [ + "for curve point A and scalar B, return the curve point BA, the point A multiplied by the scalar B.", + "A is a curve point encoded and checked as described in `ec_add`. Scalar B is interpreted as a big-endian unsigned integer. Fails if B exceeds 32 bytes." + ], + "cost": { + "value": null, + "doc": "BN254g1=1810; BN254g2=3430; BLS12_381g1=2950; BLS12_381g2=6530" + }, + "min_avm_version": 10, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "G", + "immediate_type": "arg_enum", + "arg_enum": "EC", + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "curve index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "ec_subgroup_check": { + "name": "ec_subgroup_check", + "code": 228, + "size": 2, + "doc": [ + "1 if A is in the main prime-order subgroup of G (including the point at infinity) else 0. Program fails if A is not in G at all." + ], + "cost": { + "value": null, + "doc": "BN254g1=20; BN254g2=3100; BLS12_381g1=1850; BLS12_381g2=2340" + }, + "min_avm_version": 10, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "G", + "immediate_type": "arg_enum", + "arg_enum": "EC", + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "curve index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "ecdsa_pk_decompress": { + "name": "ecdsa_pk_decompress", + "code": 6, + "size": 2, + "doc": [ + "decompress pubkey A into components X, Y", + "The 33 byte public key in a compressed form to be decompressed into X and Y (top) components. All values are big-endian encoded." + ], + "cost": { + "value": null, + "doc": "Secp256k1=650; Secp256r1=2400" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[33]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "V", + "immediate_type": "arg_enum", + "arg_enum": "ECDSA", + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "curve index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[32]byte", + "doc": null + }, + { + "name": "Y", + "stack_type": "[32]byte", + "doc": null + } + ] + }, + "ecdsa_pk_recover": { + "name": "ecdsa_pk_recover", + "code": 7, + "size": 2, + "doc": [ + "for (data A, recovery id B, signature C, D) recover a public key", + "S (top) and R elements of a signature, recovery id and data (bottom) are expected on the stack and used to deriver a public key. All values are big-endian encoded. The signed data must be 32 bytes long." + ], + "cost": { + "value": 2000, + "doc": "2000" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[32]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + }, + { + "name": "C", + "stack_type": "[32]byte", + "doc": null + }, + { + "name": "D", + "stack_type": "[32]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "V", + "immediate_type": "arg_enum", + "arg_enum": "ECDSA", + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "curve index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[32]byte", + "doc": null + }, + { + "name": "Y", + "stack_type": "[32]byte", + "doc": null + } + ] + }, + "ecdsa_verify": { + "name": "ecdsa_verify", + "code": 5, + "size": 2, + "doc": [ + "for (data A, signature B, C and pubkey D, E) verify the signature of the data against the pubkey => {0 or 1}", + "The 32 byte Y-component of a public key is the last element on the stack, preceded by X-component of a pubkey, preceded by S and R components of a signature, preceded by the data that is fifth element on the stack. All values are big-endian encoded. The signed data must be 32 bytes long, and signatures in lower-S form are only accepted." + ], + "cost": { + "value": null, + "doc": "Secp256k1=1700; Secp256r1=2500" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[32]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[32]byte", + "doc": null + }, + { + "name": "C", + "stack_type": "[32]byte", + "doc": null + }, + { + "name": "D", + "stack_type": "[32]byte", + "doc": null + }, + { + "name": "E", + "stack_type": "[32]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "V", + "immediate_type": "arg_enum", + "arg_enum": "ECDSA", + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "curve index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "ed25519verify": { + "name": "ed25519verify", + "code": 4, + "size": 1, + "doc": [ + "for (data A, signature B, pubkey C) verify the signature of (\"ProgData\" || program_hash || data) against the pubkey => {0 or 1}", + "The 32 byte public key is the last element on the stack, preceded by the 64 byte signature at the second-to-last element on the stack, preceded by the data which was signed at the third-to-last element on the stack." + ], + "cost": { + "value": 1900, + "doc": "1900" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[64]byte", + "doc": null + }, + { + "name": "C", + "stack_type": "[32]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "ed25519verify_bare": { + "name": "ed25519verify_bare", + "code": 132, + "size": 1, + "doc": ["for (data A, signature B, pubkey C) verify the signature of the data against the pubkey => {0 or 1}"], + "cost": { + "value": 1900, + "doc": "1900" + }, + "min_avm_version": 7, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[64]byte", + "doc": null + }, + { + "name": "C", + "stack_type": "[32]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "err": { + "name": "err", + "code": 0, + "size": 1, + "doc": ["Fail immediately."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": true, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [] + }, + "exp": { + "name": "exp", + "code": 148, + "size": 1, + "doc": ["A raised to the Bth power. Fail if A == B == 0 and on overflow"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "expw": { + "name": "expw", + "code": 149, + "size": 1, + "doc": [ + "A raised to the Bth power as a 128-bit result in two uint64s. X is the high 64 bits, Y is the low. Fail if A == B == 0 or if the results exceeds 2^128-1" + ], + "cost": { + "value": 10, + "doc": "10" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + }, + { + "name": "Y", + "stack_type": "uint64", + "doc": null + } + ] + }, + "extract": { + "name": "extract", + "code": 87, + "size": 3, + "doc": [ + "A range of bytes from A starting at S up to but not including S+L. If L is 0, then extract to the end of the string. If S or S+L is larger than the array length, the program fails" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "S", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "start position" + }, + { + "name": "L", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "length" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "extract3": { + "name": "extract3", + "code": 88, + "size": 1, + "doc": [ + "A range of bytes from A starting at B up to but not including B+C. If B+C is larger than the array length, the program fails", + "`extract3` can be called using `extract` with no immediates." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + }, + { + "name": "C", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "extract_uint16": { + "name": "extract_uint16", + "code": 89, + "size": 1, + "doc": [ + "A uint16 formed from a range of big-endian bytes from A starting at B up to but not including B+2. If B+2 is larger than the array length, the program fails" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "extract_uint32": { + "name": "extract_uint32", + "code": 90, + "size": 1, + "doc": [ + "A uint32 formed from a range of big-endian bytes from A starting at B up to but not including B+4. If B+4 is larger than the array length, the program fails" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "extract_uint64": { + "name": "extract_uint64", + "code": 91, + "size": 1, + "doc": [ + "A uint64 formed from a range of big-endian bytes from A starting at B up to but not including B+8. If B+8 is larger than the array length, the program fails" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "falcon_verify": { + "name": "falcon_verify", + "code": 133, + "size": 1, + "doc": ["for (data A, compressed-format signature B, pubkey C) verify the signature of data against the pubkey"], + "cost": { + "value": 1700, + "doc": "1700" + }, + "min_avm_version": 11, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[1232]byte", + "doc": null + }, + { + "name": "C", + "stack_type": "[1793]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "frame_bury": { + "name": "frame_bury", + "code": 140, + "size": 2, + "doc": ["replace the Nth (signed) value from the frame pointer in the stack with A"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [ + { + "name": "I", + "immediate_type": "int8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "frame slot" + } + ], + "stack_outputs": [] + }, + "frame_dig": { + "name": "frame_dig", + "code": 139, + "size": 2, + "doc": ["Nth (signed) value from the frame pointer."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "I", + "immediate_type": "int8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "frame slot" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "gaid": { + "name": "gaid", + "code": 60, + "size": 2, + "doc": [ + "ID of the asset or application created in the Tth transaction of the current group", + "`gaid` fails unless the requested transaction created an asset or application and T < GroupIndex." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "app", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "T", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "transaction group index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "gaids": { + "name": "gaids", + "code": 61, + "size": 1, + "doc": [ + "ID of the asset or application created in the Ath transaction of the current group", + "`gaids` fails unless the requested transaction created an asset or application and A < GroupIndex." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "app", + "groups": ["Loading Values"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "getbit": { + "name": "getbit", + "code": 83, + "size": 1, + "doc": [ + "Bth bit of (byte-array or integer) A. If B is greater than or equal to the bit length of the value (8*byte length), the program fails", + "see explanation of bit ordering in setbit" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 3, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "getbyte": { + "name": "getbyte", + "code": 85, + "size": 1, + "doc": ["Bth byte of A, as an integer. If B is greater than or equal to the array length, the program fails"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 3, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "gitxn": { + "name": "gitxn", + "code": 183, + "size": 3, + "doc": ["field F of the Tth transaction in the last inner group submitted"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 6, + "halts": false, + "mode": "app", + "groups": ["Inner Transactions"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "T", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "transaction group index" + }, + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txn", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "gitxna": { + "name": "gitxna", + "code": 184, + "size": 4, + "doc": ["Ith value of the array field F from the Tth transaction in the last inner group submitted"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 6, + "halts": false, + "mode": "app", + "groups": ["Inner Transactions"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "T", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "transaction group index" + }, + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txna", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + }, + { + "name": "I", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "transaction field array index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "gitxnas": { + "name": "gitxnas", + "code": 198, + "size": 3, + "doc": ["Ath value of the array field F from the Tth transaction in the last inner group submitted"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 6, + "halts": false, + "mode": "app", + "groups": ["Inner Transactions"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [ + { + "name": "T", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "transaction group index" + }, + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txna", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "gload": { + "name": "gload", + "code": 58, + "size": 3, + "doc": [ + "Ith scratch space value of the Tth transaction in the current group", + "`gload` fails unless the requested transaction is an ApplicationCall and T < GroupIndex." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "app", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "T", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "transaction group index" + }, + { + "name": "I", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "position in scratch space to load from" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "gloads": { + "name": "gloads", + "code": 59, + "size": 2, + "doc": [ + "Ith scratch space value of the Ath transaction in the current group", + "`gloads` fails unless the requested transaction is an ApplicationCall and A < GroupIndex." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "app", + "groups": ["Loading Values"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [ + { + "name": "I", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "position in scratch space to load from" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "gloadss": { + "name": "gloadss", + "code": 196, + "size": 1, + "doc": ["Bth scratch space value of the Ath transaction in the current group"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 6, + "halts": false, + "mode": "app", + "groups": ["Loading Values"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "global": { + "name": "global", + "code": 50, + "size": 2, + "doc": ["global field F"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "global", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "a global field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "gtxn": { + "name": "gtxn", + "code": 51, + "size": 3, + "doc": [ + "field F of the Tth transaction in the current group", + "for notes on transaction fields available, see `txn`. If this transaction is _i_ in the group, `gtxn i field` is equivalent to `txn field`." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "T", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "transaction group index" + }, + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txn", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "gtxna": { + "name": "gtxna", + "code": 55, + "size": 4, + "doc": [ + "Ith value of the array field F from the Tth transaction in the current group", + "`gtxna` can be called using `gtxn` with 3 immediates." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "T", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "transaction group index" + }, + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txna", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + }, + { + "name": "I", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "transaction field array index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "gtxnas": { + "name": "gtxnas", + "code": 193, + "size": 3, + "doc": ["Ath value of the array field F from the Tth transaction in the current group"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [ + { + "name": "T", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "transaction group index" + }, + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txna", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "gtxns": { + "name": "gtxns", + "code": 56, + "size": 2, + "doc": [ + "field F of the Ath transaction in the current group", + "for notes on transaction fields available, see `txn`. If top of stack is _i_, `gtxns field` is equivalent to `gtxn _i_ field`. gtxns exists so that _i_ can be calculated, often based on the index of the current transaction." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 3, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txn", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "gtxnsa": { + "name": "gtxnsa", + "code": 57, + "size": 3, + "doc": [ + "Ith value of the array field F from the Ath transaction in the current group", + "`gtxnsa` can be called using `gtxns` with 2 immediates." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 3, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txna", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + }, + { + "name": "I", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "transaction field array index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "gtxnsas": { + "name": "gtxnsas", + "code": 194, + "size": 2, + "doc": ["Bth value of the array field F from the Ath transaction in the current group"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txna", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "intc": { + "name": "intc", + "code": 33, + "size": 2, + "doc": ["Ith constant from intcblock"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "I", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "an index in the intcblock" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "intc_0": { + "name": "intc_0", + "code": 34, + "size": 1, + "doc": ["constant 0 from intcblock"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "intc_1": { + "name": "intc_1", + "code": 35, + "size": 1, + "doc": ["constant 1 from intcblock"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "intc_2": { + "name": "intc_2", + "code": 36, + "size": 1, + "doc": ["constant 2 from intcblock"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "intc_3": { + "name": "intc_3", + "code": 37, + "size": 1, + "doc": ["constant 3 from intcblock"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "intcblock": { + "name": "intcblock", + "code": 32, + "size": 0, + "doc": [ + "prepare block of uint64 constants for use by intc", + "`intcblock` loads following program bytes into an array of integer constants in the evaluator. These integer constants can be referred to by `intc` and `intc_*` which will push the value onto the stack. Subsequent calls to `intcblock` reset and replace the integer constants available to the script." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "UINT ...", + "immediate_type": "varuint_array", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "a block of int constant values" + } + ], + "stack_outputs": [] + }, + "itob": { + "name": "itob", + "code": 22, + "size": 1, + "doc": ["converts uint64 A to big-endian byte array, always of length 8"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[8]byte", + "doc": null + } + ] + }, + "itxn": { + "name": "itxn", + "code": 180, + "size": 2, + "doc": ["field F of the last inner transaction"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "app", + "groups": ["Inner Transactions"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txn", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "itxn_begin": { + "name": "itxn_begin", + "code": 177, + "size": 1, + "doc": [ + "begin preparation of a new inner transaction in a new transaction group", + "`itxn_begin` initializes Sender to the application address; Fee to the minimum allowable, taking into account MinTxnFee and credit from overpaying in earlier transactions; FirstValid/LastValid to the values in the invoking transaction, and all other fields to zero or empty values." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "app", + "groups": ["Inner Transactions"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [] + }, + "itxn_field": { + "name": "itxn_field", + "code": 178, + "size": 2, + "doc": [ + "set field F of the current inner transaction to A", + "`itxn_field` fails if A is of the wrong type for F, including a byte array of the wrong size for use as an address when F is an address field. `itxn_field` also fails if A is an account, asset, or app that is not _available_, or an attempt is made extend an array field beyond the limit imposed by consensus parameters. (Addresses set into asset params of acfg transactions need not be _available_.)" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "app", + "groups": ["Inner Transactions"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "itxn_field", + "modifies_stack_input": 0, + "modifies_stack_output": null, + "doc": "transaction field index" + } + ], + "stack_outputs": [] + }, + "itxn_next": { + "name": "itxn_next", + "code": 182, + "size": 1, + "doc": [ + "begin preparation of a new inner transaction in the same transaction group", + "`itxn_next` initializes the transaction exactly as `itxn_begin` does" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 6, + "halts": false, + "mode": "app", + "groups": ["Inner Transactions"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [] + }, + "itxn_submit": { + "name": "itxn_submit", + "code": 179, + "size": 1, + "doc": [ + "execute the current inner transaction group. Fail if executing this group would exceed the inner transaction limit, or if any transaction in the group fails.", + "`itxn_submit` resets the current transaction so that it can not be resubmitted. A new `itxn_begin` is required to prepare another inner transaction." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "app", + "groups": ["Inner Transactions"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [] + }, + "itxna": { + "name": "itxna", + "code": 181, + "size": 3, + "doc": ["Ith value of the array field F of the last inner transaction"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "app", + "groups": ["Inner Transactions"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txna", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + }, + { + "name": "I", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "a transaction field array index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "itxnas": { + "name": "itxnas", + "code": 197, + "size": 2, + "doc": ["Ath value of the array field F of the last inner transaction"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 6, + "halts": false, + "mode": "app", + "groups": ["Inner Transactions"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txna", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "json_ref": { + "name": "json_ref", + "code": 95, + "size": 2, + "doc": [ + "key B's value, of type R, from a [valid](jsonspec.md) utf-8 encoded json object A", + "*Warning*: Usage should be restricted to very rare use cases, as JSON decoding is expensive and quite limited. In addition, JSON objects are large and not optimized for size.", + "", + "Almost all smart contracts should use simpler and smaller methods (such as the [ABI](https://arc.algorand.foundation/ARCs/arc-0004). This opcode should only be used in cases where JSON is only available option, e.g. when a third-party only signs JSON." + ], + "cost": { + "value": null, + "doc": "25 + 2 per 7 bytes of A" + }, + "min_avm_version": 7, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "R", + "immediate_type": "arg_enum", + "arg_enum": "json_ref", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "return type index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "keccak256": { + "name": "keccak256", + "code": 2, + "size": 1, + "doc": ["Keccak256 hash of value A, yields [32]byte"], + "cost": { + "value": 130, + "doc": "130" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[32]byte", + "doc": null + } + ] + }, + "len": { + "name": "len", + "code": 21, + "size": 1, + "doc": ["yields length of byte value A"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "load": { + "name": "load", + "code": 52, + "size": 2, + "doc": ["Ith scratch space value. All scratch spaces are 0 at program start."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "I", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "position in scratch space to load from" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "loads": { + "name": "loads", + "code": 62, + "size": 1, + "doc": ["Ath scratch space value. All scratch spaces are 0 at program start."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "log": { + "name": "log", + "code": 176, + "size": 1, + "doc": [ + "write A to log state of the current application", + "`log` fails if called more than MaxLogCalls times in a program, or if the sum of logged bytes exceeds 1024 bytes." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [] + }, + "match": { + "name": "match", + "code": 142, + "size": 0, + "doc": [ + "given match cases from A[1] to A[N], branch to the Ith label where A[I] = B. Continue to the following instruction if no matches are found.", + "`match` consumes N+1 values from the stack. Let the top stack value be B. The following N values represent an ordered list of match cases/constants (A), where the first value (A[0]) is the deepest in the stack. The immediate arguments are an ordered list of N labels (T). `match` will branch to target T[I], where A[I] = B. If there are no matches then execution continues on to the next instruction." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "TARGET ...", + "immediate_type": "label_array", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "list of labels" + } + ], + "stack_outputs": [] + }, + "min_balance": { + "name": "min_balance", + "code": 120, + "size": 1, + "doc": [ + "minimum required balance for account A, in microalgos. Required balance is affected by ASA, App, and Box 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. Changes caused by inner transactions or box usage are observable immediately following the opcode effecting the change.", + "params: Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset). Return: value." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 3, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "address_or_index", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "mulw": { + "name": "mulw", + "code": 29, + "size": 1, + "doc": ["A times B as a 128-bit result in two uint64s. X is the high 64 bits, Y is the low"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + }, + { + "name": "Y", + "stack_type": "uint64", + "doc": null + } + ] + }, + "online_stake": { + "name": "online_stake", + "code": 117, + "size": 1, + "doc": ["the total online stake in the agreement round"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 11, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "pop": { + "name": "pop", + "code": 72, + "size": 1, + "doc": ["discard A"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [] + }, + "popn": { + "name": "popn", + "code": 70, + "size": 2, + "doc": ["remove N values from the top of the stack"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "N", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "stack depth" + } + ], + "stack_outputs": [] + }, + "proto": { + "name": "proto", + "code": 138, + "size": 3, + "doc": [ + "Prepare top call frame for a retsub that will assume A args and R return values.", + "Fails unless the last instruction executed was a `callsub`." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "A", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "number of arguments" + }, + { + "name": "R", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "number of return values" + } + ], + "stack_outputs": [] + }, + "pushbytes": { + "name": "pushbytes", + "code": 128, + "size": 0, + "doc": ["immediate BYTES", "pushbytes args are not added to the bytecblock during assembly processes"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 3, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "BYTES", + "immediate_type": "bytes", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "a byte constant" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "pushbytess": { + "name": "pushbytess", + "code": 130, + "size": 0, + "doc": [ + "push sequences of immediate byte arrays to stack (first byte array being deepest)", + "pushbytess args are not added to the bytecblock during assembly processes" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "BYTES ...", + "immediate_type": "bytes_array", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "a list of byte constants" + } + ], + "stack_outputs": [] + }, + "pushint": { + "name": "pushint", + "code": 129, + "size": 0, + "doc": ["immediate UINT", "pushint args are not added to the intcblock during assembly processes"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 3, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "UINT", + "immediate_type": "varuint", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "an int constant" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "pushints": { + "name": "pushints", + "code": 131, + "size": 0, + "doc": [ + "push sequence of immediate uints to stack in the order they appear (first uint being deepest)", + "pushints args are not added to the intcblock during assembly processes" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "UINT ...", + "immediate_type": "varuint_array", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "a list of int constants" + } + ], + "stack_outputs": [] + }, + "replace2": { + "name": "replace2", + "code": 92, + "size": 2, + "doc": [ + "Copy of A with the bytes starting at S replaced by the bytes of B. Fails if S+len(B) exceeds len(A)", + "`replace2` can be called using `replace` with 1 immediate." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 7, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "S", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "start position" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "replace3": { + "name": "replace3", + "code": 93, + "size": 1, + "doc": [ + "Copy of A with the bytes starting at B replaced by the bytes of C. Fails if B+len(C) exceeds len(A)", + "`replace3` can be called using `replace` with no immediates." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 7, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + }, + { + "name": "C", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "retsub": { + "name": "retsub", + "code": 137, + "size": 1, + "doc": [ + "pop the top instruction from the call stack and branch to it", + "If the current frame was prepared by `proto A R`, `retsub` will remove the 'A' arguments from the stack, move the `R` return values down, and pop any stack locations above the relocated return values." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [], + "immediate_args": [], + "stack_outputs": [] + }, + "return": { + "name": "return", + "code": 67, + "size": 1, + "doc": ["use A as success value; end"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": true, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [] + }, + "select": { + "name": "select", + "code": 77, + "size": 1, + "doc": ["selects one of two values based on top-of-stack: B if C != 0, else A"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 3, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + }, + { + "name": "B", + "stack_type": "any", + "doc": null + }, + { + "name": "C", + "stack_type": "bool", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "setbit": { + "name": "setbit", + "code": 84, + "size": 1, + "doc": [ + "Copy of (byte-array or integer) A, with the Bth bit set to (0 or 1) C. If B is greater than or equal to the bit length of the value (8*byte length), the program fails", + "When A is a uint64, index 0 is the least significant bit. Setting bit 3 to 1 on the integer 0 yields 8, or 2^3. When A is a byte array, index 0 is the leftmost bit of the leftmost byte. Setting bits 0 through 11 to 1 in a 4-byte-array of 0s yields the byte array 0xfff00000. Setting bit 3 to 1 on the 1-byte-array 0x00 yields the byte array 0x10." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 3, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + }, + { + "name": "C", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "setbyte": { + "name": "setbyte", + "code": 86, + "size": 1, + "doc": [ + "Copy of A with the Bth byte set to small integer (between 0..255) C. If B is greater than or equal to the array length, the program fails" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 3, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + }, + { + "name": "C", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "sha256": { + "name": "sha256", + "code": 1, + "size": 1, + "doc": ["SHA256 hash of value A, yields [32]byte"], + "cost": { + "value": 35, + "doc": "35" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[32]byte", + "doc": null + } + ] + }, + "sha3_256": { + "name": "sha3_256", + "code": 152, + "size": 1, + "doc": ["SHA3_256 hash of value A, yields [32]byte"], + "cost": { + "value": 130, + "doc": "130" + }, + "min_avm_version": 7, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[32]byte", + "doc": null + } + ] + }, + "sha512_256": { + "name": "sha512_256", + "code": 3, + "size": 1, + "doc": ["SHA512_256 hash of value A, yields [32]byte"], + "cost": { + "value": 45, + "doc": "45" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[32]byte", + "doc": null + } + ] + }, + "shl": { + "name": "shl", + "code": 144, + "size": 1, + "doc": ["A times 2^B, modulo 2^64"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "shr": { + "name": "shr", + "code": 145, + "size": 1, + "doc": ["A divided by 2^B"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "sqrt": { + "name": "sqrt", + "code": 146, + "size": 1, + "doc": ["The largest integer I such that I^2 <= A"], + "cost": { + "value": 4, + "doc": "4" + }, + "min_avm_version": 4, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "store": { + "name": "store", + "code": 53, + "size": 2, + "doc": ["store A to the Ith scratch space"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [ + { + "name": "I", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "position in scratch space to store to" + } + ], + "stack_outputs": [] + }, + "stores": { + "name": "stores", + "code": 63, + "size": 1, + "doc": ["store B to the Ath scratch space"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [] + }, + "substring": { + "name": "substring", + "code": 81, + "size": 3, + "doc": [ + "A range of bytes from A starting at S up to but not including E. If E < S, or either is larger than the array length, the program fails" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "S", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "start position" + }, + { + "name": "E", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "end position" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "substring3": { + "name": "substring3", + "code": 82, + "size": 1, + "doc": [ + "A range of bytes from A starting at B up to but not including C. If C < B, or either is larger than the array length, the program fails" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "any", + "groups": ["Byte Array Manipulation"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + }, + { + "name": "C", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[]byte", + "doc": null + } + ] + }, + "sumhash512": { + "name": "sumhash512", + "code": 134, + "size": 1, + "doc": ["sumhash512 of value A, yields [64]byte"], + "cost": { + "value": null, + "doc": "150 + 7 per 4 bytes of A" + }, + "min_avm_version": 11, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[64]byte", + "doc": null + } + ] + }, + "swap": { + "name": "swap", + "code": 76, + "size": 1, + "doc": ["swaps A and B on stack"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 3, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + }, + { + "name": "B", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + }, + { + "name": "Y", + "stack_type": "any", + "doc": null + } + ] + }, + "switch": { + "name": "switch", + "code": 141, + "size": 0, + "doc": ["branch to the Ath label. Continue at following instruction if index A exceeds the number of labels."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 8, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [ + { + "name": "TARGET ...", + "immediate_type": "label_array", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "list of labels" + } + ], + "stack_outputs": [] + }, + "txn": { + "name": "txn", + "code": 49, + "size": 2, + "doc": ["field F of current transaction"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txn", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "txna": { + "name": "txna", + "code": 54, + "size": 3, + "doc": ["Ith value of the array field F of the current transaction", "`txna` can be called using `txn` with 2 immediates."], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 2, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txna", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + }, + { + "name": "I", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "transaction field array index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "txnas": { + "name": "txnas", + "code": 192, + "size": 2, + "doc": ["Ath value of the array field F of the current transaction"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Loading Values"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "txna", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "transaction field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "uncover": { + "name": "uncover", + "code": 79, + "size": 2, + "doc": [ + "remove the value at depth N in the stack and shift above items down so the Nth deep value is on top of the stack. Fails if stack depth <= N." + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 5, + "halts": false, + "mode": "any", + "groups": ["Flow Control"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [ + { + "name": "N", + "immediate_type": "uint8", + "arg_enum": null, + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": "depth" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + } + ] + }, + "voter_params_get": { + "name": "voter_params_get", + "code": 116, + "size": 2, + "doc": [ + "X is field F from online account A as of the balance round: 320 rounds before the current round. Y is 1 if A had positive algos online in the agreement round, else Y is 0 and X is a type specific zero-value" + ], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 11, + "halts": false, + "mode": "app", + "groups": ["State Access"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "any", + "doc": null + } + ], + "immediate_args": [ + { + "name": "F", + "immediate_type": "arg_enum", + "arg_enum": "voter_params", + "modifies_stack_input": null, + "modifies_stack_output": 0, + "doc": "voter params field index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "any", + "doc": null + }, + { + "name": "Y", + "stack_type": "bool", + "doc": null + } + ] + }, + "vrf_verify": { + "name": "vrf_verify", + "code": 208, + "size": 2, + "doc": [ + "Verify the proof B of message A against pubkey C. Returns vrf output and verification flag.", + "`VrfAlgorand` is the VRF used in Algorand. It is ECVRF-ED25519-SHA512-Elligator2, specified in the IETF internet draft [draft-irtf-cfrg-vrf-03](https://datatracker.ietf.org/doc/draft-irtf-cfrg-vrf/03/)." + ], + "cost": { + "value": 5700, + "doc": "5700" + }, + "min_avm_version": 7, + "halts": false, + "mode": "any", + "groups": ["Cryptography"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "[]byte", + "doc": null + }, + { + "name": "B", + "stack_type": "[80]byte", + "doc": null + }, + { + "name": "C", + "stack_type": "[32]byte", + "doc": null + } + ], + "immediate_args": [ + { + "name": "S", + "immediate_type": "arg_enum", + "arg_enum": "vrf_verify", + "modifies_stack_input": null, + "modifies_stack_output": null, + "doc": " parameters index" + } + ], + "stack_outputs": [ + { + "name": "X", + "stack_type": "[64]byte", + "doc": null + }, + { + "name": "Y", + "stack_type": "bool", + "doc": null + } + ] + }, + "|": { + "name": "|", + "code": 25, + "size": 1, + "doc": ["A bitwise-or B"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] + }, + "||": { + "name": "||", + "code": 17, + "size": 1, + "doc": ["A is not zero or B is not zero => {0 or 1}"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + }, + { + "name": "B", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "bool", + "doc": null + } + ] + }, + "~": { + "name": "~", + "code": 28, + "size": 1, + "doc": ["bitwise invert value A"], + "cost": { + "value": 1, + "doc": "1" + }, + "min_avm_version": 1, + "halts": false, + "mode": "any", + "groups": ["Arithmetic"], + "stack_inputs": [ + { + "name": "A", + "stack_type": "uint64", + "doc": null + } + ], + "immediate_args": [], + "stack_outputs": [ + { + "name": "X", + "stack_type": "uint64", + "doc": null + } + ] } + }, + "arg_enums": { + "acct_params": [ + { + "name": "AcctBalance", + "doc": "Account balance in microalgos", + "stack_type": "uint64", + "mode": "app", + "value": 0, + "min_avm_version": 6 + }, + { + "name": "AcctMinBalance", + "doc": "Minimum required balance for account, in microalgos", + "stack_type": "uint64", + "mode": "app", + "value": 1, + "min_avm_version": 6 + }, + { + "name": "AcctAuthAddr", + "doc": "Address the account is rekeyed to.", + "stack_type": "address", + "mode": "app", + "value": 2, + "min_avm_version": 6 + }, + { + "name": "AcctTotalNumUint", + "doc": "The total number of uint64 values allocated by this account in Global and Local States.", + "stack_type": "uint64", + "mode": "app", + "value": 3, + "min_avm_version": 8 + }, + { + "name": "AcctTotalNumByteSlice", + "doc": "The total number of byte array values allocated by this account in Global and Local States.", + "stack_type": "uint64", + "mode": "app", + "value": 4, + "min_avm_version": 8 + }, + { + "name": "AcctTotalExtraAppPages", + "doc": "The number of extra app code pages used by this account.", + "stack_type": "uint64", + "mode": "app", + "value": 5, + "min_avm_version": 8 + }, + { + "name": "AcctTotalAppsCreated", + "doc": "The number of existing apps created by this account.", + "stack_type": "uint64", + "mode": "app", + "value": 6, + "min_avm_version": 8 + }, + { + "name": "AcctTotalAppsOptedIn", + "doc": "The number of apps this account is opted into.", + "stack_type": "uint64", + "mode": "app", + "value": 7, + "min_avm_version": 8 + }, + { + "name": "AcctTotalAssetsCreated", + "doc": "The number of existing ASAs created by this account.", + "stack_type": "uint64", + "mode": "app", + "value": 8, + "min_avm_version": 8 + }, + { + "name": "AcctTotalAssets", + "doc": "The numbers of ASAs held by this account (including ASAs this account created).", + "stack_type": "uint64", + "mode": "app", + "value": 9, + "min_avm_version": 8 + }, + { + "name": "AcctTotalBoxes", + "doc": "The number of existing boxes created by this account's app.", + "stack_type": "uint64", + "mode": "app", + "value": 10, + "min_avm_version": 8 + }, + { + "name": "AcctTotalBoxBytes", + "doc": "The total number of bytes used by this account's app's box keys and values.", + "stack_type": "uint64", + "mode": "app", + "value": 11, + "min_avm_version": 8 + }, + { + "name": "AcctIncentiveEligible", + "doc": "Has this account opted into block payouts", + "stack_type": "bool", + "mode": "app", + "value": 12, + "min_avm_version": 11 + }, + { + "name": "AcctLastProposed", + "doc": "The round number of the last block this account proposed.", + "stack_type": "uint64", + "mode": "app", + "value": 13, + "min_avm_version": 11 + }, + { + "name": "AcctLastHeartbeat", + "doc": "The round number of the last block this account sent a heartbeat.", + "stack_type": "uint64", + "mode": "app", + "value": 14, + "min_avm_version": 11 + } + ], + "app_params": [ + { + "name": "AppApprovalProgram", + "doc": "Bytecode of Approval Program", + "stack_type": "[]byte", + "mode": "app", + "value": 0, + "min_avm_version": 5 + }, + { + "name": "AppClearStateProgram", + "doc": "Bytecode of Clear State Program", + "stack_type": "[]byte", + "mode": "app", + "value": 1, + "min_avm_version": 5 + }, + { + "name": "AppGlobalNumUint", + "doc": "Number of uint64 values allowed in Global State", + "stack_type": "uint64", + "mode": "app", + "value": 2, + "min_avm_version": 5 + }, + { + "name": "AppGlobalNumByteSlice", + "doc": "Number of byte array values allowed in Global State", + "stack_type": "uint64", + "mode": "app", + "value": 3, + "min_avm_version": 5 + }, + { + "name": "AppLocalNumUint", + "doc": "Number of uint64 values allowed in Local State", + "stack_type": "uint64", + "mode": "app", + "value": 4, + "min_avm_version": 5 + }, + { + "name": "AppLocalNumByteSlice", + "doc": "Number of byte array values allowed in Local State", + "stack_type": "uint64", + "mode": "app", + "value": 5, + "min_avm_version": 5 + }, + { + "name": "AppExtraProgramPages", + "doc": "Number of Extra Program Pages of code space", + "stack_type": "uint64", + "mode": "app", + "value": 6, + "min_avm_version": 5 + }, + { + "name": "AppCreator", + "doc": "Creator address", + "stack_type": "address", + "mode": "app", + "value": 7, + "min_avm_version": 5 + }, + { + "name": "AppAddress", + "doc": "Address for which this application has authority", + "stack_type": "address", + "mode": "app", + "value": 8, + "min_avm_version": 5 + } + ], + "asset_holding": [ + { + "name": "AssetBalance", + "doc": "Amount of the asset unit held by this account", + "stack_type": "uint64", + "mode": "app", + "value": 0, + "min_avm_version": 2 + }, + { + "name": "AssetFrozen", + "doc": "Is the asset frozen or not", + "stack_type": "bool", + "mode": "app", + "value": 1, + "min_avm_version": 2 + } + ], + "asset_params": [ + { + "name": "AssetTotal", + "doc": "Total number of units of this asset", + "stack_type": "uint64", + "mode": "app", + "value": 0, + "min_avm_version": 2 + }, + { + "name": "AssetDecimals", + "doc": "See AssetParams.Decimals", + "stack_type": "uint64", + "mode": "app", + "value": 1, + "min_avm_version": 2 + }, + { + "name": "AssetDefaultFrozen", + "doc": "Frozen by default or not", + "stack_type": "bool", + "mode": "app", + "value": 2, + "min_avm_version": 2 + }, + { + "name": "AssetUnitName", + "doc": "Asset unit name", + "stack_type": "[]byte", + "mode": "app", + "value": 3, + "min_avm_version": 2 + }, + { + "name": "AssetName", + "doc": "Asset name", + "stack_type": "[]byte", + "mode": "app", + "value": 4, + "min_avm_version": 2 + }, + { + "name": "AssetURL", + "doc": "URL with additional info about the asset", + "stack_type": "[]byte", + "mode": "app", + "value": 5, + "min_avm_version": 2 + }, + { + "name": "AssetMetadataHash", + "doc": "Arbitrary commitment", + "stack_type": "[32]byte", + "mode": "app", + "value": 6, + "min_avm_version": 2 + }, + { + "name": "AssetManager", + "doc": "Manager address", + "stack_type": "address", + "mode": "app", + "value": 7, + "min_avm_version": 2 + }, + { + "name": "AssetReserve", + "doc": "Reserve address", + "stack_type": "address", + "mode": "app", + "value": 8, + "min_avm_version": 2 + }, + { + "name": "AssetFreeze", + "doc": "Freeze address", + "stack_type": "address", + "mode": "app", + "value": 9, + "min_avm_version": 2 + }, + { + "name": "AssetClawback", + "doc": "Clawback address", + "stack_type": "address", + "mode": "app", + "value": 10, + "min_avm_version": 2 + }, + { + "name": "AssetCreator", + "doc": "Creator address", + "stack_type": "address", + "mode": "app", + "value": 11, + "min_avm_version": 5 + } + ], + "base64": [ + { + "name": "URLEncoding", + "doc": null, + "stack_type": null, + "mode": "any", + "value": 0, + "min_avm_version": 6 + }, + { + "name": "StdEncoding", + "doc": null, + "stack_type": null, + "mode": "any", + "value": 1, + "min_avm_version": 6 + } + ], + "block": [ + { + "name": "BlkSeed", + "doc": null, + "stack_type": "[32]byte", + "mode": "any", + "value": 0, + "min_avm_version": 7 + }, + { + "name": "BlkTimestamp", + "doc": null, + "stack_type": "uint64", + "mode": "any", + "value": 1, + "min_avm_version": 7 + }, + { + "name": "BlkProposer", + "doc": null, + "stack_type": "address", + "mode": "any", + "value": 2, + "min_avm_version": 11 + }, + { + "name": "BlkFeesCollected", + "doc": null, + "stack_type": "uint64", + "mode": "any", + "value": 3, + "min_avm_version": 11 + }, + { + "name": "BlkBonus", + "doc": null, + "stack_type": "uint64", + "mode": "any", + "value": 4, + "min_avm_version": 11 + }, + { + "name": "BlkBranch", + "doc": null, + "stack_type": "[32]byte", + "mode": "any", + "value": 5, + "min_avm_version": 11 + }, + { + "name": "BlkFeeSink", + "doc": null, + "stack_type": "address", + "mode": "any", + "value": 6, + "min_avm_version": 11 + }, + { + "name": "BlkProtocol", + "doc": null, + "stack_type": "[]byte", + "mode": "any", + "value": 7, + "min_avm_version": 11 + }, + { + "name": "BlkTxnCounter", + "doc": null, + "stack_type": "uint64", + "mode": "any", + "value": 8, + "min_avm_version": 11 + }, + { + "name": "BlkProposerPayout", + "doc": null, + "stack_type": "uint64", + "mode": "any", + "value": 9, + "min_avm_version": 11 + } + ], + "EC": [ + { + "name": "BN254g1", + "doc": "G1 of the BN254 curve. Points encoded as 32 byte X following by 32 byte Y", + "stack_type": null, + "mode": "any", + "value": 0, + "min_avm_version": 10 + }, + { + "name": "BN254g2", + "doc": "G2 of the BN254 curve. Points encoded as 64 byte X following by 64 byte Y", + "stack_type": null, + "mode": "any", + "value": 1, + "min_avm_version": 10 + }, + { + "name": "BLS12_381g1", + "doc": "G1 of the BLS 12-381 curve. Points encoded as 48 byte X following by 48 byte Y", + "stack_type": null, + "mode": "any", + "value": 2, + "min_avm_version": 10 + }, + { + "name": "BLS12_381g2", + "doc": "G2 of the BLS 12-381 curve. Points encoded as 96 byte X following by 96 byte Y", + "stack_type": null, + "mode": "any", + "value": 3, + "min_avm_version": 10 + } + ], + "ECDSA": [ + { + "name": "Secp256k1", + "doc": "secp256k1 curve, used in Bitcoin", + "stack_type": null, + "mode": "any", + "value": 0, + "min_avm_version": 5 + }, + { + "name": "Secp256r1", + "doc": "secp256r1 curve, NIST standard", + "stack_type": null, + "mode": "any", + "value": 1, + "min_avm_version": 7 + } + ], + "txn": [ + { + "name": "Sender", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 0, + "min_avm_version": 0 + }, + { + "name": "Fee", + "doc": "microalgos", + "stack_type": "uint64", + "mode": "any", + "value": 1, + "min_avm_version": 0 + }, + { + "name": "FirstValid", + "doc": "round number", + "stack_type": "uint64", + "mode": "any", + "value": 2, + "min_avm_version": 0 + }, + { + "name": "FirstValidTime", + "doc": "UNIX timestamp of block before txn.FirstValid. Fails if negative", + "stack_type": "uint64", + "mode": "any", + "value": 3, + "min_avm_version": 7 + }, + { + "name": "LastValid", + "doc": "round number", + "stack_type": "uint64", + "mode": "any", + "value": 4, + "min_avm_version": 0 + }, + { + "name": "Note", + "doc": "Any data up to 1024 bytes", + "stack_type": "[]byte", + "mode": "any", + "value": 5, + "min_avm_version": 0 + }, + { + "name": "Lease", + "doc": "32 byte lease value", + "stack_type": "[32]byte", + "mode": "any", + "value": 6, + "min_avm_version": 0 + }, + { + "name": "Receiver", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 7, + "min_avm_version": 0 + }, + { + "name": "Amount", + "doc": "microalgos", + "stack_type": "uint64", + "mode": "any", + "value": 8, + "min_avm_version": 0 + }, + { + "name": "CloseRemainderTo", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 9, + "min_avm_version": 0 + }, + { + "name": "VotePK", + "doc": "32 byte address", + "stack_type": "[32]byte", + "mode": "any", + "value": 10, + "min_avm_version": 0 + }, + { + "name": "SelectionPK", + "doc": "32 byte address", + "stack_type": "[32]byte", + "mode": "any", + "value": 11, + "min_avm_version": 0 + }, + { + "name": "VoteFirst", + "doc": "The first round that the participation key is valid.", + "stack_type": "uint64", + "mode": "any", + "value": 12, + "min_avm_version": 0 + }, + { + "name": "VoteLast", + "doc": "The last round that the participation key is valid.", + "stack_type": "uint64", + "mode": "any", + "value": 13, + "min_avm_version": 0 + }, + { + "name": "VoteKeyDilution", + "doc": "Dilution for the 2-level participation key", + "stack_type": "uint64", + "mode": "any", + "value": 14, + "min_avm_version": 0 + }, + { + "name": "Type", + "doc": "Transaction type as bytes", + "stack_type": "[]byte", + "mode": "any", + "value": 15, + "min_avm_version": 0 + }, + { + "name": "TypeEnum", + "doc": "Transaction type as integer", + "stack_type": "uint64", + "mode": "any", + "value": 16, + "min_avm_version": 0 + }, + { + "name": "XferAsset", + "doc": "Asset ID", + "stack_type": "asset", + "mode": "any", + "value": 17, + "min_avm_version": 0 + }, + { + "name": "AssetAmount", + "doc": "value in Asset's units", + "stack_type": "uint64", + "mode": "any", + "value": 18, + "min_avm_version": 0 + }, + { + "name": "AssetSender", + "doc": "32 byte address. Source of assets if Sender is the Asset's Clawback address.", + "stack_type": "address", + "mode": "any", + "value": 19, + "min_avm_version": 0 + }, + { + "name": "AssetReceiver", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 20, + "min_avm_version": 0 + }, + { + "name": "AssetCloseTo", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 21, + "min_avm_version": 0 + }, + { + "name": "GroupIndex", + "doc": "Position of this transaction within an atomic transaction group. A stand-alone transaction is implicitly element 0 in a group of 1", + "stack_type": "uint64", + "mode": "any", + "value": 22, + "min_avm_version": 0 + }, + { + "name": "TxID", + "doc": "The computed ID for this transaction. 32 bytes.", + "stack_type": "[32]byte", + "mode": "any", + "value": 23, + "min_avm_version": 0 + }, + { + "name": "ApplicationID", + "doc": "ApplicationID from ApplicationCall transaction", + "stack_type": "application", + "mode": "any", + "value": 24, + "min_avm_version": 2 + }, + { + "name": "OnCompletion", + "doc": "ApplicationCall transaction on completion action", + "stack_type": "uint64", + "mode": "any", + "value": 25, + "min_avm_version": 2 + }, + { + "name": "ApplicationArgs", + "doc": "Arguments passed to the application in the ApplicationCall transaction", + "stack_type": "[]byte", + "mode": "any", + "value": 26, + "min_avm_version": 2 + }, + { + "name": "NumAppArgs", + "doc": "Number of ApplicationArgs", + "stack_type": "uint64", + "mode": "any", + "value": 27, + "min_avm_version": 2 + }, + { + "name": "Accounts", + "doc": "Accounts listed in the ApplicationCall transaction", + "stack_type": "address", + "mode": "any", + "value": 28, + "min_avm_version": 2 + }, + { + "name": "NumAccounts", + "doc": "Number of Accounts", + "stack_type": "uint64", + "mode": "any", + "value": 29, + "min_avm_version": 2 + }, + { + "name": "ApprovalProgram", + "doc": "Approval program", + "stack_type": "[]byte", + "mode": "any", + "value": 30, + "min_avm_version": 2 + }, + { + "name": "ClearStateProgram", + "doc": "Clear state program", + "stack_type": "[]byte", + "mode": "any", + "value": 31, + "min_avm_version": 2 + }, + { + "name": "RekeyTo", + "doc": "32 byte Sender's new AuthAddr", + "stack_type": "address", + "mode": "any", + "value": 32, + "min_avm_version": 2 + }, + { + "name": "ConfigAsset", + "doc": "Asset ID in asset config transaction", + "stack_type": "asset", + "mode": "any", + "value": 33, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetTotal", + "doc": "Total number of units of this asset created", + "stack_type": "uint64", + "mode": "any", + "value": 34, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetDecimals", + "doc": "Number of digits to display after the decimal place when displaying the asset", + "stack_type": "uint64", + "mode": "any", + "value": 35, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetDefaultFrozen", + "doc": "Whether the asset's slots are frozen by default or not, 0 or 1", + "stack_type": "bool", + "mode": "any", + "value": 36, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetUnitName", + "doc": "Unit name of the asset", + "stack_type": "[]byte", + "mode": "any", + "value": 37, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetName", + "doc": "The asset name", + "stack_type": "[]byte", + "mode": "any", + "value": 38, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetURL", + "doc": "URL", + "stack_type": "[]byte", + "mode": "any", + "value": 39, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetMetadataHash", + "doc": "32 byte commitment to unspecified asset metadata", + "stack_type": "[32]byte", + "mode": "any", + "value": 40, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetManager", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 41, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetReserve", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 42, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetFreeze", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 43, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetClawback", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 44, + "min_avm_version": 2 + }, + { + "name": "FreezeAsset", + "doc": "Asset ID being frozen or un-frozen", + "stack_type": "asset", + "mode": "any", + "value": 45, + "min_avm_version": 2 + }, + { + "name": "FreezeAssetAccount", + "doc": "32 byte address of the account whose asset slot is being frozen or un-frozen", + "stack_type": "address", + "mode": "any", + "value": 46, + "min_avm_version": 2 + }, + { + "name": "FreezeAssetFrozen", + "doc": "The new frozen value, 0 or 1", + "stack_type": "bool", + "mode": "any", + "value": 47, + "min_avm_version": 2 + }, + { + "name": "Assets", + "doc": "Foreign Assets listed in the ApplicationCall transaction", + "stack_type": "uint64", + "mode": "any", + "value": 48, + "min_avm_version": 3 + }, + { + "name": "NumAssets", + "doc": "Number of Assets", + "stack_type": "uint64", + "mode": "any", + "value": 49, + "min_avm_version": 3 + }, + { + "name": "Applications", + "doc": "Foreign Apps listed in the ApplicationCall transaction", + "stack_type": "uint64", + "mode": "any", + "value": 50, + "min_avm_version": 3 + }, + { + "name": "NumApplications", + "doc": "Number of Applications", + "stack_type": "uint64", + "mode": "any", + "value": 51, + "min_avm_version": 3 + }, + { + "name": "GlobalNumUint", + "doc": "Number of global state integers in ApplicationCall", + "stack_type": "uint64", + "mode": "any", + "value": 52, + "min_avm_version": 3 + }, + { + "name": "GlobalNumByteSlice", + "doc": "Number of global state byteslices in ApplicationCall", + "stack_type": "uint64", + "mode": "any", + "value": 53, + "min_avm_version": 3 + }, + { + "name": "LocalNumUint", + "doc": "Number of local state integers in ApplicationCall", + "stack_type": "uint64", + "mode": "any", + "value": 54, + "min_avm_version": 3 + }, + { + "name": "LocalNumByteSlice", + "doc": "Number of local state byteslices in ApplicationCall", + "stack_type": "uint64", + "mode": "any", + "value": 55, + "min_avm_version": 3 + }, + { + "name": "ExtraProgramPages", + "doc": "Number of additional pages for each of the application's approval and clear state programs. An ExtraProgramPages of 1 means 2048 more total bytes, or 1024 for each program.", + "stack_type": "uint64", + "mode": "any", + "value": 56, + "min_avm_version": 4 + }, + { + "name": "Nonparticipation", + "doc": "Marks an account nonparticipating for rewards", + "stack_type": "bool", + "mode": "any", + "value": 57, + "min_avm_version": 5 + }, + { + "name": "Logs", + "doc": "Log messages emitted by an application call (only with `itxn` in v5). Application mode only", + "stack_type": "[]byte", + "mode": "app", + "value": 58, + "min_avm_version": 5 + }, + { + "name": "NumLogs", + "doc": "Number of Logs (only with `itxn` in v5). Application mode only", + "stack_type": "uint64", + "mode": "app", + "value": 59, + "min_avm_version": 5 + }, + { + "name": "CreatedAssetID", + "doc": "Asset ID allocated by the creation of an ASA (only with `itxn` in v5). Application mode only", + "stack_type": "asset", + "mode": "app", + "value": 60, + "min_avm_version": 5 + }, + { + "name": "CreatedApplicationID", + "doc": "ApplicationID allocated by the creation of an application (only with `itxn` in v5). Application mode only", + "stack_type": "application", + "mode": "app", + "value": 61, + "min_avm_version": 5 + }, + { + "name": "LastLog", + "doc": "The last message emitted. Empty bytes if none were emitted. Application mode only", + "stack_type": "[]byte", + "mode": "app", + "value": 62, + "min_avm_version": 6 + }, + { + "name": "StateProofPK", + "doc": "64 byte state proof public key", + "stack_type": "[]byte", + "mode": "any", + "value": 63, + "min_avm_version": 6 + }, + { + "name": "ApprovalProgramPages", + "doc": "Approval Program as an array of pages", + "stack_type": "[]byte", + "mode": "any", + "value": 64, + "min_avm_version": 7 + }, + { + "name": "NumApprovalProgramPages", + "doc": "Number of Approval Program pages", + "stack_type": "uint64", + "mode": "any", + "value": 65, + "min_avm_version": 7 + }, + { + "name": "ClearStateProgramPages", + "doc": "ClearState Program as an array of pages", + "stack_type": "[]byte", + "mode": "any", + "value": 66, + "min_avm_version": 7 + }, + { + "name": "NumClearStateProgramPages", + "doc": "Number of ClearState Program pages", + "stack_type": "uint64", + "mode": "any", + "value": 67, + "min_avm_version": 7 + } + ], + "txna": [ + { + "name": "ApplicationArgs", + "doc": "Arguments passed to the application in the ApplicationCall transaction", + "stack_type": "[]byte", + "mode": "any", + "value": 26, + "min_avm_version": 2 + }, + { + "name": "Accounts", + "doc": "Accounts listed in the ApplicationCall transaction", + "stack_type": "address", + "mode": "any", + "value": 28, + "min_avm_version": 2 + }, + { + "name": "Assets", + "doc": "Foreign Assets listed in the ApplicationCall transaction", + "stack_type": "asset", + "mode": "any", + "value": 48, + "min_avm_version": 3 + }, + { + "name": "Applications", + "doc": "Foreign Apps listed in the ApplicationCall transaction", + "stack_type": "application", + "mode": "any", + "value": 50, + "min_avm_version": 3 + }, + { + "name": "Logs", + "doc": "Log messages emitted by an application call (only with `itxn` in v5). Application mode only", + "stack_type": "[]byte", + "mode": "app", + "value": 58, + "min_avm_version": 5 + }, + { + "name": "ApprovalProgramPages", + "doc": "Approval Program as an array of pages", + "stack_type": "[]byte", + "mode": "any", + "value": 64, + "min_avm_version": 7 + }, + { + "name": "ClearStateProgramPages", + "doc": "ClearState Program as an array of pages", + "stack_type": "[]byte", + "mode": "any", + "value": 66, + "min_avm_version": 7 + } + ], + "global": [ + { + "name": "MinTxnFee", + "doc": "microalgos", + "stack_type": "uint64", + "mode": "any", + "value": 0, + "min_avm_version": 0 + }, + { + "name": "MinBalance", + "doc": "microalgos", + "stack_type": "uint64", + "mode": "any", + "value": 1, + "min_avm_version": 0 + }, + { + "name": "MaxTxnLife", + "doc": "rounds", + "stack_type": "uint64", + "mode": "any", + "value": 2, + "min_avm_version": 0 + }, + { + "name": "ZeroAddress", + "doc": "32 byte address of all zero bytes", + "stack_type": "address", + "mode": "any", + "value": 3, + "min_avm_version": 0 + }, + { + "name": "GroupSize", + "doc": "Number of transactions in this atomic transaction group. At least 1", + "stack_type": "uint64", + "mode": "any", + "value": 4, + "min_avm_version": 0 + }, + { + "name": "LogicSigVersion", + "doc": "Maximum supported version", + "stack_type": "uint64", + "mode": "any", + "value": 5, + "min_avm_version": 2 + }, + { + "name": "Round", + "doc": "Current round number. Application mode only.", + "stack_type": "uint64", + "mode": "app", + "value": 6, + "min_avm_version": 2 + }, + { + "name": "LatestTimestamp", + "doc": "Last confirmed block UNIX timestamp. Fails if negative. Application mode only.", + "stack_type": "uint64", + "mode": "app", + "value": 7, + "min_avm_version": 2 + }, + { + "name": "CurrentApplicationID", + "doc": "ID of current application executing. Application mode only.", + "stack_type": "application", + "mode": "app", + "value": 8, + "min_avm_version": 2 + }, + { + "name": "CreatorAddress", + "doc": "Address of the creator of the current application. Application mode only.", + "stack_type": "address", + "mode": "app", + "value": 9, + "min_avm_version": 3 + }, + { + "name": "CurrentApplicationAddress", + "doc": "Address that the current application controls. Application mode only.", + "stack_type": "address", + "mode": "app", + "value": 10, + "min_avm_version": 5 + }, + { + "name": "GroupID", + "doc": "ID of the transaction group. 32 zero bytes if the transaction is not part of a group.", + "stack_type": "[32]byte", + "mode": "any", + "value": 11, + "min_avm_version": 5 + }, + { + "name": "OpcodeBudget", + "doc": "The remaining cost that can be spent by opcodes in this program.", + "stack_type": "uint64", + "mode": "any", + "value": 12, + "min_avm_version": 6 + }, + { + "name": "CallerApplicationID", + "doc": "The application ID of the application that called this application. 0 if this application is at the top-level. Application mode only.", + "stack_type": "uint64", + "mode": "app", + "value": 13, + "min_avm_version": 6 + }, + { + "name": "CallerApplicationAddress", + "doc": "The application address of the application that called this application. ZeroAddress if this application is at the top-level. Application mode only.", + "stack_type": "address", + "mode": "app", + "value": 14, + "min_avm_version": 6 + }, + { + "name": "AssetCreateMinBalance", + "doc": "The additional minimum balance required to create (and opt-in to) an asset.", + "stack_type": "uint64", + "mode": "any", + "value": 15, + "min_avm_version": 10 + }, + { + "name": "AssetOptInMinBalance", + "doc": "The additional minimum balance required to opt-in to an asset.", + "stack_type": "uint64", + "mode": "any", + "value": 16, + "min_avm_version": 10 + }, + { + "name": "GenesisHash", + "doc": "The Genesis Hash for the network.", + "stack_type": "[32]byte", + "mode": "any", + "value": 17, + "min_avm_version": 10 + }, + { + "name": "PayoutsEnabled", + "doc": "Whether block proposal payouts are enabled.", + "stack_type": "bool", + "mode": "any", + "value": 18, + "min_avm_version": 11 + }, + { + "name": "PayoutsGoOnlineFee", + "doc": "The fee required in a keyreg transaction to make an account incentive eligible.", + "stack_type": "uint64", + "mode": "any", + "value": 19, + "min_avm_version": 11 + }, + { + "name": "PayoutsPercent", + "doc": "The percentage of transaction fees in a block that can be paid to the block proposer.", + "stack_type": "uint64", + "mode": "any", + "value": 20, + "min_avm_version": 11 + }, + { + "name": "PayoutsMinBalance", + "doc": "The minimum algo balance an account must have in the agreement round to receive block payouts in the proposal round.", + "stack_type": "uint64", + "mode": "any", + "value": 21, + "min_avm_version": 11 + }, + { + "name": "PayoutsMaxBalance", + "doc": "The maximum algo balance an account can have in the agreement round to receive block payouts in the proposal round.", + "stack_type": "uint64", + "mode": "any", + "value": 22, + "min_avm_version": 11 + } + ], + "itxn_field": [ + { + "name": "Sender", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 0, + "min_avm_version": 0 + }, + { + "name": "Fee", + "doc": "microalgos", + "stack_type": "uint64", + "mode": "any", + "value": 1, + "min_avm_version": 0 + }, + { + "name": "Note", + "doc": "Any data up to 1024 bytes", + "stack_type": "[]byte", + "mode": "any", + "value": 5, + "min_avm_version": 0 + }, + { + "name": "Receiver", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 7, + "min_avm_version": 0 + }, + { + "name": "Amount", + "doc": "microalgos", + "stack_type": "uint64", + "mode": "any", + "value": 8, + "min_avm_version": 0 + }, + { + "name": "CloseRemainderTo", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 9, + "min_avm_version": 0 + }, + { + "name": "VotePK", + "doc": "32 byte address", + "stack_type": "[32]byte", + "mode": "any", + "value": 10, + "min_avm_version": 0 + }, + { + "name": "SelectionPK", + "doc": "32 byte address", + "stack_type": "[32]byte", + "mode": "any", + "value": 11, + "min_avm_version": 0 + }, + { + "name": "VoteFirst", + "doc": "The first round that the participation key is valid.", + "stack_type": "uint64", + "mode": "any", + "value": 12, + "min_avm_version": 0 + }, + { + "name": "VoteLast", + "doc": "The last round that the participation key is valid.", + "stack_type": "uint64", + "mode": "any", + "value": 13, + "min_avm_version": 0 + }, + { + "name": "VoteKeyDilution", + "doc": "Dilution for the 2-level participation key", + "stack_type": "uint64", + "mode": "any", + "value": 14, + "min_avm_version": 0 + }, + { + "name": "Type", + "doc": "Transaction type as bytes", + "stack_type": "[]byte", + "mode": "any", + "value": 15, + "min_avm_version": 0 + }, + { + "name": "TypeEnum", + "doc": "Transaction type as integer", + "stack_type": "uint64", + "mode": "any", + "value": 16, + "min_avm_version": 0 + }, + { + "name": "XferAsset", + "doc": "Asset ID", + "stack_type": "asset", + "mode": "any", + "value": 17, + "min_avm_version": 0 + }, + { + "name": "AssetAmount", + "doc": "value in Asset's units", + "stack_type": "uint64", + "mode": "any", + "value": 18, + "min_avm_version": 0 + }, + { + "name": "AssetSender", + "doc": "32 byte address. Source of assets if Sender is the Asset's Clawback address.", + "stack_type": "address", + "mode": "any", + "value": 19, + "min_avm_version": 0 + }, + { + "name": "AssetReceiver", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 20, + "min_avm_version": 0 + }, + { + "name": "AssetCloseTo", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 21, + "min_avm_version": 0 + }, + { + "name": "ApplicationID", + "doc": "ApplicationID from ApplicationCall transaction", + "stack_type": "application", + "mode": "any", + "value": 24, + "min_avm_version": 2 + }, + { + "name": "OnCompletion", + "doc": "ApplicationCall transaction on completion action", + "stack_type": "uint64", + "mode": "any", + "value": 25, + "min_avm_version": 2 + }, + { + "name": "ApplicationArgs", + "doc": "Arguments passed to the application in the ApplicationCall transaction", + "stack_type": "[]byte", + "mode": "any", + "value": 26, + "min_avm_version": 2 + }, + { + "name": "Accounts", + "doc": "Accounts listed in the ApplicationCall transaction", + "stack_type": "address", + "mode": "any", + "value": 28, + "min_avm_version": 2 + }, + { + "name": "ApprovalProgram", + "doc": "Approval program", + "stack_type": "[]byte", + "mode": "any", + "value": 30, + "min_avm_version": 2 + }, + { + "name": "ClearStateProgram", + "doc": "Clear state program", + "stack_type": "[]byte", + "mode": "any", + "value": 31, + "min_avm_version": 2 + }, + { + "name": "RekeyTo", + "doc": "32 byte Sender's new AuthAddr", + "stack_type": "address", + "mode": "any", + "value": 32, + "min_avm_version": 2 + }, + { + "name": "ConfigAsset", + "doc": "Asset ID in asset config transaction", + "stack_type": "asset", + "mode": "any", + "value": 33, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetTotal", + "doc": "Total number of units of this asset created", + "stack_type": "uint64", + "mode": "any", + "value": 34, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetDecimals", + "doc": "Number of digits to display after the decimal place when displaying the asset", + "stack_type": "uint64", + "mode": "any", + "value": 35, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetDefaultFrozen", + "doc": "Whether the asset's slots are frozen by default or not, 0 or 1", + "stack_type": "bool", + "mode": "any", + "value": 36, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetUnitName", + "doc": "Unit name of the asset", + "stack_type": "[]byte", + "mode": "any", + "value": 37, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetName", + "doc": "The asset name", + "stack_type": "[]byte", + "mode": "any", + "value": 38, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetURL", + "doc": "URL", + "stack_type": "[]byte", + "mode": "any", + "value": 39, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetMetadataHash", + "doc": "32 byte commitment to unspecified asset metadata", + "stack_type": "[32]byte", + "mode": "any", + "value": 40, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetManager", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 41, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetReserve", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 42, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetFreeze", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 43, + "min_avm_version": 2 + }, + { + "name": "ConfigAssetClawback", + "doc": "32 byte address", + "stack_type": "address", + "mode": "any", + "value": 44, + "min_avm_version": 2 + }, + { + "name": "FreezeAsset", + "doc": "Asset ID being frozen or un-frozen", + "stack_type": "asset", + "mode": "any", + "value": 45, + "min_avm_version": 2 + }, + { + "name": "FreezeAssetAccount", + "doc": "32 byte address of the account whose asset slot is being frozen or un-frozen", + "stack_type": "address", + "mode": "any", + "value": 46, + "min_avm_version": 2 + }, + { + "name": "FreezeAssetFrozen", + "doc": "The new frozen value, 0 or 1", + "stack_type": "bool", + "mode": "any", + "value": 47, + "min_avm_version": 2 + }, + { + "name": "Assets", + "doc": "Foreign Assets listed in the ApplicationCall transaction", + "stack_type": "uint64", + "mode": "any", + "value": 48, + "min_avm_version": 3 + }, + { + "name": "Applications", + "doc": "Foreign Apps listed in the ApplicationCall transaction", + "stack_type": "uint64", + "mode": "any", + "value": 50, + "min_avm_version": 3 + }, + { + "name": "GlobalNumUint", + "doc": "Number of global state integers in ApplicationCall", + "stack_type": "uint64", + "mode": "any", + "value": 52, + "min_avm_version": 3 + }, + { + "name": "GlobalNumByteSlice", + "doc": "Number of global state byteslices in ApplicationCall", + "stack_type": "uint64", + "mode": "any", + "value": 53, + "min_avm_version": 3 + }, + { + "name": "LocalNumUint", + "doc": "Number of local state integers in ApplicationCall", + "stack_type": "uint64", + "mode": "any", + "value": 54, + "min_avm_version": 3 + }, + { + "name": "LocalNumByteSlice", + "doc": "Number of local state byteslices in ApplicationCall", + "stack_type": "uint64", + "mode": "any", + "value": 55, + "min_avm_version": 3 + }, + { + "name": "ExtraProgramPages", + "doc": "Number of additional pages for each of the application's approval and clear state programs. An ExtraProgramPages of 1 means 2048 more total bytes, or 1024 for each program.", + "stack_type": "uint64", + "mode": "any", + "value": 56, + "min_avm_version": 4 + }, + { + "name": "Nonparticipation", + "doc": "Marks an account nonparticipating for rewards", + "stack_type": "bool", + "mode": "any", + "value": 57, + "min_avm_version": 5 + }, + { + "name": "StateProofPK", + "doc": "64 byte state proof public key", + "stack_type": "[]byte", + "mode": "any", + "value": 63, + "min_avm_version": 6 + }, + { + "name": "ApprovalProgramPages", + "doc": "Approval Program as an array of pages", + "stack_type": "[]byte", + "mode": "any", + "value": 64, + "min_avm_version": 7 + }, + { + "name": "ClearStateProgramPages", + "doc": "ClearState Program as an array of pages", + "stack_type": "[]byte", + "mode": "any", + "value": 66, + "min_avm_version": 7 + } + ], + "json_ref": [ + { + "name": "JSONString", + "doc": null, + "stack_type": "[]byte", + "mode": "any", + "value": 0, + "min_avm_version": 7 + }, + { + "name": "JSONUint64", + "doc": null, + "stack_type": "uint64", + "mode": "any", + "value": 1, + "min_avm_version": 7 + }, + { + "name": "JSONObject", + "doc": null, + "stack_type": "[]byte", + "mode": "any", + "value": 2, + "min_avm_version": 7 + } + ], + "voter_params": [ + { + "name": "VoterBalance", + "doc": "Online stake in microalgos", + "stack_type": "uint64", + "mode": "app", + "value": 0, + "min_avm_version": 6 + }, + { + "name": "VoterIncentiveEligible", + "doc": "Had this account opted into block payouts", + "stack_type": "bool", + "mode": "app", + "value": 1, + "min_avm_version": 11 + } + ], + "vrf_verify": [ + { + "name": "VrfAlgorand", + "doc": null, + "stack_type": null, + "mode": "any", + "value": 0, + "min_avm_version": 7 + } + ] + } } diff --git a/package-lock.json b/package-lock.json index c6ec7993..218577eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13486,7 +13486,7 @@ }, "packages/algo-ts/dist": { "name": "@algorandfoundation/algorand-typescript", - "version": "0.0.1-alpha.17", + "version": "0.0.1-alpha.18", "dev": true, "peerDependencies": { "tslib": "^2.6.2" diff --git a/package.json b/package.json index dd7365c0..3ff0a0ce 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "dev:examples": "tsx src/cli.ts build examples --output-awst --output-awst-json", "dev:approvals": "rimraf tests/approvals/out && tsx src/cli.ts build tests/approvals --dry-run", "dev:expected-output": "tsx src/cli.ts build tests/expected-output --dry-run", - "dev:testing": "tsx src/cli.ts build tests/approvals/arc28-events.algo.ts --output-awst --output-awst-json --output-ssa-ir --log-level=info --out-dir out/[name] --optimization-level=0", + "dev:testing": "tsx src/cli.ts build tests/approvals/avm11.algo.ts --output-awst --output-awst-json --output-ssa-ir --log-level=info --out-dir out/[name] --optimization-level=0", "audit": "better-npm-audit audit", "format": "prettier --write .", "lint": "eslint \"src/**/*.ts\"", diff --git a/packages/algo-ts/package.json b/packages/algo-ts/package.json index 2a68d357..ef383b80 100644 --- a/packages/algo-ts/package.json +++ b/packages/algo-ts/package.json @@ -1,6 +1,6 @@ { "name": "@algorandfoundation/algorand-typescript", - "version": "0.0.1-alpha.17", + "version": "0.0.1-alpha.18", "description": "This package contains definitions for the types which comprise Algorand TypeScript which can be compiled to run on the Algorand Virtual Machine using the Puya compiler.", "private": false, "main": "index.js", diff --git a/packages/algo-ts/src/base-contract.ts b/packages/algo-ts/src/base-contract.ts index 472c72b5..9f9009ed 100644 --- a/packages/algo-ts/src/base-contract.ts +++ b/packages/algo-ts/src/base-contract.ts @@ -1,4 +1,6 @@ +import { Contract } from './arc4' import { uint64 } from './primitives' +import { ConstructorFor } from './typescript-helpers' export abstract class BaseContract { public abstract approvalProgram(): boolean | uint64 @@ -6,3 +8,69 @@ export abstract class BaseContract { return true } } + +type NumberRange = { from: number; to: number } + +/** + * Options class to manually define the total amount of global and local state contract will use. + * + * This is not required when all state is assigned to `this.`, but is required if a + * contract dynamically interacts with state via `AppGlobal.getBytes` etc, or if you want + * to reserve additional state storage for future contract updates, since the Algorand protocol + * doesn't allow increasing them after creation. + */ +type StateTotals = { + globalUints?: number + globalBytes?: number + localUints?: number + localBytes?: number +} + +type ContractOptions = { + /** + * Determines which AVM version to use, this affects what operations are supported. + * Defaults to value provided supplied on command line (which defaults to current mainnet version) + */ + avmVersion?: 10 | 11 + + /** + * Override the name of the logic signature when generating build artifacts. + * Defaults to the class name + */ + name?: string + /** + * Allows you to mark a slot ID or range of slot IDs as "off limits" to Puya. + * These slot ID(s) will never be written to or otherwise manipulating by the compiler itself. + * This is particularly useful in combination with `op.gload_bytes` / `op.gload_uint64` + * which lets a contract in a group transaction read from the scratch slots of another contract + * that occurs earlier in the transaction group. + * + * In the case of inheritance, scratch slots reserved become cumulative. It is not an error + * to have overlapping ranges or values either, so if a base class contract reserves slots + * 0-5 inclusive and the derived contract reserves 5-10 inclusive, then within the derived + * contract all slots 0-10 will be marked as reserved. + */ + scratchSlots?: Array + /** + * Allows defining what values should be used for global and local uint and bytes storage + * values when creating a contract. Used when outputting ARC-32 application.json schemas. + * + * If let unspecified, the totals will be determined by the compiler based on state + * variables assigned to `this`. + * + * This setting is not inherited, and only applies to the exact `Contract` it is specified + * on. If a base class does specify this setting, and a derived class does not, a warning + * will be emitted for the derived class. To resolve this warning, `state_totals` must be + * specified. An empty object may be provided in order to indicate that this contract should + * revert to the default behaviour + */ + stateTotals?: StateTotals +} + +/** + * The contract decorator can be used to specify additional configuration options for a smart contract + * @param options An object containing the configuration options + */ +export function contract(options: ContractOptions) { + return (contract: ConstructorFor) => contract +} diff --git a/packages/algo-ts/src/index.ts b/packages/algo-ts/src/index.ts index 5d78b7d4..e02f1471 100644 --- a/packages/algo-ts/src/index.ts +++ b/packages/algo-ts/src/index.ts @@ -6,13 +6,13 @@ export { Txn, Global } from './op' export * as internal from './internal' export * as arc4 from './arc4' export { Contract, abimethod } from './arc4' -export { BaseContract } from './base-contract' +export { BaseContract, contract } from './base-contract' export { BoxRef, BoxMap, Box } from './box' export * from './state' export * as itxn from './itxn' export * as gtxn from './gtxn' export { TransactionType } from './transactions' -export { LogicSig } from './logic-sig' +export { LogicSig, logicsig } from './logic-sig' export { TemplateVar } from './template-var' export { Base64, Ec, Ecdsa, VrfVerify } from './op-types' export { compile, CompiledContract, CompiledLogicSig } from './compiled' diff --git a/packages/algo-ts/src/logic-sig.ts b/packages/algo-ts/src/logic-sig.ts index 269b052d..50331a22 100644 --- a/packages/algo-ts/src/logic-sig.ts +++ b/packages/algo-ts/src/logic-sig.ts @@ -1,5 +1,30 @@ import { uint64 } from './primitives' +import { ConstructorFor } from './typescript-helpers' export abstract class LogicSig { abstract program(): boolean | uint64 } + +/** + * Defines optional configuration for a logic signature + */ +type LogicSigOptions = { + /** + * Determines which AVM version to use, this affects what operations are supported. + * Defaults to value provided supplied on command line (which defaults to current mainnet version) + */ + avmVersion?: 10 | 11 + /** + * Override the name of the logic signature when generating build artifacts. + * Defaults to the class name + */ + name?: string +} + +/** + * The logicsig decorator can be used to specify additional configuration options for a logic signature + * @param options An object containing the configuration options + */ +export function logicsig(options: LogicSigOptions) { + return (logicSig: ConstructorFor) => logicSig +} diff --git a/packages/algo-ts/src/op-types.ts b/packages/algo-ts/src/op-types.ts index 3f2c48a0..87e8615e 100644 --- a/packages/algo-ts/src/op-types.ts +++ b/packages/algo-ts/src/op-types.ts @@ -18,68 +18,99 @@ export enum VrfVerify { export type AcctParamsType = { /** * Account balance in microalgos + * Min AVM version: 6 */ acctBalance(a: Account | uint64): readonly [uint64, boolean] /** * Minimum required balance for account, in microalgos + * Min AVM version: 6 */ acctMinBalance(a: Account | uint64): readonly [uint64, boolean] /** * Address the account is rekeyed to. + * Min AVM version: 6 */ acctAuthAddr(a: Account | uint64): readonly [Account, boolean] /** * The total number of uint64 values allocated by this account in Global and Local States. + * Min AVM version: 6 */ acctTotalNumUint(a: Account | uint64): readonly [uint64, boolean] /** * The total number of byte array values allocated by this account in Global and Local States. + * Min AVM version: 6 */ acctTotalNumByteSlice(a: Account | uint64): readonly [uint64, boolean] /** * The number of extra app code pages used by this account. + * Min AVM version: 6 */ acctTotalExtraAppPages(a: Account | uint64): readonly [uint64, boolean] /** * The number of existing apps created by this account. + * Min AVM version: 6 */ acctTotalAppsCreated(a: Account | uint64): readonly [uint64, boolean] /** * The number of apps this account is opted into. + * Min AVM version: 6 */ acctTotalAppsOptedIn(a: Account | uint64): readonly [uint64, boolean] /** * The number of existing ASAs created by this account. + * Min AVM version: 6 */ acctTotalAssetsCreated(a: Account | uint64): readonly [uint64, boolean] /** * The numbers of ASAs held by this account (including ASAs this account created). + * Min AVM version: 6 */ acctTotalAssets(a: Account | uint64): readonly [uint64, boolean] /** * The number of existing boxes created by this account's app. + * Min AVM version: 6 */ acctTotalBoxes(a: Account | uint64): readonly [uint64, boolean] /** * The total number of bytes used by this account's app's box keys and values. + * Min AVM version: 6 */ acctTotalBoxBytes(a: Account | uint64): readonly [uint64, boolean] + + /** + * Has this account opted into block payouts + * Min AVM version: 6 + */ + acctIncentiveEligible(a: Account | uint64): readonly [boolean, boolean] + + /** + * The round number of the last block this account proposed. + * Min AVM version: 6 + */ + acctLastProposed(a: Account | uint64): readonly [uint64, boolean] + + /** + * The round number of the last block this account sent a heartbeat. + * Min AVM version: 6 + */ + acctLastHeartbeat(a: Account | uint64): readonly [uint64, boolean] } /** * A plus B as a 128-bit result. X is the carry-bit, Y is the low-order 64 bits. * @see Native TEAL opcode: [`addw`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#addw) + * Min AVM version: 2 */ export type AddwType = (a: uint64, b: uint64) => readonly [uint64, uint64] @@ -92,6 +123,7 @@ export type AppGlobalType = { * @param state key. * Deleting a key which is already absent has no effect on the application global state. (In particular, it does _not_ cause the program to fail.) * @see Native TEAL opcode: [`app_global_del`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#app_global_del) + * Min AVM version: 2 */ delete(a: bytes): void @@ -100,6 +132,7 @@ export type AppGlobalType = { * @param state key. * * @return value. The value is zero (of type uint64) if the key does not exist. * @see Native TEAL opcode: [`app_global_get`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#app_global_get) + * Min AVM version: 2 */ getBytes(a: bytes): bytes @@ -108,6 +141,7 @@ export type AppGlobalType = { * @param state key. * * @return value. The value is zero (of type uint64) if the key does not exist. * @see Native TEAL opcode: [`app_global_get`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#app_global_get) + * Min AVM version: 2 */ getUint64(a: bytes): uint64 @@ -116,6 +150,7 @@ export type AppGlobalType = { * @param Txn.ForeignApps offset (or, since v4, an _available_ application id), state key. * * @return did_exist flag (top of the stack, 1 if the application and key existed and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist. * @see Native TEAL opcode: [`app_global_get_ex`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#app_global_get_ex) + * Min AVM version: 2 */ getExBytes(a: Application | uint64, b: bytes): readonly [bytes, boolean] @@ -124,12 +159,14 @@ export type AppGlobalType = { * @param Txn.ForeignApps offset (or, since v4, an _available_ application id), state key. * * @return did_exist flag (top of the stack, 1 if the application and key existed and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist. * @see Native TEAL opcode: [`app_global_get_ex`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#app_global_get_ex) + * Min AVM version: 2 */ getExUint64(a: Application | uint64, b: bytes): readonly [uint64, boolean] /** * write B to key A in the global state of the current application * @see Native TEAL opcode: [`app_global_put`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#app_global_put) + * Min AVM version: 2 */ put(a: bytes, b: uint64 | bytes): void } @@ -143,6 +180,7 @@ export type AppLocalType = { * @param Txn.Accounts offset (or, since v4, an _available_ account address), state key. * 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.) * @see Native TEAL opcode: [`app_local_del`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#app_local_del) + * Min AVM version: 2 */ delete(a: Account | uint64, b: bytes): void @@ -151,6 +189,7 @@ export type AppLocalType = { * @param Txn.Accounts offset (or, since v4, an _available_ account address), state key. * * @return value. The value is zero (of type uint64) if the key does not exist. * @see Native TEAL opcode: [`app_local_get`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#app_local_get) + * Min AVM version: 2 */ getBytes(a: Account | uint64, b: bytes): bytes @@ -159,6 +198,7 @@ export type AppLocalType = { * @param Txn.Accounts offset (or, since v4, an _available_ account address), state key. * * @return value. The value is zero (of type uint64) if the key does not exist. * @see Native TEAL opcode: [`app_local_get`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#app_local_get) + * Min AVM version: 2 */ getUint64(a: Account | uint64, b: bytes): uint64 @@ -167,6 +207,7 @@ export type AppLocalType = { * @param Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset), state key. * * @return did_exist flag (top of the stack, 1 if the application and key existed and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist. * @see Native TEAL opcode: [`app_local_get_ex`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#app_local_get_ex) + * Min AVM version: 2 */ getExBytes(a: Account | uint64, b: Application | uint64, c: bytes): readonly [bytes, boolean] @@ -175,6 +216,7 @@ export type AppLocalType = { * @param Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset), state key. * * @return did_exist flag (top of the stack, 1 if the application and key existed and 0 otherwise), value. The value is zero (of type uint64) if the key does not exist. * @see Native TEAL opcode: [`app_local_get_ex`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#app_local_get_ex) + * Min AVM version: 2 */ getExUint64(a: Account | uint64, b: Application | uint64, c: bytes): readonly [uint64, boolean] @@ -182,6 +224,7 @@ export type AppLocalType = { * write C to key B in account A's local state of the current application * @param Txn.Accounts offset (or, since v4, an _available_ account address), state key, value. * @see Native TEAL opcode: [`app_local_put`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#app_local_put) + * Min AVM version: 2 */ put(a: Account | uint64, b: bytes, c: uint64 | bytes): void } @@ -191,52 +234,61 @@ export type AppLocalType = { * @param Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset). * * @return 1 if opted in and 0 otherwise. * @see Native TEAL opcode: [`app_opted_in`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#app_opted_in) + * Min AVM version: 2 */ export type AppOptedInType = (a: Account | uint64, b: Application | uint64) => boolean - export type AppParamsType = { /** * Bytecode of Approval Program + * Min AVM version: 5 */ appApprovalProgram(a: Application | uint64): readonly [bytes, boolean] /** * Bytecode of Clear State Program + * Min AVM version: 5 */ appClearStateProgram(a: Application | uint64): readonly [bytes, boolean] /** * Number of uint64 values allowed in Global State + * Min AVM version: 5 */ appGlobalNumUint(a: Application | uint64): readonly [uint64, boolean] /** * Number of byte array values allowed in Global State + * Min AVM version: 5 */ appGlobalNumByteSlice(a: Application | uint64): readonly [uint64, boolean] /** * Number of uint64 values allowed in Local State + * Min AVM version: 5 */ appLocalNumUint(a: Application | uint64): readonly [uint64, boolean] /** * Number of byte array values allowed in Local State + * Min AVM version: 5 */ appLocalNumByteSlice(a: Application | uint64): readonly [uint64, boolean] /** * Number of Extra Program Pages of code space + * Min AVM version: 5 */ appExtraProgramPages(a: Application | uint64): readonly [uint64, boolean] /** * Creator address + * Min AVM version: 5 */ appCreator(a: Application | uint64): readonly [Account, boolean] /** * Address for which this application has authority + * Min AVM version: 5 */ appAddress(a: Application | uint64): readonly [Account, boolean] } @@ -244,79 +296,92 @@ export type AppParamsType = { /** * Ath LogicSig argument * @see Native TEAL opcode: [`args`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#args) + * Min AVM version: 5 */ export type ArgType = (a: uint64) => bytes - export type AssetHoldingType = { /** * Amount of the asset unit held by this account + * Min AVM version: 2 */ assetBalance(a: Account | uint64, b: Asset | uint64): readonly [uint64, boolean] /** * Is the asset frozen or not + * Min AVM version: 2 */ assetFrozen(a: Account | uint64, b: Asset | uint64): readonly [boolean, boolean] } - export type AssetParamsType = { /** * Total number of units of this asset + * Min AVM version: 2 */ assetTotal(a: Asset | uint64): readonly [uint64, boolean] /** * See AssetParams.Decimals + * Min AVM version: 2 */ assetDecimals(a: Asset | uint64): readonly [uint64, boolean] /** * Frozen by default or not + * Min AVM version: 2 */ assetDefaultFrozen(a: Asset | uint64): readonly [boolean, boolean] /** * Asset unit name + * Min AVM version: 2 */ assetUnitName(a: Asset | uint64): readonly [bytes, boolean] /** * Asset name + * Min AVM version: 2 */ assetName(a: Asset | uint64): readonly [bytes, boolean] /** * URL with additional info about the asset + * Min AVM version: 2 */ assetUrl(a: Asset | uint64): readonly [bytes, boolean] /** * Arbitrary commitment + * Min AVM version: 2 */ assetMetadataHash(a: Asset | uint64): readonly [bytes, boolean] /** * Manager address + * Min AVM version: 2 */ assetManager(a: Asset | uint64): readonly [Account, boolean] /** * Reserve address + * Min AVM version: 2 */ assetReserve(a: Asset | uint64): readonly [Account, boolean] /** * Freeze address + * Min AVM version: 2 */ assetFreeze(a: Asset | uint64): readonly [Account, boolean] /** * Clawback address + * Min AVM version: 2 */ assetClawback(a: Asset | uint64): readonly [Account, boolean] /** * Creator address + * Min AVM version: 2 */ assetCreator(a: Asset | uint64): readonly [Account, boolean] } @@ -326,6 +391,7 @@ export type AssetParamsType = { * @param Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset). * * @return value. * @see Native TEAL opcode: [`balance`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#balance) + * Min AVM version: 2 */ export type BalanceType = (a: Account | uint64) => uint64 @@ -334,6 +400,7 @@ export type BalanceType = (a: Account | uint64) => uint64 * *Warning*: Usage should be restricted to very rare use cases. In almost all cases, smart contracts should directly handle non-encoded byte-strings. This opcode should only be used in cases where base64 is the only available option, e.g. interoperability with a third-party that only signs base64 strings. * Decodes A using the base64 encoding E. Specify the encoding with an immediate arg either as URL and Filename Safe (`URLEncoding`) or Standard (`StdEncoding`). See [RFC 4648 sections 4 and 5](https://rfc-editor.org/rfc/rfc4648.html#section-4). It is assumed that the encoding ends with the exact number of `=` padding characters as required by the RFC. When padding occurs, any unused pad bits in the encoding must be set to zero or the decoding will fail. The special cases of `\n` and `\r` are allowed but completely ignored. An error will result when attempting to decode a string with a character that is not in the encoding alphabet or not one of `=`, `\r`, or `\n`. * @see Native TEAL opcode: [`base64_decode`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#base64_decode) + * Min AVM version: 7 */ export type Base64DecodeType = (e: Base64, a: bytes) => bytes @@ -341,13 +408,20 @@ export type Base64DecodeType = (e: Base64, a: bytes) => bytes * The highest set bit in A. If A is a byte-array, it is interpreted as a big-endian unsigned integer. bitlen of 0 is 0, bitlen of 8 is 4 * bitlen interprets arrays as big-endian integers, unlike setbit/getbit * @see Native TEAL opcode: [`bitlen`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#bitlen) + * Min AVM version: 4 */ export type BitLengthType = (a: uint64 | bytes) => uint64 - export type BlockType = { blkSeed(a: uint64): bytes - blkTimestamp(a: uint64): uint64 + blkProposer(a: uint64): Account + blkFeesCollected(a: uint64): uint64 + blkBonus(a: uint64): uint64 + blkBranch(a: uint64): bytes + blkFeeSink(a: uint64): Account + blkProtocol(a: uint64): bytes + blkTxnCounter(a: uint64): uint64 + blkProposerPayout(a: uint64): uint64 } /** @@ -358,18 +432,21 @@ export type BoxType = { * create a box named A, of length B. Fail if the name A is empty or B exceeds 32,768. Returns 0 if A already existed, else 1 * Newly created boxes are filled with 0 bytes. `box_create` will fail if the referenced box already exists with a different size. Otherwise, existing boxes are unchanged by `box_create`. * @see Native TEAL opcode: [`box_create`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#box_create) + * Min AVM version: 8 */ create(a: bytes, b: uint64): boolean /** * delete box named A if it exists. Return 1 if A existed, 0 otherwise * @see Native TEAL opcode: [`box_del`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#box_del) + * Min AVM version: 8 */ delete(a: bytes): boolean /** * read C bytes from box A, starting at offset B. Fail if A does not exist, or the byte range is outside A's size. * @see Native TEAL opcode: [`box_extract`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#box_extract) + * Min AVM version: 8 */ extract(a: bytes, b: uint64, c: uint64): bytes @@ -377,12 +454,14 @@ export type BoxType = { * X is the contents of box A if A exists, else ''. Y is 1 if A exists, else 0. * For boxes that exceed 4,096 bytes, consider `box_create`, `box_extract`, and `box_replace` * @see Native TEAL opcode: [`box_get`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#box_get) + * Min AVM version: 8 */ get(a: bytes): readonly [bytes, boolean] /** * X is the length of box A if A exists, else 0. Y is 1 if A exists, else 0. * @see Native TEAL opcode: [`box_len`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#box_len) + * Min AVM version: 8 */ length(a: bytes): readonly [uint64, boolean] @@ -390,18 +469,21 @@ export type BoxType = { * replaces the contents of box A with byte-array B. Fails if A exists and len(B) != len(box A). Creates A if it does not exist * For boxes that exceed 4,096 bytes, consider `box_create`, `box_extract`, and `box_replace` * @see Native TEAL opcode: [`box_put`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#box_put) + * Min AVM version: 8 */ put(a: bytes, b: bytes): void /** * write byte-array C into box A, starting at offset B. Fail if A does not exist, or the byte range is outside A's size. * @see Native TEAL opcode: [`box_replace`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#box_replace) + * Min AVM version: 8 */ replace(a: bytes, b: uint64, c: bytes): void /** * change the size of box named A to be of length B, adding zero bytes to end or removing bytes from the end, as needed. Fail if the name A is empty, A is not an existing box, or B exceeds 32,768. * @see Native TEAL opcode: [`box_resize`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#box_resize) + * Min AVM version: 10 */ resize(a: bytes, b: uint64): void @@ -409,6 +491,7 @@ export type BoxType = { * set box A to contain its previous bytes up to index B, followed by D, followed by the original bytes of A that began at index B+C. * Boxes are of constant length. If C < len(D), then len(D)-C bytes will be removed from the end. If C > len(D), zero bytes will be appended to the end to reach the box length. * @see Native TEAL opcode: [`box_splice`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#box_splice) + * Min AVM version: 10 */ splice(a: bytes, b: uint64, c: uint64, d: bytes): void } @@ -416,6 +499,7 @@ export type BoxType = { /** * The largest integer I such that I^2 <= A. A and I are interpreted as big-endian unsigned integers * @see Native TEAL opcode: [`bsqrt`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#bsqrt) + * Min AVM version: 6 */ export type BsqrtType = (a: biguint) => biguint @@ -423,12 +507,14 @@ export type BsqrtType = (a: biguint) => biguint * converts big-endian byte array A to uint64. Fails if len(A) > 8. Padded by leading 0s if len(A) < 8. * `btoi` fails if the input is longer than 8 bytes. * @see Native TEAL opcode: [`btoi`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#btoi) + * Min AVM version: 1 */ export type BtoiType = (a: bytes) => uint64 /** * zero filled byte-array of length A * @see Native TEAL opcode: [`bzero`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#bzero) + * Min AVM version: 4 */ export type BzeroType = (a: uint64) => bytes @@ -436,6 +522,7 @@ export type BzeroType = (a: uint64) => bytes * join A and B * `concat` fails if the result would be greater than 4096 bytes. * @see Native TEAL opcode: [`concat`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#concat) + * Min AVM version: 2 */ export type ConcatType = (a: bytes, b: bytes) => bytes @@ -443,6 +530,7 @@ export type ConcatType = (a: bytes, b: bytes) => bytes * W,X = (A,B / C,D); Y,Z = (A,B modulo C,D) * The notation J,K indicates that two uint64 values J and K are interpreted as a uint128 value, with J as the high uint64 and K the low. * @see Native TEAL opcode: [`divmodw`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#divmodw) + * Min AVM version: 4 */ export type DivmodwType = (a: uint64, b: uint64, c: uint64, d: uint64) => readonly [uint64, uint64, uint64, uint64] @@ -450,6 +538,7 @@ export type DivmodwType = (a: uint64, b: uint64, c: uint64, d: uint64) => readon * A,B / C. Fail if C == 0 or if result overflows. * The notation A,B indicates that A and B are interpreted as a uint128 value, with A as the high uint64 and B the low. * @see Native TEAL opcode: [`divw`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#divw) + * Min AVM version: 6 */ export type DivwType = (a: uint64, b: uint64, c: uint64) => uint64 @@ -468,6 +557,7 @@ export type EllipticCurveType = { * A and/or B are allowed to be the point at infinity. * Does _not_ check if A and B are in the main prime-order subgroup. * @see Native TEAL opcode: [`ec_add`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#ec_add) + * Min AVM version: 10 */ add(g: Ec, a: bytes, b: bytes): bytes @@ -476,6 +566,7 @@ export type EllipticCurveType = { * BN254 points are mapped by the SVDW map. BLS12-381 points are mapped by the SSWU map. * G1 element inputs are base field elements and G2 element inputs are quadratic field elements, with nearly the same encoding rules (for field elements) as defined in `ec_add`. There is one difference of encoding rule: G1 element inputs do not need to be 0-padded if they fit in less than 32 bytes for BN254 and less than 48 bytes for BLS12-381. (As usual, the empty byte array represents 0.) G2 elements inputs need to be always have the required size. * @see Native TEAL opcode: [`ec_map_to`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#ec_map_to) + * Min AVM version: 10 */ mapTo(g: Ec, a: bytes): bytes @@ -484,6 +575,7 @@ export type EllipticCurveType = { * A is a list of concatenated points, encoded and checked as described in `ec_add`. B is a list of concatenated scalars which, unlike ec_scalar_mul, must all be exactly 32 bytes long. * The name `ec_multi_scalar_mul` was chosen to reflect common usage, but a more consistent name would be `ec_multi_scalar_mul`. AVM values are limited to 4096 bytes, so `ec_multi_scalar_mul` is limited by the size of the points in the group being operated upon. * @see Native TEAL opcode: [`ec_multi_scalar_mul`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#ec_multi_scalar_mul) + * Min AVM version: 10 */ scalarMulMulti(g: Ec, a: bytes, b: bytes): bytes @@ -491,6 +583,7 @@ export type EllipticCurveType = { * 1 if the product of the pairing of each point in A with its respective point in B is equal to the identity element of the target group Gt, else 0 * A and B are concatenated points, encoded and checked as described in `ec_add`. A contains points of the group G, B contains points of the associated group (G2 if G is G1, and vice versa). Fails if A and B have a different number of points, or if any point is not in its described group or outside the main prime-order subgroup - a stronger condition than other opcodes. AVM values are limited to 4096 bytes, so `ec_pairing_check` is limited by the size of the points in the groups being operated upon. * @see Native TEAL opcode: [`ec_pairing_check`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#ec_pairing_check) + * Min AVM version: 10 */ pairingCheck(g: Ec, a: bytes, b: bytes): boolean @@ -498,12 +591,14 @@ export type EllipticCurveType = { * for curve point A and scalar B, return the curve point BA, the point A multiplied by the scalar B. * A is a curve point encoded and checked as described in `ec_add`. Scalar B is interpreted as a big-endian unsigned integer. Fails if B exceeds 32 bytes. * @see Native TEAL opcode: [`ec_scalar_mul`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#ec_scalar_mul) + * Min AVM version: 10 */ scalarMul(g: Ec, a: bytes, b: bytes): bytes /** * 1 if A is in the main prime-order subgroup of G (including the point at infinity) else 0. Program fails if A is not in G at all. * @see Native TEAL opcode: [`ec_subgroup_check`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#ec_subgroup_check) + * Min AVM version: 10 */ subgroupCheck(g: Ec, a: bytes): boolean } @@ -512,6 +607,7 @@ export type EllipticCurveType = { * decompress pubkey A into components X, Y * The 33 byte public key in a compressed form to be decompressed into X and Y (top) components. All values are big-endian encoded. * @see Native TEAL opcode: [`ecdsa_pk_decompress`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#ecdsa_pk_decompress) + * Min AVM version: 5 */ export type EcdsaPkDecompressType = (v: Ecdsa, a: bytes) => readonly [bytes, bytes] @@ -519,6 +615,7 @@ export type EcdsaPkDecompressType = (v: Ecdsa, a: bytes) => readonly [bytes, byt * for (data A, recovery id B, signature C, D) recover a public key * S (top) and R elements of a signature, recovery id and data (bottom) are expected on the stack and used to deriver a public key. All values are big-endian encoded. The signed data must be 32 bytes long. * @see Native TEAL opcode: [`ecdsa_pk_recover`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#ecdsa_pk_recover) + * Min AVM version: 5 */ export type EcdsaPkRecoverType = (v: Ecdsa, a: bytes, b: uint64, c: bytes, d: bytes) => readonly [bytes, bytes] @@ -526,6 +623,7 @@ export type EcdsaPkRecoverType = (v: Ecdsa, a: bytes, b: uint64, c: bytes, d: by * for (data A, signature B, C and pubkey D, E) verify the signature of the data against the pubkey => {0 or 1} * The 32 byte Y-component of a public key is the last element on the stack, preceded by X-component of a pubkey, preceded by S and R components of a signature, preceded by the data that is fifth element on the stack. All values are big-endian encoded. The signed data must be 32 bytes long, and signatures in lower-S form are only accepted. * @see Native TEAL opcode: [`ecdsa_verify`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#ecdsa_verify) + * Min AVM version: 5 */ export type EcdsaVerifyType = (v: Ecdsa, a: bytes, b: bytes, c: bytes, d: bytes, e: bytes) => boolean @@ -533,24 +631,28 @@ export type EcdsaVerifyType = (v: Ecdsa, a: bytes, b: bytes, c: bytes, d: bytes, * for (data A, signature B, pubkey C) verify the signature of ("ProgData" || program_hash || data) against the pubkey => {0 or 1} * The 32 byte public key is the last element on the stack, preceded by the 64 byte signature at the second-to-last element on the stack, preceded by the data which was signed at the third-to-last element on the stack. * @see Native TEAL opcode: [`ed25519verify`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#ed25519verify) + * Min AVM version: 1 */ export type Ed25519verifyType = (a: bytes, b: bytes, c: bytes) => boolean /** * for (data A, signature B, pubkey C) verify the signature of the data against the pubkey => {0 or 1} * @see Native TEAL opcode: [`ed25519verify_bare`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#ed25519verify_bare) + * Min AVM version: 7 */ export type Ed25519verifyBareType = (a: bytes, b: bytes, c: bytes) => boolean /** * A raised to the Bth power. Fail if A == B == 0 and on overflow * @see Native TEAL opcode: [`exp`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#exp) + * Min AVM version: 4 */ export type ExpType = (a: uint64, b: uint64) => uint64 /** * A raised to the Bth power as a 128-bit result in two uint64s. X is the high 64 bits, Y is the low. Fail if A == B == 0 or if the results exceeds 2^128-1 * @see Native TEAL opcode: [`expw`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#expw) + * Min AVM version: 4 */ export type ExpwType = (a: uint64, b: uint64) => readonly [uint64, uint64] @@ -558,31 +660,43 @@ export type ExpwType = (a: uint64, b: uint64) => readonly [uint64, uint64] * A range of bytes from A starting at B up to but not including B+C. If B+C is larger than the array length, the program fails * `extract3` can be called using `extract` with no immediates. * @see Native TEAL opcode: [`extract3`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#extract3) + * Min AVM version: 5 */ export type ExtractType = (a: bytes, b: uint64, c: uint64) => bytes /** * A uint16 formed from a range of big-endian bytes from A starting at B up to but not including B+2. If B+2 is larger than the array length, the program fails * @see Native TEAL opcode: [`extract_uint16`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#extract_uint16) + * Min AVM version: 5 */ export type ExtractUint16Type = (a: bytes, b: uint64) => uint64 /** * A uint32 formed from a range of big-endian bytes from A starting at B up to but not including B+4. If B+4 is larger than the array length, the program fails * @see Native TEAL opcode: [`extract_uint32`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#extract_uint32) + * Min AVM version: 5 */ export type ExtractUint32Type = (a: bytes, b: uint64) => uint64 /** * A uint64 formed from a range of big-endian bytes from A starting at B up to but not including B+8. If B+8 is larger than the array length, the program fails * @see Native TEAL opcode: [`extract_uint64`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#extract_uint64) + * Min AVM version: 5 */ export type ExtractUint64Type = (a: bytes, b: uint64) => uint64 +/** + * for (data A, compressed-format signature B, pubkey C) verify the signature of data against the pubkey + * @see Native TEAL opcode: [`falcon_verify`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#falcon_verify) + * Min AVM version: 11 + */ +export type FalconVerifyType = (a: bytes, b: bytes, c: bytes) => boolean + /** * ID of the asset or application created in the Ath transaction of the current group * `gaids` fails unless the requested transaction created an asset or application and A < GroupIndex. * @see Native TEAL opcode: [`gaids`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#gaids) + * Min AVM version: 4 */ export type GaidType = (a: uint64) => uint64 @@ -590,12 +704,14 @@ export type GaidType = (a: uint64) => uint64 * Bth bit of (byte-array or integer) A. If B is greater than or equal to the bit length of the value (8*byte length), the program fails * see explanation of bit ordering in setbit * @see Native TEAL opcode: [`getbit`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#getbit) + * Min AVM version: 3 */ export type GetBitType = (a: uint64 | bytes, b: uint64) => uint64 /** * Bth byte of A, as an integer. If B is greater than or equal to the array length, the program fails * @see Native TEAL opcode: [`getbyte`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#getbyte) + * Min AVM version: 3 */ export type GetByteType = (a: bytes, b: uint64) => uint64 @@ -605,341 +721,409 @@ export type GetByteType = (a: bytes, b: uint64) => uint64 export type GITxnType = { /** * 32 byte address + * Min AVM version: 6 */ sender(t: uint64): Account /** * microalgos + * Min AVM version: 6 */ fee(t: uint64): uint64 /** * round number + * Min AVM version: 6 */ firstValid(t: uint64): uint64 /** * UNIX timestamp of block before txn.FirstValid. Fails if negative + * Min AVM version: 6 */ firstValidTime(t: uint64): uint64 /** * round number + * Min AVM version: 6 */ lastValid(t: uint64): uint64 /** * Any data up to 1024 bytes + * Min AVM version: 6 */ note(t: uint64): bytes /** * 32 byte lease value + * Min AVM version: 6 */ lease(t: uint64): bytes /** * 32 byte address + * Min AVM version: 6 */ receiver(t: uint64): Account /** * microalgos + * Min AVM version: 6 */ amount(t: uint64): uint64 /** * 32 byte address + * Min AVM version: 6 */ closeRemainderTo(t: uint64): Account /** * 32 byte address + * Min AVM version: 6 */ votePk(t: uint64): bytes /** * 32 byte address + * Min AVM version: 6 */ selectionPk(t: uint64): bytes /** * The first round that the participation key is valid. + * Min AVM version: 6 */ voteFirst(t: uint64): uint64 /** * The last round that the participation key is valid. + * Min AVM version: 6 */ voteLast(t: uint64): uint64 /** * Dilution for the 2-level participation key + * Min AVM version: 6 */ voteKeyDilution(t: uint64): uint64 /** * Transaction type as bytes + * Min AVM version: 6 */ type(t: uint64): bytes /** * Transaction type as integer + * Min AVM version: 6 */ typeEnum(t: uint64): uint64 /** * Asset ID + * Min AVM version: 6 */ xferAsset(t: uint64): Asset /** * value in Asset's units + * Min AVM version: 6 */ assetAmount(t: uint64): uint64 /** * 32 byte address. Source of assets if Sender is the Asset's Clawback address. + * Min AVM version: 6 */ assetSender(t: uint64): Account /** * 32 byte address + * Min AVM version: 6 */ assetReceiver(t: uint64): Account /** * 32 byte address + * Min AVM version: 6 */ assetCloseTo(t: uint64): Account /** * Position of this transaction within an atomic transaction group. A stand-alone transaction is implicitly element 0 in a group of 1 + * Min AVM version: 6 */ groupIndex(t: uint64): uint64 /** * The computed ID for this transaction. 32 bytes. + * Min AVM version: 6 */ txId(t: uint64): bytes /** * ApplicationID from ApplicationCall transaction + * Min AVM version: 6 */ applicationId(t: uint64): Application /** * ApplicationCall transaction on completion action + * Min AVM version: 6 */ onCompletion(t: uint64): uint64 /** * Arguments passed to the application in the ApplicationCall transaction + * Min AVM version: 6 */ applicationArgs(t: uint64, a: uint64): bytes /** * Number of ApplicationArgs + * Min AVM version: 6 */ numAppArgs(t: uint64): uint64 /** * Accounts listed in the ApplicationCall transaction + * Min AVM version: 6 */ accounts(t: uint64, a: uint64): Account /** * Number of Accounts + * Min AVM version: 6 */ numAccounts(t: uint64): uint64 /** * Approval program + * Min AVM version: 6 */ approvalProgram(t: uint64): bytes /** * Clear state program + * Min AVM version: 6 */ clearStateProgram(t: uint64): bytes /** * 32 byte Sender's new AuthAddr + * Min AVM version: 6 */ rekeyTo(t: uint64): Account /** * Asset ID in asset config transaction + * Min AVM version: 6 */ configAsset(t: uint64): Asset /** * Total number of units of this asset created + * Min AVM version: 6 */ configAssetTotal(t: uint64): uint64 /** * Number of digits to display after the decimal place when displaying the asset + * Min AVM version: 6 */ configAssetDecimals(t: uint64): uint64 /** * Whether the asset's slots are frozen by default or not, 0 or 1 + * Min AVM version: 6 */ configAssetDefaultFrozen(t: uint64): boolean /** * Unit name of the asset + * Min AVM version: 6 */ configAssetUnitName(t: uint64): bytes /** * The asset name + * Min AVM version: 6 */ configAssetName(t: uint64): bytes /** * URL + * Min AVM version: 6 */ configAssetUrl(t: uint64): bytes /** * 32 byte commitment to unspecified asset metadata + * Min AVM version: 6 */ configAssetMetadataHash(t: uint64): bytes /** * 32 byte address + * Min AVM version: 6 */ configAssetManager(t: uint64): Account /** * 32 byte address + * Min AVM version: 6 */ configAssetReserve(t: uint64): Account /** * 32 byte address + * Min AVM version: 6 */ configAssetFreeze(t: uint64): Account /** * 32 byte address + * Min AVM version: 6 */ configAssetClawback(t: uint64): Account /** * Asset ID being frozen or un-frozen + * Min AVM version: 6 */ freezeAsset(t: uint64): Asset /** * 32 byte address of the account whose asset slot is being frozen or un-frozen + * Min AVM version: 6 */ freezeAssetAccount(t: uint64): Account /** * The new frozen value, 0 or 1 + * Min AVM version: 6 */ freezeAssetFrozen(t: uint64): boolean /** * Foreign Assets listed in the ApplicationCall transaction + * Min AVM version: 6 */ assets(t: uint64, a: uint64): Asset /** * Number of Assets + * Min AVM version: 6 */ numAssets(t: uint64): uint64 /** * Foreign Apps listed in the ApplicationCall transaction + * Min AVM version: 6 */ applications(t: uint64, a: uint64): Application /** * Number of Applications + * Min AVM version: 6 */ numApplications(t: uint64): uint64 /** * Number of global state integers in ApplicationCall + * Min AVM version: 6 */ globalNumUint(t: uint64): uint64 /** * Number of global state byteslices in ApplicationCall + * Min AVM version: 6 */ globalNumByteSlice(t: uint64): uint64 /** * Number of local state integers in ApplicationCall + * Min AVM version: 6 */ localNumUint(t: uint64): uint64 /** * Number of local state byteslices in ApplicationCall + * Min AVM version: 6 */ localNumByteSlice(t: uint64): uint64 /** * Number of additional pages for each of the application's approval and clear state programs. An ExtraProgramPages of 1 means 2048 more total bytes, or 1024 for each program. + * Min AVM version: 6 */ extraProgramPages(t: uint64): uint64 /** * Marks an account nonparticipating for rewards + * Min AVM version: 6 */ nonparticipation(t: uint64): boolean /** * Log messages emitted by an application call (only with `itxn` in v5). Application mode only + * Min AVM version: 6 */ logs(t: uint64, a: uint64): bytes /** * Number of Logs (only with `itxn` in v5). Application mode only + * Min AVM version: 6 */ numLogs(t: uint64): uint64 /** * Asset ID allocated by the creation of an ASA (only with `itxn` in v5). Application mode only + * Min AVM version: 6 */ createdAssetId(t: uint64): Asset /** * ApplicationID allocated by the creation of an application (only with `itxn` in v5). Application mode only + * Min AVM version: 6 */ createdApplicationId(t: uint64): Application /** * The last message emitted. Empty bytes if none were emitted. Application mode only + * Min AVM version: 6 */ lastLog(t: uint64): bytes /** * 64 byte state proof public key + * Min AVM version: 6 */ stateProofPk(t: uint64): bytes /** * Approval Program as an array of pages + * Min AVM version: 6 */ approvalProgramPages(t: uint64, a: uint64): bytes /** * Number of Approval Program pages + * Min AVM version: 6 */ numApprovalProgramPages(t: uint64): uint64 /** * ClearState Program as an array of pages + * Min AVM version: 6 */ clearStateProgramPages(t: uint64, a: uint64): bytes /** * Number of ClearState Program pages + * Min AVM version: 6 */ numClearStateProgramPages(t: uint64): uint64 } @@ -947,105 +1131,154 @@ export type GITxnType = { /** * Bth scratch space value of the Ath transaction in the current group * @see Native TEAL opcode: [`gloadss`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#gloadss) + * Min AVM version: 6 */ export type GloadBytesType = (a: uint64, b: uint64) => bytes /** * Bth scratch space value of the Ath transaction in the current group * @see Native TEAL opcode: [`gloadss`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#gloadss) + * Min AVM version: 6 */ export type GloadUint64Type = (a: uint64, b: uint64) => uint64 - export type GlobalType = { /** * microalgos + * Min AVM version: 1 */ get minTxnFee(): uint64 /** * microalgos + * Min AVM version: 1 */ get minBalance(): uint64 /** * rounds + * Min AVM version: 1 */ get maxTxnLife(): uint64 /** * 32 byte address of all zero bytes + * Min AVM version: 1 */ get zeroAddress(): Account /** * Number of transactions in this atomic transaction group. At least 1 + * Min AVM version: 1 */ get groupSize(): uint64 /** * Maximum supported version + * Min AVM version: 1 */ get logicSigVersion(): uint64 /** * Current round number. Application mode only. + * Min AVM version: 1 */ get round(): uint64 /** * Last confirmed block UNIX timestamp. Fails if negative. Application mode only. + * Min AVM version: 1 */ get latestTimestamp(): uint64 /** * ID of current application executing. Application mode only. + * Min AVM version: 1 */ get currentApplicationId(): Application /** * Address of the creator of the current application. Application mode only. + * Min AVM version: 1 */ get creatorAddress(): Account /** * Address that the current application controls. Application mode only. + * Min AVM version: 1 */ get currentApplicationAddress(): Account /** * ID of the transaction group. 32 zero bytes if the transaction is not part of a group. + * Min AVM version: 1 */ get groupId(): bytes /** * The remaining cost that can be spent by opcodes in this program. + * Min AVM version: 1 */ get opcodeBudget(): uint64 /** * The application ID of the application that called this application. 0 if this application is at the top-level. Application mode only. + * Min AVM version: 1 */ get callerApplicationId(): uint64 /** * The application address of the application that called this application. ZeroAddress if this application is at the top-level. Application mode only. + * Min AVM version: 1 */ get callerApplicationAddress(): Account /** * The additional minimum balance required to create (and opt-in to) an asset. + * Min AVM version: 1 */ get assetCreateMinBalance(): uint64 /** * The additional minimum balance required to opt-in to an asset. + * Min AVM version: 1 */ get assetOptInMinBalance(): uint64 /** * The Genesis Hash for the network. + * Min AVM version: 1 */ get genesisHash(): bytes + + /** + * Whether block proposal payouts are enabled. + * Min AVM version: 1 + */ + get payoutsEnabled(): boolean + + /** + * The fee required in a keyreg transaction to make an account incentive eligible. + * Min AVM version: 1 + */ + get payoutsGoOnlineFee(): uint64 + + /** + * The percentage of transaction fees in a block that can be paid to the block proposer. + * Min AVM version: 1 + */ + get payoutsPercent(): uint64 + + /** + * The minimum algo balance an account must have in the agreement round to receive block payouts in the proposal round. + * Min AVM version: 1 + */ + get payoutsMinBalance(): uint64 + + /** + * The maximum algo balance an account can have in the agreement round to receive block payouts in the proposal round. + * Min AVM version: 1 + */ + get payoutsMaxBalance(): uint64 } /** @@ -1054,341 +1287,409 @@ export type GlobalType = { export type GTxnType = { /** * 32 byte address + * Min AVM version: 1 */ sender(t: uint64): Account /** * microalgos + * Min AVM version: 1 */ fee(t: uint64): uint64 /** * round number + * Min AVM version: 1 */ firstValid(t: uint64): uint64 /** * UNIX timestamp of block before txn.FirstValid. Fails if negative + * Min AVM version: 1 */ firstValidTime(t: uint64): uint64 /** * round number + * Min AVM version: 1 */ lastValid(t: uint64): uint64 /** * Any data up to 1024 bytes + * Min AVM version: 1 */ note(t: uint64): bytes /** * 32 byte lease value + * Min AVM version: 1 */ lease(t: uint64): bytes /** * 32 byte address + * Min AVM version: 1 */ receiver(t: uint64): Account /** * microalgos + * Min AVM version: 1 */ amount(t: uint64): uint64 /** * 32 byte address + * Min AVM version: 1 */ closeRemainderTo(t: uint64): Account /** * 32 byte address + * Min AVM version: 1 */ votePk(t: uint64): bytes /** * 32 byte address + * Min AVM version: 1 */ selectionPk(t: uint64): bytes /** * The first round that the participation key is valid. + * Min AVM version: 1 */ voteFirst(t: uint64): uint64 /** * The last round that the participation key is valid. + * Min AVM version: 1 */ voteLast(t: uint64): uint64 /** * Dilution for the 2-level participation key + * Min AVM version: 1 */ voteKeyDilution(t: uint64): uint64 /** * Transaction type as bytes + * Min AVM version: 1 */ type(t: uint64): bytes /** * Transaction type as integer + * Min AVM version: 1 */ typeEnum(t: uint64): uint64 /** * Asset ID + * Min AVM version: 1 */ xferAsset(t: uint64): Asset /** * value in Asset's units + * Min AVM version: 1 */ assetAmount(t: uint64): uint64 /** * 32 byte address. Source of assets if Sender is the Asset's Clawback address. + * Min AVM version: 1 */ assetSender(t: uint64): Account /** * 32 byte address + * Min AVM version: 1 */ assetReceiver(t: uint64): Account /** * 32 byte address + * Min AVM version: 1 */ assetCloseTo(t: uint64): Account /** * Position of this transaction within an atomic transaction group. A stand-alone transaction is implicitly element 0 in a group of 1 + * Min AVM version: 1 */ groupIndex(t: uint64): uint64 /** * The computed ID for this transaction. 32 bytes. + * Min AVM version: 1 */ txId(t: uint64): bytes /** * ApplicationID from ApplicationCall transaction + * Min AVM version: 1 */ applicationId(t: uint64): Application /** * ApplicationCall transaction on completion action + * Min AVM version: 1 */ onCompletion(t: uint64): uint64 /** * Arguments passed to the application in the ApplicationCall transaction + * Min AVM version: 5 */ applicationArgs(a: uint64, b: uint64): bytes /** * Number of ApplicationArgs + * Min AVM version: 1 */ numAppArgs(t: uint64): uint64 /** * Accounts listed in the ApplicationCall transaction + * Min AVM version: 5 */ accounts(a: uint64, b: uint64): Account /** * Number of Accounts + * Min AVM version: 1 */ numAccounts(t: uint64): uint64 /** * Approval program + * Min AVM version: 1 */ approvalProgram(t: uint64): bytes /** * Clear state program + * Min AVM version: 1 */ clearStateProgram(t: uint64): bytes /** * 32 byte Sender's new AuthAddr + * Min AVM version: 1 */ rekeyTo(t: uint64): Account /** * Asset ID in asset config transaction + * Min AVM version: 1 */ configAsset(t: uint64): Asset /** * Total number of units of this asset created + * Min AVM version: 1 */ configAssetTotal(t: uint64): uint64 /** * Number of digits to display after the decimal place when displaying the asset + * Min AVM version: 1 */ configAssetDecimals(t: uint64): uint64 /** * Whether the asset's slots are frozen by default or not, 0 or 1 + * Min AVM version: 1 */ configAssetDefaultFrozen(t: uint64): boolean /** * Unit name of the asset + * Min AVM version: 1 */ configAssetUnitName(t: uint64): bytes /** * The asset name + * Min AVM version: 1 */ configAssetName(t: uint64): bytes /** * URL + * Min AVM version: 1 */ configAssetUrl(t: uint64): bytes /** * 32 byte commitment to unspecified asset metadata + * Min AVM version: 1 */ configAssetMetadataHash(t: uint64): bytes /** * 32 byte address + * Min AVM version: 1 */ configAssetManager(t: uint64): Account /** * 32 byte address + * Min AVM version: 1 */ configAssetReserve(t: uint64): Account /** * 32 byte address + * Min AVM version: 1 */ configAssetFreeze(t: uint64): Account /** * 32 byte address + * Min AVM version: 1 */ configAssetClawback(t: uint64): Account /** * Asset ID being frozen or un-frozen + * Min AVM version: 1 */ freezeAsset(t: uint64): Asset /** * 32 byte address of the account whose asset slot is being frozen or un-frozen + * Min AVM version: 1 */ freezeAssetAccount(t: uint64): Account /** * The new frozen value, 0 or 1 + * Min AVM version: 1 */ freezeAssetFrozen(t: uint64): boolean /** * Foreign Assets listed in the ApplicationCall transaction + * Min AVM version: 5 */ assets(a: uint64, b: uint64): Asset /** * Number of Assets + * Min AVM version: 1 */ numAssets(t: uint64): uint64 /** * Foreign Apps listed in the ApplicationCall transaction + * Min AVM version: 5 */ applications(a: uint64, b: uint64): Application /** * Number of Applications + * Min AVM version: 1 */ numApplications(t: uint64): uint64 /** * Number of global state integers in ApplicationCall + * Min AVM version: 1 */ globalNumUint(t: uint64): uint64 /** * Number of global state byteslices in ApplicationCall + * Min AVM version: 1 */ globalNumByteSlice(t: uint64): uint64 /** * Number of local state integers in ApplicationCall + * Min AVM version: 1 */ localNumUint(t: uint64): uint64 /** * Number of local state byteslices in ApplicationCall + * Min AVM version: 1 */ localNumByteSlice(t: uint64): uint64 /** * Number of additional pages for each of the application's approval and clear state programs. An ExtraProgramPages of 1 means 2048 more total bytes, or 1024 for each program. + * Min AVM version: 1 */ extraProgramPages(t: uint64): uint64 /** * Marks an account nonparticipating for rewards + * Min AVM version: 1 */ nonparticipation(t: uint64): boolean /** * Log messages emitted by an application call (only with `itxn` in v5). Application mode only + * Min AVM version: 5 */ logs(a: uint64, b: uint64): bytes /** * Number of Logs (only with `itxn` in v5). Application mode only + * Min AVM version: 1 */ numLogs(t: uint64): uint64 /** * Asset ID allocated by the creation of an ASA (only with `itxn` in v5). Application mode only + * Min AVM version: 1 */ createdAssetId(t: uint64): Asset /** * ApplicationID allocated by the creation of an application (only with `itxn` in v5). Application mode only + * Min AVM version: 1 */ createdApplicationId(t: uint64): Application /** * The last message emitted. Empty bytes if none were emitted. Application mode only + * Min AVM version: 1 */ lastLog(t: uint64): bytes /** * 64 byte state proof public key + * Min AVM version: 1 */ stateProofPk(t: uint64): bytes /** * Approval Program as an array of pages + * Min AVM version: 5 */ approvalProgramPages(a: uint64, b: uint64): bytes /** * Number of Approval Program pages + * Min AVM version: 1 */ numApprovalProgramPages(t: uint64): uint64 /** * ClearState Program as an array of pages + * Min AVM version: 5 */ clearStateProgramPages(a: uint64, b: uint64): bytes /** * Number of ClearState Program pages + * Min AVM version: 1 */ numClearStateProgramPages(t: uint64): uint64 } @@ -1396,6 +1697,7 @@ export type GTxnType = { /** * converts uint64 A to big-endian byte array, always of length 8 * @see Native TEAL opcode: [`itob`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#itob) + * Min AVM version: 1 */ export type ItobType = (a: uint64) => bytes @@ -1405,341 +1707,409 @@ export type ItobType = (a: uint64) => bytes export type ITxnType = { /** * 32 byte address + * Min AVM version: 5 */ get sender(): Account /** * microalgos + * Min AVM version: 5 */ get fee(): uint64 /** * round number + * Min AVM version: 5 */ get firstValid(): uint64 /** * UNIX timestamp of block before txn.FirstValid. Fails if negative + * Min AVM version: 5 */ get firstValidTime(): uint64 /** * round number + * Min AVM version: 5 */ get lastValid(): uint64 /** * Any data up to 1024 bytes + * Min AVM version: 5 */ get note(): bytes /** * 32 byte lease value + * Min AVM version: 5 */ get lease(): bytes /** * 32 byte address + * Min AVM version: 5 */ get receiver(): Account /** * microalgos + * Min AVM version: 5 */ get amount(): uint64 /** * 32 byte address + * Min AVM version: 5 */ get closeRemainderTo(): Account /** * 32 byte address + * Min AVM version: 5 */ get votePk(): bytes /** * 32 byte address + * Min AVM version: 5 */ get selectionPk(): bytes /** * The first round that the participation key is valid. + * Min AVM version: 5 */ get voteFirst(): uint64 /** * The last round that the participation key is valid. + * Min AVM version: 5 */ get voteLast(): uint64 /** * Dilution for the 2-level participation key + * Min AVM version: 5 */ get voteKeyDilution(): uint64 /** * Transaction type as bytes + * Min AVM version: 5 */ get type(): bytes /** * Transaction type as integer + * Min AVM version: 5 */ get typeEnum(): uint64 /** * Asset ID + * Min AVM version: 5 */ get xferAsset(): Asset /** * value in Asset's units + * Min AVM version: 5 */ get assetAmount(): uint64 /** * 32 byte address. Source of assets if Sender is the Asset's Clawback address. + * Min AVM version: 5 */ get assetSender(): Account /** * 32 byte address + * Min AVM version: 5 */ get assetReceiver(): Account /** * 32 byte address + * Min AVM version: 5 */ get assetCloseTo(): Account /** * Position of this transaction within an atomic transaction group. A stand-alone transaction is implicitly element 0 in a group of 1 + * Min AVM version: 5 */ get groupIndex(): uint64 /** * The computed ID for this transaction. 32 bytes. + * Min AVM version: 5 */ get txId(): bytes /** * ApplicationID from ApplicationCall transaction + * Min AVM version: 5 */ get applicationId(): Application /** * ApplicationCall transaction on completion action + * Min AVM version: 5 */ get onCompletion(): uint64 /** * Arguments passed to the application in the ApplicationCall transaction + * Min AVM version: 6 */ applicationArgs(a: uint64): bytes /** * Number of ApplicationArgs + * Min AVM version: 5 */ get numAppArgs(): uint64 /** * Accounts listed in the ApplicationCall transaction + * Min AVM version: 6 */ accounts(a: uint64): Account /** * Number of Accounts + * Min AVM version: 5 */ get numAccounts(): uint64 /** * Approval program + * Min AVM version: 5 */ get approvalProgram(): bytes /** * Clear state program + * Min AVM version: 5 */ get clearStateProgram(): bytes /** * 32 byte Sender's new AuthAddr + * Min AVM version: 5 */ get rekeyTo(): Account /** * Asset ID in asset config transaction + * Min AVM version: 5 */ get configAsset(): Asset /** * Total number of units of this asset created + * Min AVM version: 5 */ get configAssetTotal(): uint64 /** * Number of digits to display after the decimal place when displaying the asset + * Min AVM version: 5 */ get configAssetDecimals(): uint64 /** * Whether the asset's slots are frozen by default or not, 0 or 1 + * Min AVM version: 5 */ get configAssetDefaultFrozen(): boolean /** * Unit name of the asset + * Min AVM version: 5 */ get configAssetUnitName(): bytes /** * The asset name + * Min AVM version: 5 */ get configAssetName(): bytes /** * URL + * Min AVM version: 5 */ get configAssetUrl(): bytes /** * 32 byte commitment to unspecified asset metadata + * Min AVM version: 5 */ get configAssetMetadataHash(): bytes /** * 32 byte address + * Min AVM version: 5 */ get configAssetManager(): Account /** * 32 byte address + * Min AVM version: 5 */ get configAssetReserve(): Account /** * 32 byte address + * Min AVM version: 5 */ get configAssetFreeze(): Account /** * 32 byte address + * Min AVM version: 5 */ get configAssetClawback(): Account /** * Asset ID being frozen or un-frozen + * Min AVM version: 5 */ get freezeAsset(): Asset /** * 32 byte address of the account whose asset slot is being frozen or un-frozen + * Min AVM version: 5 */ get freezeAssetAccount(): Account /** * The new frozen value, 0 or 1 + * Min AVM version: 5 */ get freezeAssetFrozen(): boolean /** * Foreign Assets listed in the ApplicationCall transaction + * Min AVM version: 6 */ assets(a: uint64): Asset /** * Number of Assets + * Min AVM version: 5 */ get numAssets(): uint64 /** * Foreign Apps listed in the ApplicationCall transaction + * Min AVM version: 6 */ applications(a: uint64): Application /** * Number of Applications + * Min AVM version: 5 */ get numApplications(): uint64 /** * Number of global state integers in ApplicationCall + * Min AVM version: 5 */ get globalNumUint(): uint64 /** * Number of global state byteslices in ApplicationCall + * Min AVM version: 5 */ get globalNumByteSlice(): uint64 /** * Number of local state integers in ApplicationCall + * Min AVM version: 5 */ get localNumUint(): uint64 /** * Number of local state byteslices in ApplicationCall + * Min AVM version: 5 */ get localNumByteSlice(): uint64 /** * Number of additional pages for each of the application's approval and clear state programs. An ExtraProgramPages of 1 means 2048 more total bytes, or 1024 for each program. + * Min AVM version: 5 */ get extraProgramPages(): uint64 /** * Marks an account nonparticipating for rewards + * Min AVM version: 5 */ get nonparticipation(): boolean /** * Log messages emitted by an application call (only with `itxn` in v5). Application mode only + * Min AVM version: 6 */ logs(a: uint64): bytes /** * Number of Logs (only with `itxn` in v5). Application mode only + * Min AVM version: 5 */ get numLogs(): uint64 /** * Asset ID allocated by the creation of an ASA (only with `itxn` in v5). Application mode only + * Min AVM version: 5 */ get createdAssetId(): Asset /** * ApplicationID allocated by the creation of an application (only with `itxn` in v5). Application mode only + * Min AVM version: 5 */ get createdApplicationId(): Application /** * The last message emitted. Empty bytes if none were emitted. Application mode only + * Min AVM version: 5 */ get lastLog(): bytes /** * 64 byte state proof public key + * Min AVM version: 5 */ get stateProofPk(): bytes /** * Approval Program as an array of pages + * Min AVM version: 6 */ approvalProgramPages(a: uint64): bytes /** * Number of Approval Program pages + * Min AVM version: 5 */ get numApprovalProgramPages(): uint64 /** * ClearState Program as an array of pages + * Min AVM version: 6 */ clearStateProgramPages(a: uint64): bytes /** * Number of ClearState Program pages + * Min AVM version: 5 */ get numClearStateProgramPages(): uint64 } @@ -1752,261 +2122,313 @@ export type ITxnCreateType = { * begin preparation of a new inner transaction in a new transaction group * `itxn_begin` initializes Sender to the application address; Fee to the minimum allowable, taking into account MinTxnFee and credit from overpaying in earlier transactions; FirstValid/LastValid to the values in the invoking transaction, and all other fields to zero or empty values. * @see Native TEAL opcode: [`itxn_begin`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#itxn_begin) + * Min AVM version: 5 */ begin(): void /** * 32 byte address + * Min AVM version: 5 */ setSender(a: Account): void /** * microalgos + * Min AVM version: 5 */ setFee(a: uint64): void /** * Any data up to 1024 bytes + * Min AVM version: 5 */ setNote(a: bytes): void /** * 32 byte address + * Min AVM version: 5 */ setReceiver(a: Account): void /** * microalgos + * Min AVM version: 5 */ setAmount(a: uint64): void /** * 32 byte address + * Min AVM version: 5 */ setCloseRemainderTo(a: Account): void /** * 32 byte address + * Min AVM version: 5 */ setVotePk(a: bytes): void /** * 32 byte address + * Min AVM version: 5 */ setSelectionPk(a: bytes): void /** * The first round that the participation key is valid. + * Min AVM version: 5 */ setVoteFirst(a: uint64): void /** * The last round that the participation key is valid. + * Min AVM version: 5 */ setVoteLast(a: uint64): void /** * Dilution for the 2-level participation key + * Min AVM version: 5 */ setVoteKeyDilution(a: uint64): void /** * Transaction type as bytes + * Min AVM version: 5 */ setType(a: bytes): void /** * Transaction type as integer + * Min AVM version: 5 */ setTypeEnum(a: uint64): void /** * Asset ID + * Min AVM version: 5 */ setXferAsset(a: Asset | uint64): void /** * value in Asset's units + * Min AVM version: 5 */ setAssetAmount(a: uint64): void /** * 32 byte address. Source of assets if Sender is the Asset's Clawback address. + * Min AVM version: 5 */ setAssetSender(a: Account): void /** * 32 byte address + * Min AVM version: 5 */ setAssetReceiver(a: Account): void /** * 32 byte address + * Min AVM version: 5 */ setAssetCloseTo(a: Account): void /** * ApplicationID from ApplicationCall transaction + * Min AVM version: 5 */ setApplicationId(a: Application | uint64): void /** * ApplicationCall transaction on completion action + * Min AVM version: 5 */ setOnCompletion(a: uint64): void /** * Arguments passed to the application in the ApplicationCall transaction + * Min AVM version: 5 */ setApplicationArgs(a: bytes): void /** * Accounts listed in the ApplicationCall transaction + * Min AVM version: 5 */ setAccounts(a: Account): void /** * Approval program + * Min AVM version: 5 */ setApprovalProgram(a: bytes): void /** * Clear state program + * Min AVM version: 5 */ setClearStateProgram(a: bytes): void /** * 32 byte Sender's new AuthAddr + * Min AVM version: 5 */ setRekeyTo(a: Account): void /** * Asset ID in asset config transaction + * Min AVM version: 5 */ setConfigAsset(a: Asset | uint64): void /** * Total number of units of this asset created + * Min AVM version: 5 */ setConfigAssetTotal(a: uint64): void /** * Number of digits to display after the decimal place when displaying the asset + * Min AVM version: 5 */ setConfigAssetDecimals(a: uint64): void /** * Whether the asset's slots are frozen by default or not, 0 or 1 + * Min AVM version: 5 */ setConfigAssetDefaultFrozen(a: boolean): void /** * Unit name of the asset + * Min AVM version: 5 */ setConfigAssetUnitName(a: bytes): void /** * The asset name + * Min AVM version: 5 */ setConfigAssetName(a: bytes): void /** * URL + * Min AVM version: 5 */ setConfigAssetUrl(a: bytes): void /** * 32 byte commitment to unspecified asset metadata + * Min AVM version: 5 */ setConfigAssetMetadataHash(a: bytes): void /** * 32 byte address + * Min AVM version: 5 */ setConfigAssetManager(a: Account): void /** * 32 byte address + * Min AVM version: 5 */ setConfigAssetReserve(a: Account): void /** * 32 byte address + * Min AVM version: 5 */ setConfigAssetFreeze(a: Account): void /** * 32 byte address + * Min AVM version: 5 */ setConfigAssetClawback(a: Account): void /** * Asset ID being frozen or un-frozen + * Min AVM version: 5 */ setFreezeAsset(a: Asset | uint64): void /** * 32 byte address of the account whose asset slot is being frozen or un-frozen + * Min AVM version: 5 */ setFreezeAssetAccount(a: Account): void /** * The new frozen value, 0 or 1 + * Min AVM version: 5 */ setFreezeAssetFrozen(a: boolean): void /** * Foreign Assets listed in the ApplicationCall transaction + * Min AVM version: 5 */ setAssets(a: uint64): void /** * Foreign Apps listed in the ApplicationCall transaction + * Min AVM version: 5 */ setApplications(a: uint64): void /** * Number of global state integers in ApplicationCall + * Min AVM version: 5 */ setGlobalNumUint(a: uint64): void /** * Number of global state byteslices in ApplicationCall + * Min AVM version: 5 */ setGlobalNumByteSlice(a: uint64): void /** * Number of local state integers in ApplicationCall + * Min AVM version: 5 */ setLocalNumUint(a: uint64): void /** * Number of local state byteslices in ApplicationCall + * Min AVM version: 5 */ setLocalNumByteSlice(a: uint64): void /** * Number of additional pages for each of the application's approval and clear state programs. An ExtraProgramPages of 1 means 2048 more total bytes, or 1024 for each program. + * Min AVM version: 5 */ setExtraProgramPages(a: uint64): void /** * Marks an account nonparticipating for rewards + * Min AVM version: 5 */ setNonparticipation(a: boolean): void /** * 64 byte state proof public key + * Min AVM version: 5 */ setStateProofPk(a: bytes): void /** * Approval Program as an array of pages + * Min AVM version: 5 */ setApprovalProgramPages(a: bytes): void /** * ClearState Program as an array of pages + * Min AVM version: 5 */ setClearStateProgramPages(a: bytes): void @@ -2014,6 +2436,7 @@ export type ITxnCreateType = { * begin preparation of a new inner transaction in the same transaction group * `itxn_next` initializes the transaction exactly as `itxn_begin` does * @see Native TEAL opcode: [`itxn_next`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#itxn_next) + * Min AVM version: 6 */ next(): void @@ -2021,27 +2444,27 @@ export type ITxnCreateType = { * execute the current inner transaction group. Fail if executing this group would exceed the inner transaction limit, or if any transaction in the group fails. * `itxn_submit` resets the current transaction so that it can not be resubmitted. A new `itxn_begin` is required to prepare another inner transaction. * @see Native TEAL opcode: [`itxn_submit`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#itxn_submit) + * Min AVM version: 5 */ submit(): void } - export type JsonRefType = { jsonString(a: bytes, b: bytes): bytes - jsonUint64(a: bytes, b: bytes): uint64 - jsonObject(a: bytes, b: bytes): bytes } /** * Keccak256 hash of value A, yields [32]byte * @see Native TEAL opcode: [`keccak256`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#keccak256) + * Min AVM version: 1 */ export type Keccak256Type = (a: bytes) => bytes /** * yields length of byte value A * @see Native TEAL opcode: [`len`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#len) + * Min AVM version: 1 */ export type LenType = (a: bytes) => uint64 @@ -2052,18 +2475,21 @@ export type ScratchType = { /** * Ath scratch space value. All scratch spaces are 0 at program start. * @see Native TEAL opcode: [`loads`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#loads) + * Min AVM version: 5 */ loadBytes(a: uint64): bytes /** * Ath scratch space value. All scratch spaces are 0 at program start. * @see Native TEAL opcode: [`loads`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#loads) + * Min AVM version: 5 */ loadUint64(a: uint64): uint64 /** * store B to the Ath scratch space * @see Native TEAL opcode: [`stores`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#stores) + * Min AVM version: 5 */ store(a: uint64, b: uint64 | bytes): void } @@ -2073,425 +2499,532 @@ export type ScratchType = { * @param Txn.Accounts offset (or, since v4, an _available_ account address), _available_ application id (or, since v4, a Txn.ForeignApps offset). * * @return value. * @see Native TEAL opcode: [`min_balance`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#min_balance) + * Min AVM version: 3 */ export type MinBalanceType = (a: Account | uint64) => uint64 /** * A times B as a 128-bit result in two uint64s. X is the high 64 bits, Y is the low * @see Native TEAL opcode: [`mulw`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#mulw) + * Min AVM version: 1 */ export type MulwType = (a: uint64, b: uint64) => readonly [uint64, uint64] +/** + * the total online stake in the agreement round + * @see Native TEAL opcode: [`online_stake`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#online_stake) + * Min AVM version: 11 + */ +export type OnlineStakeType = () => uint64 + /** * Copy of A with the bytes starting at B replaced by the bytes of C. Fails if B+len(C) exceeds len(A) * `replace3` can be called using `replace` with no immediates. * @see Native TEAL opcode: [`replace3`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#replace3) + * Min AVM version: 7 */ export type ReplaceType = (a: bytes, b: uint64, c: bytes) => bytes /** * Copy of A with the Bth byte set to small integer (between 0..255) C. If B is greater than or equal to the array length, the program fails * @see Native TEAL opcode: [`setbyte`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#setbyte) + * Min AVM version: 3 */ export type SetByteType = (a: bytes, b: uint64, c: uint64) => bytes /** * SHA256 hash of value A, yields [32]byte * @see Native TEAL opcode: [`sha256`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#sha256) + * Min AVM version: 1 */ export type Sha256Type = (a: bytes) => bytes /** * SHA3_256 hash of value A, yields [32]byte * @see Native TEAL opcode: [`sha3_256`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#sha3_256) + * Min AVM version: 7 */ export type Sha3_256Type = (a: bytes) => bytes /** * SHA512_256 hash of value A, yields [32]byte * @see Native TEAL opcode: [`sha512_256`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#sha512_256) + * Min AVM version: 1 */ export type Sha512_256Type = (a: bytes) => bytes /** * A times 2^B, modulo 2^64 * @see Native TEAL opcode: [`shl`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#shl) + * Min AVM version: 4 */ export type ShlType = (a: uint64, b: uint64) => uint64 /** * A divided by 2^B * @see Native TEAL opcode: [`shr`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#shr) + * Min AVM version: 4 */ export type ShrType = (a: uint64, b: uint64) => uint64 /** * The largest integer I such that I^2 <= A * @see Native TEAL opcode: [`sqrt`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#sqrt) + * Min AVM version: 4 */ export type SqrtType = (a: uint64) => uint64 /** * A range of bytes from A starting at B up to but not including C. If C < B, or either is larger than the array length, the program fails * @see Native TEAL opcode: [`substring3`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#substring3) + * Min AVM version: 2 */ export type SubstringType = (a: bytes, b: uint64, c: uint64) => bytes +/** + * sumhash512 of value A, yields [64]byte + * @see Native TEAL opcode: [`sumhash512`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#sumhash512) + * Min AVM version: 11 + */ +export type Sumhash512Type = (a: bytes) => bytes + /** * Get values for the current executing transaction */ export type TxnType = { /** * 32 byte address + * Min AVM version: 1 */ get sender(): Account /** * microalgos + * Min AVM version: 1 */ get fee(): uint64 /** * round number + * Min AVM version: 1 */ get firstValid(): uint64 /** * UNIX timestamp of block before txn.FirstValid. Fails if negative + * Min AVM version: 1 */ get firstValidTime(): uint64 /** * round number + * Min AVM version: 1 */ get lastValid(): uint64 /** * Any data up to 1024 bytes + * Min AVM version: 1 */ get note(): bytes /** * 32 byte lease value + * Min AVM version: 1 */ get lease(): bytes /** * 32 byte address + * Min AVM version: 1 */ get receiver(): Account /** * microalgos + * Min AVM version: 1 */ get amount(): uint64 /** * 32 byte address + * Min AVM version: 1 */ get closeRemainderTo(): Account /** * 32 byte address + * Min AVM version: 1 */ get votePk(): bytes /** * 32 byte address + * Min AVM version: 1 */ get selectionPk(): bytes /** * The first round that the participation key is valid. + * Min AVM version: 1 */ get voteFirst(): uint64 /** * The last round that the participation key is valid. + * Min AVM version: 1 */ get voteLast(): uint64 /** * Dilution for the 2-level participation key + * Min AVM version: 1 */ get voteKeyDilution(): uint64 /** * Transaction type as bytes + * Min AVM version: 1 */ get type(): bytes /** * Transaction type as integer + * Min AVM version: 1 */ get typeEnum(): uint64 /** * Asset ID + * Min AVM version: 1 */ get xferAsset(): Asset /** * value in Asset's units + * Min AVM version: 1 */ get assetAmount(): uint64 /** * 32 byte address. Source of assets if Sender is the Asset's Clawback address. + * Min AVM version: 1 */ get assetSender(): Account /** * 32 byte address + * Min AVM version: 1 */ get assetReceiver(): Account /** * 32 byte address + * Min AVM version: 1 */ get assetCloseTo(): Account /** * Position of this transaction within an atomic transaction group. A stand-alone transaction is implicitly element 0 in a group of 1 + * Min AVM version: 1 */ get groupIndex(): uint64 /** * The computed ID for this transaction. 32 bytes. + * Min AVM version: 1 */ get txId(): bytes /** * ApplicationID from ApplicationCall transaction + * Min AVM version: 1 */ get applicationId(): Application /** * ApplicationCall transaction on completion action + * Min AVM version: 1 */ get onCompletion(): uint64 /** * Arguments passed to the application in the ApplicationCall transaction + * Min AVM version: 5 */ applicationArgs(a: uint64): bytes /** * Number of ApplicationArgs + * Min AVM version: 1 */ get numAppArgs(): uint64 /** * Accounts listed in the ApplicationCall transaction + * Min AVM version: 5 */ accounts(a: uint64): Account /** * Number of Accounts + * Min AVM version: 1 */ get numAccounts(): uint64 /** * Approval program + * Min AVM version: 1 */ get approvalProgram(): bytes /** * Clear state program + * Min AVM version: 1 */ get clearStateProgram(): bytes /** * 32 byte Sender's new AuthAddr + * Min AVM version: 1 */ get rekeyTo(): Account /** * Asset ID in asset config transaction + * Min AVM version: 1 */ get configAsset(): Asset /** * Total number of units of this asset created + * Min AVM version: 1 */ get configAssetTotal(): uint64 /** * Number of digits to display after the decimal place when displaying the asset + * Min AVM version: 1 */ get configAssetDecimals(): uint64 /** * Whether the asset's slots are frozen by default or not, 0 or 1 + * Min AVM version: 1 */ get configAssetDefaultFrozen(): boolean /** * Unit name of the asset + * Min AVM version: 1 */ get configAssetUnitName(): bytes /** * The asset name + * Min AVM version: 1 */ get configAssetName(): bytes /** * URL + * Min AVM version: 1 */ get configAssetUrl(): bytes /** * 32 byte commitment to unspecified asset metadata + * Min AVM version: 1 */ get configAssetMetadataHash(): bytes /** * 32 byte address + * Min AVM version: 1 */ get configAssetManager(): Account /** * 32 byte address + * Min AVM version: 1 */ get configAssetReserve(): Account /** * 32 byte address + * Min AVM version: 1 */ get configAssetFreeze(): Account /** * 32 byte address + * Min AVM version: 1 */ get configAssetClawback(): Account /** * Asset ID being frozen or un-frozen + * Min AVM version: 1 */ get freezeAsset(): Asset /** * 32 byte address of the account whose asset slot is being frozen or un-frozen + * Min AVM version: 1 */ get freezeAssetAccount(): Account /** * The new frozen value, 0 or 1 + * Min AVM version: 1 */ get freezeAssetFrozen(): boolean /** * Foreign Assets listed in the ApplicationCall transaction + * Min AVM version: 5 */ assets(a: uint64): Asset /** * Number of Assets + * Min AVM version: 1 */ get numAssets(): uint64 /** * Foreign Apps listed in the ApplicationCall transaction + * Min AVM version: 5 */ applications(a: uint64): Application /** * Number of Applications + * Min AVM version: 1 */ get numApplications(): uint64 /** * Number of global state integers in ApplicationCall + * Min AVM version: 1 */ get globalNumUint(): uint64 /** * Number of global state byteslices in ApplicationCall + * Min AVM version: 1 */ get globalNumByteSlice(): uint64 /** * Number of local state integers in ApplicationCall + * Min AVM version: 1 */ get localNumUint(): uint64 /** * Number of local state byteslices in ApplicationCall + * Min AVM version: 1 */ get localNumByteSlice(): uint64 /** * Number of additional pages for each of the application's approval and clear state programs. An ExtraProgramPages of 1 means 2048 more total bytes, or 1024 for each program. + * Min AVM version: 1 */ get extraProgramPages(): uint64 /** * Marks an account nonparticipating for rewards + * Min AVM version: 1 */ get nonparticipation(): boolean /** * Log messages emitted by an application call (only with `itxn` in v5). Application mode only + * Min AVM version: 5 */ logs(a: uint64): bytes /** * Number of Logs (only with `itxn` in v5). Application mode only + * Min AVM version: 1 */ get numLogs(): uint64 /** * Asset ID allocated by the creation of an ASA (only with `itxn` in v5). Application mode only + * Min AVM version: 1 */ get createdAssetId(): Asset /** * ApplicationID allocated by the creation of an application (only with `itxn` in v5). Application mode only + * Min AVM version: 1 */ get createdApplicationId(): Application /** * The last message emitted. Empty bytes if none were emitted. Application mode only + * Min AVM version: 1 */ get lastLog(): bytes /** * 64 byte state proof public key + * Min AVM version: 1 */ get stateProofPk(): bytes /** * Approval Program as an array of pages + * Min AVM version: 5 */ approvalProgramPages(a: uint64): bytes /** * Number of Approval Program pages + * Min AVM version: 1 */ get numApprovalProgramPages(): uint64 /** * ClearState Program as an array of pages + * Min AVM version: 5 */ clearStateProgramPages(a: uint64): bytes /** * Number of ClearState Program pages + * Min AVM version: 1 */ get numClearStateProgramPages(): uint64 } +export type VoterParamsType = { + /** + * Online stake in microalgos + * Min AVM version: 11 + */ + voterBalance(a: uint64 | bytes): readonly [uint64, boolean] + + /** + * Had this account opted into block payouts + * Min AVM version: 11 + */ + voterIncentiveEligible(a: uint64 | bytes): readonly [boolean, boolean] +} /** * Verify the proof B of message A against pubkey C. Returns vrf output and verification flag. * `VrfAlgorand` is the VRF used in Algorand. It is ECVRF-ED25519-SHA512-Elligator2, specified in the IETF internet draft [draft-irtf-cfrg-vrf-03](https://datatracker.ietf.org/doc/draft-irtf-cfrg-vrf/03/). * @see Native TEAL opcode: [`vrf_verify`](https://developer.algorand.org/docs/get-details/dapps/avm/teal/opcodes/v10/#vrf_verify) + * Min AVM version: 7 */ export type VrfVerifyType = (s: VrfVerify, a: bytes, b: bytes, c: bytes) => readonly [bytes, boolean] export type SelectType = ((a: bytes, b: bytes, c: uint64) => bytes) & ((a: uint64, b: uint64, c: uint64) => uint64) export type SetBitType = ((target: bytes, n: uint64, c: uint64) => bytes) & ((target: uint64, n: uint64, c: uint64) => uint64) /* THIS FILE IS GENERATED BY ~/scripts/generate-op-types.ts - DO NOT MODIFY DIRECTLY */ -import { bytes, BytesCompat, uint64, Uint64Compat, biguint } from './primitives' +import { biguint, bytes, uint64 } from './primitives' import { Account, Application, Asset } from './reference' export type OpsNamespace = { @@ -2527,6 +3060,7 @@ export type OpsNamespace = { extractUint16: ExtractUint16Type extractUint32: ExtractUint32Type extractUint64: ExtractUint64Type + falconVerify: FalconVerifyType gaid: GaidType getBit: GetBitType getByte: GetByteType @@ -2544,6 +3078,7 @@ export type OpsNamespace = { Scratch: ScratchType minBalance: MinBalanceType mulw: MulwType + onlineStake: OnlineStakeType replace: ReplaceType setByte: SetByteType sha256: Sha256Type @@ -2553,7 +3088,9 @@ export type OpsNamespace = { shr: ShrType sqrt: SqrtType substring: SubstringType + sumhash512: Sumhash512Type Txn: TxnType + VoterParams: VoterParamsType vrfVerify: VrfVerifyType select: SelectType setBit: SetBitType diff --git a/packages/algo-ts/src/op.ts b/packages/algo-ts/src/op.ts index ca00fecb..42b17079 100644 --- a/packages/algo-ts/src/op.ts +++ b/packages/algo-ts/src/op.ts @@ -23,6 +23,7 @@ import { ExtractUint16Type, ExtractUint32Type, ExtractUint64Type, + FalconVerifyType, GaidType, GetBitType, GetByteType, @@ -37,6 +38,7 @@ import { JsonRefType, Keccak256Type, MulwType, + OnlineStakeType, OpsNamespace, ReplaceType, ScratchType, @@ -50,6 +52,7 @@ import { ShrType, SqrtType, SubstringType, + Sumhash512Type, TxnType, VrfVerifyType, } from './op-types' @@ -120,6 +123,9 @@ export const shr: ShrType = createFunctionProxy('shr') export const sqrt: SqrtType = createFunctionProxy('sqrt') export const substring: SubstringType = createFunctionProxy('substring') export const vrfVerify: VrfVerifyType = createFunctionProxy('vrfVerify') +export const onlineStake: OnlineStakeType = createFunctionProxy('onlineStake') +export const falconVerify: FalconVerifyType = createFunctionProxy('falconVerify') +export const sumhash512: Sumhash512Type = createFunctionProxy('sumhash512') export const EllipticCurve: EllipticCurveType = createObjectProxy('EllipticCurve') export const Global: GlobalType = createObjectProxy('Global') @@ -139,3 +145,4 @@ export const AssetHolding = createObjectProxy('AssetHolding') export const AssetParams = createObjectProxy('AssetParams') export const Block = createObjectProxy('Block') export const Box = createObjectProxy('Box') +export const VoterParams = createObjectProxy('VoterParams') diff --git a/scripts/build-op-module.ts b/scripts/build-op-module.ts index 27d6565d..c9f358c3 100644 --- a/scripts/build-op-module.ts +++ b/scripts/build-op-module.ts @@ -159,6 +159,8 @@ const TYPE_MAP: Record = { '[33]byte': AlgoTsType.Bytes, '[64]byte': AlgoTsType.Bytes, '[80]byte': AlgoTsType.Bytes, + '[1232]byte': AlgoTsType.Bytes, + '[1793]byte': AlgoTsType.Bytes, any: AlgoTsType.Uint64 | AlgoTsType.Bytes, } @@ -176,7 +178,7 @@ const INPUT_ALGOTS_TYPE_MAP: Record = { [AlgoTsType.Account]: AlgoTsType.Account, [AlgoTsType.Void]: AlgoTsType.Void, [AlgoTsType.BigUint]: AlgoTsType.BigUint, - [AlgoTsType.Enum]: AlgoTsType.Enum + [AlgoTsType.Enum]: AlgoTsType.Enum, } const ARG_ENUMS = Object.entries(langSpec.arg_enums).map(([name, values], index): EnumDef => { @@ -284,6 +286,7 @@ const GROUPED_OPCODES: { name: string; doc: string; ops: { [key: string]: OpName { name: 'AppParams', doc: '', ops: { app_params_get: {} } }, { name: 'AssetHolding', doc: '', ops: { asset_holding_get: {} } }, { name: 'AssetParams', doc: '', ops: { asset_params_get: {} } }, + { name: 'VoterParams', doc: '', ops: { voter_params_get: {} } }, { name: 'Global', doc: '', ops: { global: {} } }, { name: 'Block', doc: '', ops: { block: {} } }, { name: 'JsonRef', doc: '', ops: { json_ref: {} } }, @@ -305,6 +308,7 @@ export type EnumArgMeta = { export type OpOverloadedFunction = { type: 'op-overloaded-function' + minAvmVersion: number signatures: Array<{ immediateArgs: OpArg[]; stackArgs: OpArg[]; returnTypes: AlgoTsType[]; docs: string[] | string }> name: string opCode: string @@ -318,6 +322,7 @@ export type OpFunction = { returnTypes: AlgoTsType[] name: string opCode: string + minAvmVersion: number docs: string[] | string } @@ -408,6 +413,7 @@ export function buildOpModule() { for (const member of enumDef.members) { opFunctions.push({ type: 'op-function', + minAvmVersion: def.min_avm_version, opCode, enumArg: { member: member.name, @@ -415,7 +421,10 @@ export function buildOpModule() { }, docs: member.doc, name: getEnumOpName(member.name, opNameConfig), - immediateArgs: def.immediate_args.map((i) => ({ name: camelCase(i.name), type: getMappedType(i.immediate_type, i.arg_enum, true) })), + immediateArgs: def.immediate_args.map((i) => ({ + name: camelCase(i.name), + type: getMappedType(i.immediate_type, i.arg_enum, true), + })), stackArgs: def.stack_inputs.map((sa, i) => { if (i === enumArg.modifies_stack_input) { invariant(member.stackType, 'Member must have stack type') @@ -437,8 +446,12 @@ export function buildOpModule() { ...splitUnionReturnTypes({ type: 'op-function', opCode: opCode, + minAvmVersion: def.min_avm_version, name: getOpName(def.name, opNameConfig), - immediateArgs: def.immediate_args.map((i) => ({ name: camelCase(i.name), type: getMappedType(i.immediate_type, i.arg_enum, true) })), + immediateArgs: def.immediate_args.map((i) => ({ + name: camelCase(i.name), + type: getMappedType(i.immediate_type, i.arg_enum, true), + })), stackArgs: def.stack_inputs.map((i) => ({ name: camelCase(i.name), type: getMappedType(i.stack_type, null, true) })), returnTypes: def.stack_outputs.map((o) => getMappedType(o.stack_type, null)), docs: getOpDocs(def), @@ -458,6 +471,7 @@ export function buildOpModule() { opModule.items.push({ type: 'op-overloaded-function', name: 'select', + minAvmVersion: 3, signatures: [ { stackArgs: [ @@ -505,6 +519,7 @@ export function buildOpModule() { opModule.items.push({ type: 'op-overloaded-function', name: 'setBit', + minAvmVersion: 3, signatures: [ { stackArgs: [ @@ -569,7 +584,7 @@ function getMappedType(t: string | null, enumName: string | null, isInput: boole invariant(enumDef, `Definition must exist for ${enumName}`) return enumDef.typeFlag } - const mappedType = isInput ? INPUT_TYPE_MAP[t ?? ''] ?? TYPE_MAP[t ?? ''] : TYPE_MAP[t ?? ''] + const mappedType = isInput ? (INPUT_TYPE_MAP[t ?? ''] ?? TYPE_MAP[t ?? '']) : TYPE_MAP[t ?? ''] invariant(mappedType, `Mapped type must exist for ${t}`) return mappedType } diff --git a/scripts/generate-op-types.ts b/scripts/generate-op-types.ts index 38ad64bb..392b40a0 100644 --- a/scripts/generate-op-types.ts +++ b/scripts/generate-op-types.ts @@ -13,20 +13,22 @@ import { Account, Application, Asset } from './reference' ` } - function* emitDoc(doc: string | string[]) { + function* emitDoc(doc: string | string[], minAvmVersion?: number) { if (Array.isArray(doc)) { yield '\n/**' for (const row of doc) { yield '\n * ' yield row } - yield '\n */' } else if (doc) { yield '\n/**' yield '\n * ' yield doc - yield '\n */' + } else { + return } + if (minAvmVersion !== undefined) yield `\n * Min AVM version: ${minAvmVersion}` + yield '\n */' yield '\n' } function* emitEnums() { @@ -94,7 +96,7 @@ import { Account, Application, Asset } from './reference' for (const item of module.items) { if (item.type === 'op-function') { - yield* emitDoc(item.docs) + yield* emitDoc(item.docs, item.minAvmVersion) yield `export type ${pascalCase(item.name)}Type = (` for (const arg of item.immediateArgs) { yield arg.name @@ -138,7 +140,7 @@ import { Account, Application, Asset } from './reference' for (const ol of Object.values(item.functions)) { yield '\n' - yield* emitDoc(ol.docs) + yield* emitDoc(ol.docs, ol.minAvmVersion) if (ol.stackArgs.length === 0 && ol.immediateArgs.length === 1) { yield 'get ' } diff --git a/src/awst_build/ast-visitors/contract-method-visitor.ts b/src/awst_build/ast-visitors/contract-method-visitor.ts index 40f0a45d..94e7007b 100644 --- a/src/awst_build/ast-visitors/contract-method-visitor.ts +++ b/src/awst_build/ast-visitors/contract-method-visitor.ts @@ -1,4 +1,4 @@ -import ts from 'typescript' +import type ts from 'typescript' import type { DefaultArgumentSource } from '../../awst/models' import { ARC4ABIMethodConfig, ARC4BareMethodConfig, ARC4CreateOption, ContractReference, OnCompletionAction } from '../../awst/models' import * as awst from '../../awst/nodes' @@ -12,10 +12,10 @@ import type { AwstBuildContext } from '../context/awst-build-context' import type { NodeBuilder } from '../eb' import { ContractSuperBuilder, ContractThisBuilder } from '../eb/contract-builder' import { isValidLiteralForPType } from '../eb/util' +import type { Arc4AbiDecoratorData, DecoratorData } from '../models/decorator-data' import type { FunctionPType } from '../ptypes' import { ContractClassPType, GlobalStateType } from '../ptypes' import { ARC4StructType } from '../ptypes/arc4-types' -import type { Arc4AbiDecoratorData, DecoratorData } from './decorator-visitor' import { DecoratorVisitor } from './decorator-visitor' import { FunctionVisitor } from './function-visitor' @@ -50,24 +50,13 @@ export class ContractMethodVisitor extends ContractMethodBaseVisitor { const { args, body, documentation } = this.buildFunctionAwst(node) const cref = ContractReference.fromPType(this._contractType) - const decorators = (node.modifiers ?? []).flatMap((modifier) => { - if (!ts.isDecorator(modifier)) return [] - - return DecoratorVisitor.buildDecoratorData(this.context, modifier) - }) - - if (decorators.length > 1) { - logger.error( - sourceLocation, - 'Only one decorator is allowed per method. Multiple on complete actions can be provided in a single decorator', - ) - } + const decorator = DecoratorVisitor.buildContractMethodData(ctx, node) const modifiers = this.parseMemberModifiers(node) const arc4MethodConfig = this.buildArc4Config({ functionType: this._functionType, - decorator: decorators[0], + decorator, modifiers, methodLocation: sourceLocation, }) diff --git a/src/awst_build/ast-visitors/contract-visitor.ts b/src/awst_build/ast-visitors/contract-visitor.ts index 687a88a9..18d8593b 100644 --- a/src/awst_build/ast-visitors/contract-visitor.ts +++ b/src/awst_build/ast-visitors/contract-visitor.ts @@ -23,6 +23,7 @@ import type { ContractClassPType } from '../ptypes' import { BaseVisitor } from './base-visitor' import { ConstructorVisitor } from './constructor-visitor' import { ContractMethodVisitor } from './contract-method-visitor' +import { DecoratorVisitor } from './decorator-visitor' export class ContractVisitor extends BaseVisitor implements Visitor { private _ctor?: ContractMethod @@ -40,6 +41,8 @@ export class ContractVisitor extends BaseVisitor implements Visitor m.kind === ts.SyntaxKind.AbstractKeyword)) for (const property of classDec.members.filter(ts.isPropertyDeclaration)) { @@ -68,14 +71,8 @@ export class ContractVisitor extends BaseVisitor implements Visitor -} - -export type Arc4BareDecoratorData = { - type: typeof Constants.arc4BareDecoratorName - create: ARC4CreateOption - ocas: OnCompletionAction[] - sourceLocation: SourceLocation -} - -export type DecoratorData = Arc4BareDecoratorData | Arc4AbiDecoratorData - export class DecoratorVisitor extends BaseVisitor { private accept = (node: TNode) => accept(this, node) @@ -50,7 +21,68 @@ export class DecoratorVisitor extends BaseVisitor { this.result = expr.resolveDecoratorData() } - static buildDecoratorData(context: AwstBuildContext, node: ts.Decorator): DecoratorData { - return new DecoratorVisitor(context.createChildContext(), node).result + private static buildDecoratorData(context: AwstBuildContext, node: { modifiers?: ts.NodeArray }): DecoratorData[] { + return ( + node.modifiers?.flatMap((modifier) => { + if (!ts.isDecorator(modifier)) return [] + try { + return new DecoratorVisitor(context.createChildContext(), modifier).result + } catch (e) { + if (e instanceof AwstBuildFailureError) { + return [] + } + throw e + } + }) ?? [] + ) + } + + static buildContractData(context: AwstBuildContext, target: ts.ClassDeclaration) { + const data = DecoratorVisitor.buildDecoratorData(context, target) + return DecoratorVisitor.filterDecoratorData( + data, + ['contract'], + (t) => `${t} is not supported on contracts`, + 'Only one decorator is allowed per contract.', + ) + } + static buildLogicSigData(context: AwstBuildContext, target: ts.ClassDeclaration) { + const data = DecoratorVisitor.buildDecoratorData(context, target) + return DecoratorVisitor.filterDecoratorData( + data, + ['logicsig'], + (t) => `${t} is not supported on logic signatures`, + 'Only one decorator is allowed per logic signature.', + ) + } + static buildContractMethodData(context: AwstBuildContext, target: ts.MethodDeclaration) { + const data = DecoratorVisitor.buildDecoratorData(context, target) + return DecoratorVisitor.filterDecoratorData( + data, + ['arc4.abimethod', 'arc4.baremethod'], + (t) => `${t} is not supported on contract methods`, + 'Only one decorator is allowed per method. Multiple on complete actions can be provided in a single decorator', + ) + } + + private static filterDecoratorData( + decoratorData: DecoratorData[], + types: TType[], + notSupportedMessage: (type: DecoratorType) => string, + duplicateMessage: string, + ): DecoratorDataForType | undefined { + let data: DecoratorDataForType | undefined + for (const d of decoratorData) { + if (isIn(d.type, types)) { + if (data === undefined) { + data = d as DecoratorDataForType + } else { + logger.error(d.sourceLocation, duplicateMessage) + } + } else { + logger.error(d.sourceLocation, notSupportedMessage(d.type)) + } + } + return data } } diff --git a/src/awst_build/ast-visitors/logic-sig-visitor.ts b/src/awst_build/ast-visitors/logic-sig-visitor.ts index 0aec0c58..f10ee21d 100644 --- a/src/awst_build/ast-visitors/logic-sig-visitor.ts +++ b/src/awst_build/ast-visitors/logic-sig-visitor.ts @@ -15,6 +15,7 @@ import type { LogicSigPType } from '../ptypes' import { boolPType, FunctionPType, uint64PType } from '../ptypes' import { ptypeIn } from '../ptypes/util' import { BaseVisitor } from './base-visitor' +import { DecoratorVisitor } from './decorator-visitor' import { LogicSigProgramVisitor } from './logic-sig-program-visitor' export class LogicSigVisitor extends BaseVisitor implements Visitor { @@ -39,6 +40,8 @@ export class LogicSigVisitor extends BaseVisitor implements Visitor { @@ -110,3 +121,33 @@ export class ContractClassBuilder extends InstanceBuilder { throw new CodeError('Contract class cannot be called manually') } } + +export class ContractOptionsDecoratorBuilder extends FunctionBuilder { + readonly ptype = contractOptionsDecorator + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + const { + args: [{ avmVersion, name }], + } = parseFunctionArgs({ + args, + typeArgs, + genericTypeArgs: 0, + callLocation: sourceLocation, + funcName: this.typeDescription, + argSpec: (a) => [ + a.obj({ + avmVersion: a.optional(numberPType), + name: a.optional(stringPType), + scratchSlots: a.optional(), + stateTotals: a.optional(), + }), + ], + }) + + return new DecoratorDataBuilder(sourceLocation, { + type: 'contract', + avmVersion: avmVersion ? requireAvmVersion(avmVersion) : undefined, + name: name ? requireStringConstant(name).value : undefined, + sourceLocation, + }) + } +} diff --git a/src/awst_build/eb/index.ts b/src/awst_build/eb/index.ts index fd21e86e..486c969f 100644 --- a/src/awst_build/eb/index.ts +++ b/src/awst_build/eb/index.ts @@ -5,6 +5,7 @@ import { TupleItemExpression } from '../../awst/nodes' import type { SourceLocation } from '../../awst/source-location' import { CodeError, NotSupported } from '../../errors' import { logger } from '../../logger' +import type { DecoratorData } from '../models/decorator-data' import type { LibClassType, PType, PTypeOrClass } from '../ptypes' import { instanceEb } from '../type-registry' @@ -272,3 +273,19 @@ export function requireLValue(expr: awst.Expression): awst.LValue { } return expr as awst.LValue } + +export class DecoratorDataBuilder extends NodeBuilder { + get ptype(): PType | undefined { + return undefined + } + constructor( + sourceLocation: SourceLocation, + private readonly data: DecoratorData, + ) { + super(sourceLocation) + } + + resolveDecoratorData(): DecoratorData { + return this.data + } +} diff --git a/src/awst_build/eb/logic-sig-builder.ts b/src/awst_build/eb/logic-sig-builder.ts index 7d6a33e7..44b81ca0 100644 --- a/src/awst_build/eb/logic-sig-builder.ts +++ b/src/awst_build/eb/logic-sig-builder.ts @@ -2,8 +2,11 @@ import type { Expression, LValue } from '../../awst/nodes' import type { SourceLocation } from '../../awst/source-location' import { CodeError } from '../../errors' import { invariant } from '../../util' -import { LogicSigPType, type PType } from '../ptypes' -import { InstanceBuilder, type NodeBuilder } from './index' +import { logicSigOptionsDecorator, LogicSigPType, numberPType, type PType, stringPType } from '../ptypes' +import { DecoratorDataBuilder, FunctionBuilder, InstanceBuilder, type NodeBuilder } from './index' +import { requireStringConstant } from './util' +import { parseFunctionArgs } from './util/arg-parsing' +import { requireAvmVersion } from './util/avm-version' export class LogicSigClassBuilder extends InstanceBuilder { resolve(): Expression { @@ -27,3 +30,32 @@ export class LogicSigClassBuilder extends InstanceBuilder { throw new CodeError('LogicSig class cannot be called manually') } } + +export class LogicSigOptionsDecoratorBuilder extends FunctionBuilder { + readonly ptype = logicSigOptionsDecorator + + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + const { + args: [{ avmVersion, name }], + } = parseFunctionArgs({ + args, + typeArgs, + genericTypeArgs: 0, + callLocation: sourceLocation, + funcName: this.typeDescription, + argSpec: (a) => [ + a.obj({ + avmVersion: a.optional(numberPType), + name: a.optional(stringPType), + }), + ], + }) + + return new DecoratorDataBuilder(sourceLocation, { + type: 'logicsig', + avmVersion: avmVersion ? requireAvmVersion(avmVersion) : undefined, + name: name ? requireStringConstant(name).value : undefined, + sourceLocation, + }) + } +} diff --git a/src/awst_build/eb/util/avm-version.ts b/src/awst_build/eb/util/avm-version.ts new file mode 100644 index 00000000..7a87218f --- /dev/null +++ b/src/awst_build/eb/util/avm-version.ts @@ -0,0 +1,11 @@ +import type { SupportedAvmVersion } from '../../../constants' +import { Constants } from '../../../constants' +import { codeInvariant, isIn } from '../../../util' +import type { NodeBuilder } from '../index' +import { requireIntegerConstant } from './index' + +export function requireAvmVersion(builder: NodeBuilder): SupportedAvmVersion { + const value = requireIntegerConstant(builder) + codeInvariant(isIn(value.value, Constants.supportedAvmVersions), `${value.value} is not a supported AVM version`, value.sourceLocation) + return value.value as SupportedAvmVersion +} diff --git a/src/awst_build/lib/index.ts b/src/awst_build/lib/index.ts index 471e8442..c0b523a7 100644 --- a/src/awst_build/lib/index.ts +++ b/src/awst_build/lib/index.ts @@ -28,10 +28,9 @@ export function buildLibAwst(context: AwstBuildContext) { bases: [], methods: [], appState: [], - stateTotals: null, + options: undefined, description: null, sourceLocation: SourceLocation.None, - reservedScratchSpace: new Set(), approvalProgram: null, clearProgram: nodeFactory.contractMethod({ memberName: Constants.clearStateProgramMethodName, @@ -81,12 +80,11 @@ export function buildLibAwst(context: AwstBuildContext) { }), methods: [], appState: [], - stateTotals: null, + options: undefined, description: null, bases: [baseContractCref], clearProgram: null, sourceLocation: SourceLocation.None, - reservedScratchSpace: new Set(), approvalProgram: nodeFactory.contractMethod({ memberName: Constants.approvalProgramMethodName, cref: contractCref, diff --git a/src/awst_build/models/contract-class-model.ts b/src/awst_build/models/contract-class-model.ts index 1b35fa5b..3dca9a67 100644 --- a/src/awst_build/models/contract-class-model.ts +++ b/src/awst_build/models/contract-class-model.ts @@ -2,7 +2,8 @@ import type { awst } from '../../awst' import type { LogicSigReference } from '../../awst/models' import { ARC4BareMethodConfig, ARC4CreateOption, ContractReference, OnCompletionAction } from '../../awst/models' import { nodeFactory } from '../../awst/node-factory' -import type { AppStorageDefinition, ContractMethod, Statement, StateTotals } from '../../awst/nodes' +import type { AppStorageDefinition, ContractMethod, Statement } from '../../awst/nodes' +import { StateTotals } from '../../awst/nodes' import { SourceLocation } from '../../awst/source-location' import { wtypes } from '../../awst/wtypes' import { Constants } from '../../constants' @@ -11,6 +12,7 @@ import type { Props } from '../../typescript-helpers' import { codeInvariant, invariant, isIn } from '../../util' import { CustomKeyMap } from '../../util/custom-key-map' import type { ContractClassPType } from '../ptypes' +import type { ContractOptionsDecoratorData } from './decorator-data' import { LogicSigClassModel } from './logic-sig-class-model' export class ContractClassModel { @@ -22,6 +24,7 @@ export class ContractClassModel { public get name(): string { return this.type.name } + public readonly options: ContractOptionsDecoratorData | undefined public readonly description: string | null public readonly bases: Array public readonly propertyInitialization: Array @@ -30,8 +33,6 @@ export class ContractClassModel { public readonly ctor: ContractMethod public readonly methods: Array public readonly appState: Array - public readonly stateTotals: StateTotals | null - public readonly reservedScratchSpace: Set public readonly sourceLocation: SourceLocation constructor(props: Props>) { this.isAbstract = props.isAbstract @@ -44,9 +45,8 @@ export class ContractClassModel { this.clearProgram = props.clearProgram this.methods = props.methods this.appState = props.appState - this.stateTotals = props.stateTotals this.sourceLocation = props.sourceLocation - this.reservedScratchSpace = props.reservedScratchSpace + this.options = props.options } buildContract(compilationSet: CompilationSet): awst.Contract { @@ -90,8 +90,31 @@ export class ContractClassModel { codeInvariant(approvalProgram, 'must have approval') codeInvariant(clearProgram, 'must have clear') + + // TODO: Tally from bases + const stateTotals = new StateTotals({ + globalBytes: this.options?.stateTotals?.globalBytes ?? null, + globalUints: this.options?.stateTotals?.globalUints ?? null, + localBytes: this.options?.stateTotals?.localBytes ?? null, + localUints: this.options?.stateTotals?.localUints ?? null, + }) + + // TODO: Tally from bases + const reservedScratchSpace = new Set() + if (this.options?.scratchSlots) { + for (const reservation of this.options.scratchSlots) { + if (typeof reservation === 'bigint') { + reservedScratchSpace.add(reservation) + } else { + for (let i = reservation.from; i <= reservation.to; i++) { + reservedScratchSpace.add(i) + } + } + } + } + return nodeFactory.contract({ - name: this.name, + name: this.options?.name ?? this.name, id: this.id, description: this.description, approvalProgram: this.patchApprovalToCallCtor(approvalProgram), @@ -99,10 +122,10 @@ export class ContractClassModel { methodResolutionOrder, methods, appState: this.appState, // TODO: Tally from base - stateTotals: this.stateTotals, // TODO: Tally - reservedScratchSpace: this.reservedScratchSpace, + stateTotals: stateTotals, // TODO: Tally + reservedScratchSpace: reservedScratchSpace, sourceLocation: this.sourceLocation, - avmVersion: null, // TODO: Allow this to be set with class decorator + avmVersion: this.options?.avmVersion ?? null, // TODO: Allow this to be set with class decorator }) } diff --git a/src/awst_build/models/decorator-data.ts b/src/awst_build/models/decorator-data.ts new file mode 100644 index 00000000..e796794c --- /dev/null +++ b/src/awst_build/models/decorator-data.ts @@ -0,0 +1,61 @@ +import type { ARC4CreateOption, OnCompletionAction } from '../../awst/models' +import type { SourceLocation } from '../../awst/source-location' +import type { Constants, SupportedAvmVersion } from '../../constants' + +export type Arc4AbiDecoratorData = { + type: typeof Constants.arc4AbiDecoratorName + create: ARC4CreateOption + ocas: OnCompletionAction[] + sourceLocation: SourceLocation + readonly: boolean + nameOverride: string | undefined + defaultArguments: Record< + string, + | { + type: 'constant' + value: string | boolean | bigint | Uint8Array + } + | { + type: 'member' + name: string + } + > +} + +export type Arc4BareDecoratorData = { + type: typeof Constants.arc4BareDecoratorName + create: ARC4CreateOption + ocas: OnCompletionAction[] + sourceLocation: SourceLocation +} + +export type LogicSigOptionsDecoratorData = { + type: typeof Constants.logicSigOptionsDecoratorName + sourceLocation: SourceLocation + avmVersion?: SupportedAvmVersion + name?: string +} +type NumberRange = { from: bigint; to: bigint } +export type ContractOptionsDecoratorData = { + type: typeof Constants.contractOptionsDecoratorName + sourceLocation: SourceLocation + avmVersion?: SupportedAvmVersion + name?: string + scratchSlots?: Array + stateTotals?: { + globalUints?: bigint + globalBytes?: bigint + localUints?: bigint + localBytes?: bigint + } +} + +export type DecoratorData = Arc4BareDecoratorData | Arc4AbiDecoratorData | LogicSigOptionsDecoratorData | ContractOptionsDecoratorData + +export type DecoratorType = DecoratorData['type'] + +export type DecoratorDataForType = DecoratorData extends infer TDec + ? TDec extends { type: TType } + ? TDec + : never + : never diff --git a/src/awst_build/models/logic-sig-class-model.ts b/src/awst_build/models/logic-sig-class-model.ts index 90158a3d..f300530e 100644 --- a/src/awst_build/models/logic-sig-class-model.ts +++ b/src/awst_build/models/logic-sig-class-model.ts @@ -4,6 +4,7 @@ import type { LogicSignature, Subroutine } from '../../awst/nodes' import type { SourceLocation } from '../../awst/source-location' import type { Props } from '../../typescript-helpers' import type { LogicSigPType } from '../ptypes' +import type { LogicSigOptionsDecoratorData } from './decorator-data' export class LogicSigClassModel { public readonly isAbstract = false @@ -16,6 +17,7 @@ export class LogicSigClassModel { } public readonly description: string | null public readonly bases: Array + public readonly options: LogicSigOptionsDecoratorData | undefined public readonly program: Subroutine public readonly sourceLocation: SourceLocation constructor(props: Props>) { @@ -24,16 +26,17 @@ export class LogicSigClassModel { this.program = props.program this.bases = props.bases this.sourceLocation = props.sourceLocation + this.options = props.options } public buildLogicSignature(): LogicSignature { return nodeFactory.logicSignature({ id: this.id, - shortName: this.name, + shortName: this.options?.name ?? this.name, program: this.program, sourceLocation: this.sourceLocation, docstring: this.description, - avmVersion: null, // TODO: Allow this to be set from class decorator + avmVersion: this.options?.avmVersion ?? null, }) } } diff --git a/src/awst_build/op-metadata.ts b/src/awst_build/op-metadata.ts index 3d76c558..6c23fe46 100644 --- a/src/awst_build/op-metadata.ts +++ b/src/awst_build/op-metadata.ts @@ -178,6 +178,42 @@ export const OP_METADATA: Record(array1: T1[], array2: T2[]): [T1, T2][] => { return array1.map((t1, idx) => [t1, array2[idx]]) } -export function isIn(subject: TSubject, items: TItem[]): subject is TItem { +export function isIn(subject: TSubject, items: readonly TItem[]): subject is TItem { return items.some((i) => i === subject) } diff --git a/tests/approvals/avm11.algo.ts b/tests/approvals/avm11.algo.ts new file mode 100644 index 00000000..051c9a46 --- /dev/null +++ b/tests/approvals/avm11.algo.ts @@ -0,0 +1,44 @@ +import type { uint64 } from '@algorandfoundation/algorand-typescript' +import { assert, Bytes, Contract, contract, Global, logicsig, LogicSig, op, Txn } from '@algorandfoundation/algorand-typescript' + +@logicsig({ name: 'AVM11SIG', avmVersion: 11 }) +export class Avm11Sig extends LogicSig { + program(): uint64 { + return op.sumhash512(Bytes('')).length + } +} + +@contract({ name: 'AVM11Contract', avmVersion: 11 }) +export class Avm11Contract extends Contract { + testNewOps() { + // Ops + assert(!op.falconVerify(Bytes(), Bytes(), op.bzero(1793))) + assert(op.sumhash512(Bytes())) + assert(op.onlineStake()) + + // AcctParams + const [a, b] = op.AcctParams.acctIncentiveEligible(Txn.sender) + const [c, d] = op.AcctParams.acctLastProposed(Txn.sender) + const [e, f] = op.AcctParams.acctLastProposed(Txn.sender) + + // Block + assert(op.Block.blkProposer(0) !== Global.zeroAddress, 'proposer') + assert(op.Block.blkFeesCollected(0), 'fees collected') + assert(op.Block.blkBonus(0), 'bonus') + assert(op.Block.blkBranch(0), 'branch') + assert(op.Block.blkFeeSink(0) !== Global.zeroAddress, 'fee sink') + assert(op.Block.blkProtocol(0), 'protocol') + assert(op.Block.blkTxnCounter(0), 'txn counter') + assert(op.Block.blkProposerPayout(0), 'proposer payout') + + // Global + assert(op.Global.payoutsEnabled, 'payouts_enabled') + assert(op.Global.payoutsGoOnlineFee, 'payouts_go_online_fee') + assert(op.Global.payoutsPercent, 'payouts_percent') + assert(op.Global.payoutsMinBalance, 'payouts_min_balance') + assert(op.Global.payoutsMaxBalance, 'payouts_max_balance') + // Voter params + const [g, h] = op.VoterParams.voterBalance(0) + const [i, j] = op.VoterParams.voterIncentiveEligible(0) + } +} diff --git a/tests/approvals/out/abi-decorators/abi-decorators.awst.json b/tests/approvals/out/abi-decorators/abi-decorators.awst.json index 216895b3..d929cdfb 100644 --- a/tests/approvals/out/abi-decorators/abi-decorators.awst.json +++ b/tests/approvals/out/abi-decorators/abi-decorators.awst.json @@ -1076,10 +1076,11 @@ } ], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/accounts/accounts.awst.json b/tests/approvals/out/accounts/accounts.awst.json index ffd9d5f2..5efc44b3 100644 --- a/tests/approvals/out/accounts/accounts.awst.json +++ b/tests/approvals/out/accounts/accounts.awst.json @@ -22190,10 +22190,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/arc28-events/arc28-events.awst.json b/tests/approvals/out/arc28-events/arc28-events.awst.json index 1b6e3ca3..412b9544 100644 --- a/tests/approvals/out/arc28-events/arc28-events.awst.json +++ b/tests/approvals/out/arc28-events/arc28-events.awst.json @@ -2436,10 +2436,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/arc4-encode-decode/arc4-encode-decode.awst.json b/tests/approvals/out/arc4-encode-decode/arc4-encode-decode.awst.json index 6f5b98e2..3e2208c8 100644 --- a/tests/approvals/out/arc4-encode-decode/arc4-encode-decode.awst.json +++ b/tests/approvals/out/arc4-encode-decode/arc4-encode-decode.awst.json @@ -4046,10 +4046,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/arc4-struct/arc4-struct.awst.json b/tests/approvals/out/arc4-struct/arc4-struct.awst.json index 956b3458..b1b80d68 100644 --- a/tests/approvals/out/arc4-struct/arc4-struct.awst.json +++ b/tests/approvals/out/arc4-struct/arc4-struct.awst.json @@ -6726,10 +6726,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/arc4-types/arc4-types.awst.json b/tests/approvals/out/arc4-types/arc4-types.awst.json index 8f3df182..c9d00faa 100644 --- a/tests/approvals/out/arc4-types/arc4-types.awst.json +++ b/tests/approvals/out/arc4-types/arc4-types.awst.json @@ -9144,10 +9144,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/assert-match/assert-match.awst.json b/tests/approvals/out/assert-match/assert-match.awst.json index f8da9c6b..92336bb6 100644 --- a/tests/approvals/out/assert-match/assert-match.awst.json +++ b/tests/approvals/out/assert-match/assert-match.awst.json @@ -1415,10 +1415,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/avm11/AVM11Contract.approval.teal b/tests/approvals/out/avm11/AVM11Contract.approval.teal new file mode 100644 index 00000000..8ec293a0 --- /dev/null +++ b/tests/approvals/out/avm11/AVM11Contract.approval.teal @@ -0,0 +1,199 @@ +#pragma version 11 + +tests/approvals/avm11.algo.ts::Avm11Contract.approvalProgram: + intcblock 0 1 + txn ApplicationID + bnz main_after_if_else@2 + callsub constructor + +main_after_if_else@2: + callsub __puya_arc4_router__ + return + + +// tests/approvals/avm11.algo.ts::Avm11Contract.constructor() -> void: +constructor: + // tests/approvals/avm11.algo.ts:11-12 + // @contract({ name: 'AVM11Contract', avmVersion: 11 }) + // export class Avm11Contract extends Contract { + proto 0 0 + retsub + + +// tests/approvals/avm11.algo.ts::Avm11Contract.__puya_arc4_router__() -> uint64: +__puya_arc4_router__: + // tests/approvals/avm11.algo.ts:11-12 + // @contract({ name: 'AVM11Contract', avmVersion: 11 }) + // export class Avm11Contract extends Contract { + proto 0 1 + txn NumAppArgs + intc_0 // 0 + != + bz __puya_arc4_router___bare_routing@5 + txna ApplicationArgs 0 + pushbytes 0x52448a31 // method "testNewOps()void" + swap + match __puya_arc4_router___testNewOps_route@2 + b __puya_arc4_router___switch_case_default@3 + +__puya_arc4_router___testNewOps_route@2: + // tests/approvals/avm11.algo.ts:13 + // testNewOps() { + txn OnCompletion + intc_0 // NoOp + == + assert // OnCompletion is not NoOp + txn ApplicationID + intc_0 // 0 + != + assert // can only call when not creating + callsub testNewOps + intc_1 // 1 + retsub + +__puya_arc4_router___switch_case_default@3: + b __puya_arc4_router___after_if_else@9 + +__puya_arc4_router___bare_routing@5: + // tests/approvals/avm11.algo.ts:11-12 + // @contract({ name: 'AVM11Contract', avmVersion: 11 }) + // export class Avm11Contract extends Contract { + txn OnCompletion + intc_0 // 0 + swap + match __puya_arc4_router_____algots__.defaultCreate@6 + b __puya_arc4_router___switch_case_default@7 + +__puya_arc4_router_____algots__.defaultCreate@6: + // tests/approvals/avm11.algo.ts:11-12 + // @contract({ name: 'AVM11Contract', avmVersion: 11 }) + // export class Avm11Contract extends Contract { + txn ApplicationID + intc_0 // 0 + == + assert // can only call when creating + callsub __algots__.defaultCreate + intc_1 // 1 + retsub + +__puya_arc4_router___switch_case_default@7: + +__puya_arc4_router___after_if_else@9: + // tests/approvals/avm11.algo.ts:11-12 + // @contract({ name: 'AVM11Contract', avmVersion: 11 }) + // export class Avm11Contract extends Contract { + intc_0 // 0 + retsub + + +// tests/approvals/avm11.algo.ts::Avm11Contract.testNewOps() -> void: +testNewOps: + // tests/approvals/avm11.algo.ts:13 + // testNewOps() { + proto 0 0 + // tests/approvals/avm11.algo.ts:15 + // assert(!op.falconVerify(Bytes(), Bytes(), op.bzero(1793))) + pushint 1793 // 1793 + bzero + pushbytes 0x + dup + uncover 2 + falcon_verify + ! + assert + // tests/approvals/avm11.algo.ts:16 + // assert(op.sumhash512(Bytes())) + pushbytes 0x + sumhash512 + len + assert + // tests/approvals/avm11.algo.ts:17 + // assert(op.onlineStake()) + online_stake + assert + // tests/approvals/avm11.algo.ts:25 + // assert(op.Block.blkProposer(0) !== Global.zeroAddress, 'proposer') + intc_0 // 0 + block BlkProposer + global ZeroAddress + != + assert // proposer + // tests/approvals/avm11.algo.ts:26 + // assert(op.Block.blkFeesCollected(0), 'fees collected') + intc_0 // 0 + block BlkFeesCollected + assert // fees collected + // tests/approvals/avm11.algo.ts:27 + // assert(op.Block.blkBonus(0), 'bonus') + intc_0 // 0 + block BlkBonus + assert // bonus + // tests/approvals/avm11.algo.ts:28 + // assert(op.Block.blkBranch(0), 'branch') + intc_0 // 0 + block BlkBranch + len + assert // branch + // tests/approvals/avm11.algo.ts:29 + // assert(op.Block.blkFeeSink(0) !== Global.zeroAddress, 'fee sink') + intc_0 // 0 + block BlkFeeSink + global ZeroAddress + != + assert // fee sink + // tests/approvals/avm11.algo.ts:30 + // assert(op.Block.blkProtocol(0), 'protocol') + intc_0 // 0 + block BlkProtocol + len + assert // protocol + // tests/approvals/avm11.algo.ts:31 + // assert(op.Block.blkTxnCounter(0), 'txn counter') + intc_0 // 0 + block BlkTxnCounter + assert // txn counter + // tests/approvals/avm11.algo.ts:32 + // assert(op.Block.blkProposerPayout(0), 'proposer payout') + intc_0 // 0 + block BlkProposerPayout + assert // proposer payout + // tests/approvals/avm11.algo.ts:35 + // assert(op.Global.payoutsEnabled, 'payouts_enabled') + global PayoutsEnabled + assert // payouts_enabled + // tests/approvals/avm11.algo.ts:36 + // assert(op.Global.payoutsGoOnlineFee, 'payouts_go_online_fee') + global PayoutsGoOnlineFee + assert // payouts_go_online_fee + // tests/approvals/avm11.algo.ts:37 + // assert(op.Global.payoutsPercent, 'payouts_percent') + global PayoutsPercent + assert // payouts_percent + // tests/approvals/avm11.algo.ts:38 + // assert(op.Global.payoutsMinBalance, 'payouts_min_balance') + global PayoutsMinBalance + assert // payouts_min_balance + // tests/approvals/avm11.algo.ts:39 + // assert(op.Global.payoutsMaxBalance, 'payouts_max_balance') + global PayoutsMaxBalance + assert // payouts_max_balance + // tests/approvals/avm11.algo.ts:41 + // const [g, h] = op.VoterParams.voterBalance(0) + intc_0 // 0 + voter_params_get VoterBalance + popn 2 + // tests/approvals/avm11.algo.ts:42 + // const [i, j] = op.VoterParams.voterIncentiveEligible(0) + intc_0 // 0 + voter_params_get VoterIncentiveEligible + popn 2 + retsub + + +// tests/approvals/avm11.algo.ts::Avm11Contract.__algots__.defaultCreate() -> void: +__algots__.defaultCreate: + // tests/approvals/avm11.algo.ts:11-12 + // @contract({ name: 'AVM11Contract', avmVersion: 11 }) + // export class Avm11Contract extends Contract { + proto 0 0 + retsub diff --git a/tests/approvals/out/avm11/AVM11Contract.arc32.json b/tests/approvals/out/avm11/AVM11Contract.arc32.json new file mode 100644 index 00000000..65314d04 --- /dev/null +++ b/tests/approvals/out/avm11/AVM11Contract.arc32.json @@ -0,0 +1,50 @@ +{ + "hints": { + "testNewOps()void": { + "call_config": { + "no_op": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDExCgp0ZXN0cy9hcHByb3ZhbHMvYXZtMTEuYWxnby50czo6QXZtMTFDb250cmFjdC5hcHByb3ZhbFByb2dyYW06CiAgICBpbnRjYmxvY2sgMCAxCiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgYm56IG1haW5fYWZ0ZXJfaWZfZWxzZUAyCiAgICBjYWxsc3ViIGNvbnN0cnVjdG9yCgptYWluX2FmdGVyX2lmX2Vsc2VAMjoKICAgIGNhbGxzdWIgX19wdXlhX2FyYzRfcm91dGVyX18KICAgIHJldHVybgoKCi8vIHRlc3RzL2FwcHJvdmFscy9hdm0xMS5hbGdvLnRzOjpBdm0xMUNvbnRyYWN0LmNvbnN0cnVjdG9yKCkgLT4gdm9pZDoKY29uc3RydWN0b3I6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvYXZtMTEuYWxnby50czoxMS0xMgogICAgLy8gQGNvbnRyYWN0KHsgbmFtZTogJ0FWTTExQ29udHJhY3QnLCBhdm1WZXJzaW9uOiAxMSB9KQogICAgLy8gZXhwb3J0IGNsYXNzIEF2bTExQ29udHJhY3QgZXh0ZW5kcyBDb250cmFjdCB7CiAgICBwcm90byAwIDAKICAgIHJldHN1YgoK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ICAgLy8gY29uc3QgW2ksIGpdID0gb3AuVm90ZXJQYXJhbXMudm90ZXJJbmNlbnRpdmVFbGlnaWJsZSgwKQogICAgaW50Y18wIC8vIDAKICAgIHZvdGVyX3BhcmFtc19nZXQgVm90ZXJJbmNlbnRpdmVFbGlnaWJsZQogICAgcG9wbiAyCiAgICByZXRzdWIKCgovLyB0ZXN0cy9hcHByb3ZhbHMvYXZtMTEuYWxnby50czo6QXZtMTFDb250cmFjdC5fX2FsZ290c19fLmRlZmF1bHRDcmVhdGUoKSAtPiB2b2lkOgpfX2FsZ290c19fLmRlZmF1bHRDcmVhdGU6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvYXZtMTEuYWxnby50czoxMS0xMgogICAgLy8gQGNvbnRyYWN0KHsgbmFtZTogJ0FWTTExQ29udHJhY3QnLCBhdm1WZXJzaW9uOiAxMSB9KQogICAgLy8gZXhwb3J0IGNsYXNzIEF2bTExQ29udHJhY3QgZXh0ZW5kcyBDb250cmFjdCB7CiAgICBwcm90byAwIDAKICAgIHJldHN1Ygo=", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDExCgp0ZXN0cy9hcHByb3ZhbHMvYXZtMTEuYWxnby50czo6QXZtMTFDb250cmFjdC5jbGVhclN0YXRlUHJvZ3JhbToKICAgIHB1c2hpbnQgMSAvLyAxCiAgICByZXR1cm4K" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 0 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": {}, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "AVM11Contract", + "methods": [ + { + "name": "testNewOps", + "args": [], + "readonly": false, + "returns": { + "type": "void" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/tests/approvals/out/avm11/AVM11Contract.arc56.json b/tests/approvals/out/avm11/AVM11Contract.arc56.json new file mode 100644 index 00000000..a0343b08 --- /dev/null +++ b/tests/approvals/out/avm11/AVM11Contract.arc56.json @@ -0,0 +1,168 @@ +{ + "name": "AVM11Contract", + "structs": {}, + "methods": [ + { + "name": "testNewOps", + "args": [], + "returns": { + "type": "void" + }, + "actions": { + "create": [], + "call": [ + "NoOp" + ] + }, + "readonly": false, + "events": [], + "recommendations": {} + } + ], + "arcs": [ + 22, + 28 + ], + "networks": {}, + "state": { + "schema": { + "global": { + "ints": 0, + "bytes": 0 + }, + "local": { + "ints": 0, + "bytes": 0 + } + }, + "keys": { + "global": {}, + "local": {}, + "box": {} + }, + "maps": { + "global": {}, + "local": {}, + "box": {} + } + }, + "bareActions": { + "create": [ + "NoOp" + ], + "call": [] + }, + "sourceInfo": { + "approval": { + "sourceInfo": [ + { + "pc": [ + 52 + ], + "errorMessage": "OnCompletion is not NoOp" + }, + { + "pc": [ + 125 + ], + "errorMessage": "bonus" + }, + { + "pc": [ + 130 + ], + "errorMessage": "branch" + }, + { + "pc": [ + 81 + ], + "errorMessage": "can only call when creating" + }, + { + "pc": [ + 57 + ], + "errorMessage": "can only call when not creating" + }, + { + "pc": [ + 137 + ], + "errorMessage": "fee sink" + }, + { + "pc": [ + 121 + ], + "errorMessage": "fees collected" + }, + { + "pc": [ + 153 + ], + "errorMessage": "payouts_enabled" + }, + { + "pc": [ + 156 + ], + "errorMessage": "payouts_go_online_fee" + }, + { + "pc": [ + 165 + ], + "errorMessage": "payouts_max_balance" + }, + { + "pc": [ + 162 + ], + "errorMessage": "payouts_min_balance" + }, + { + "pc": [ + 159 + ], + "errorMessage": "payouts_percent" + }, + { + "pc": [ + 117 + ], + "errorMessage": "proposer" + }, + { + "pc": [ + 150 + ], + "errorMessage": "proposer payout" + }, + { + "pc": [ + 142 + ], + "errorMessage": "protocol" + }, + { + "pc": [ + 146 + ], + "errorMessage": "txn counter" + } + ], + "pcOffsetMethod": "none" + }, + "clear": { + "sourceInfo": [], + "pcOffsetMethod": "none" + } + }, + "source": { + "approval": "I3ByYWdtYSB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gbmFtZTogJ0FWTTExQ29udHJhY3QnLCBhdm1WZXJzaW9uOiAxMSB9KQogICAgLy8gZXhwb3J0IGNsYXNzIEF2bTExQ29udHJhY3QgZXh0ZW5kcyBDb250cmFjdCB7CiAgICBwcm90byAwIDAKICAgIHJldHN1Ygo=", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDExCgp0ZXN0cy9hcHByb3ZhbHMvYXZtMTEuYWxnby50czo6QXZtMTFDb250cmFjdC5jbGVhclN0YXRlUHJvZ3JhbToKICAgIHB1c2hpbnQgMSAvLyAxCiAgICByZXR1cm4K" + }, + "events": [], + "templateVariables": {} +} \ No newline at end of file diff --git a/tests/approvals/out/avm11/AVM11Contract.clear.teal b/tests/approvals/out/avm11/AVM11Contract.clear.teal new file mode 100644 index 00000000..82954f6e --- /dev/null +++ b/tests/approvals/out/avm11/AVM11Contract.clear.teal @@ -0,0 +1,5 @@ +#pragma version 11 + +tests/approvals/avm11.algo.ts::Avm11Contract.clearStateProgram: + pushint 1 // 1 + return diff --git a/tests/approvals/out/avm11/AVM11SIG.teal b/tests/approvals/out/avm11/AVM11SIG.teal new file mode 100644 index 00000000..5205cee9 --- /dev/null +++ b/tests/approvals/out/avm11/AVM11SIG.teal @@ -0,0 +1,9 @@ +#pragma version 11 + +tests/approvals/avm11.algo.ts::Avm11Sig: + // tests/approvals/avm11.algo.ts:7 + // return op.sumhash512(Bytes('')).length + pushbytes "" + sumhash512 + len + return diff --git a/tests/approvals/out/avm11/Avm11Contract.ssa.ir b/tests/approvals/out/avm11/Avm11Contract.ssa.ir new file mode 100644 index 00000000..cee8bcd0 --- /dev/null +++ b/tests/approvals/out/avm11/Avm11Contract.ssa.ir @@ -0,0 +1,125 @@ +contract tests/approvals/avm11.algo.ts::Avm11Contract: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/avm11.algo.ts::Avm11Contract.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/avm11.algo.ts::Avm11Contract.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/avm11.algo.ts::Avm11Contract.constructor() -> void: + block@0: // L11 + return + + subroutine tests/approvals/avm11.algo.ts::Avm11Contract.__puya_arc4_router__() -> bool: + block@0: // L11 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@5 + block@1: // abi_routing_L11 + let tmp%2#0: bytes = (txna ApplicationArgs 0) + switch tmp%2#0 {method "testNewOps()void" => block@2, * => block@3} + block@2: // testNewOps_route_L13 + let tmp%3#0: uint64 = (txn OnCompletion) + let tmp%4#0: bool = (== tmp%3#0 NoOp) + (assert tmp%4#0) // OnCompletion is not NoOp + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (!= tmp%5#0 0u) + (assert tmp%6#0) // can only call when not creating + tests/approvals/avm11.algo.ts::Avm11Contract.testNewOps() + return 1u + block@3: // switch_case_default_L11 + goto block@4 + block@4: // switch_case_next_L11 + goto block@9 + block@5: // bare_routing_L11 + let tmp%7#0: uint64 = (txn OnCompletion) + switch tmp%7#0 {0u => block@6, * => block@7} + block@6: // __algots__.defaultCreate_L11 + let tmp%8#0: uint64 = (txn ApplicationID) + let tmp%9#0: bool = (== tmp%8#0 0u) + (assert tmp%9#0) // can only call when creating + tests/approvals/avm11.algo.ts::Avm11Contract.__algots__.defaultCreate() + return 1u + block@7: // switch_case_default_L11 + goto block@8 + block@8: // switch_case_next_L11 + goto block@9 + block@9: // after_if_else_L11 + return 0u + + subroutine tests/approvals/avm11.algo.ts::Avm11Contract.testNewOps() -> void: + block@0: // L13 + let tmp%0#0: bytes = (bzero 1793u) + let tmp%1#0: bool = (falcon_verify 0x 0x tmp%0#0) + let tmp%2#0: bool = (! tmp%1#0) + (assert tmp%2#0) + let tmp%3#0: bytes = (sumhash512 0x) + let reinterpret_bool%0#0: bool = (len tmp%3#0) + (assert reinterpret_bool%0#0) + let reinterpret_bool%1#0: bool = online_stake + (assert reinterpret_bool%1#0) + let tmp%4#0: bytes = (txn Sender) + let (tuple_assignment%0#0: bool, tuple_assignment%1#0: bool) = ((acct_params_get AcctIncentiveEligible) tmp%4#0) + let a#0: bool = tuple_assignment%0#0 + let b#0: bool = tuple_assignment%1#0 + let tmp%5#0: bytes = (txn Sender) + let (tuple_assignment%2#0: uint64, tuple_assignment%3#0: bool) = ((acct_params_get AcctLastProposed) tmp%5#0) + let c#0: uint64 = tuple_assignment%2#0 + let d#0: bool = tuple_assignment%3#0 + let tmp%6#0: bytes = (txn Sender) + let (tuple_assignment%4#0: uint64, tuple_assignment%5#0: bool) = ((acct_params_get AcctLastProposed) tmp%6#0) + let e#0: uint64 = tuple_assignment%4#0 + let f#0: bool = tuple_assignment%5#0 + let tmp%7#0: bytes = ((block BlkProposer) 0u) + let tmp%8#0: bytes = (global ZeroAddress) + let tmp%9#0: bool = (!= tmp%7#0 tmp%8#0) + (assert tmp%9#0) // proposer + let reinterpret_bool%2#0: bool = ((block BlkFeesCollected) 0u) + (assert reinterpret_bool%2#0) // fees collected + let reinterpret_bool%3#0: bool = ((block BlkBonus) 0u) + (assert reinterpret_bool%3#0) // bonus + let tmp%10#0: bytes = ((block BlkBranch) 0u) + let reinterpret_bool%4#0: bool = (len tmp%10#0) + (assert reinterpret_bool%4#0) // branch + let tmp%11#0: bytes = ((block BlkFeeSink) 0u) + let tmp%12#0: bytes = (global ZeroAddress) + let tmp%13#0: bool = (!= tmp%11#0 tmp%12#0) + (assert tmp%13#0) // fee sink + let tmp%14#0: bytes = ((block BlkProtocol) 0u) + let reinterpret_bool%5#0: bool = (len tmp%14#0) + (assert reinterpret_bool%5#0) // protocol + let reinterpret_bool%6#0: bool = ((block BlkTxnCounter) 0u) + (assert reinterpret_bool%6#0) // txn counter + let reinterpret_bool%7#0: bool = ((block BlkProposerPayout) 0u) + (assert reinterpret_bool%7#0) // proposer payout + let tmp%15#0: bool = (global PayoutsEnabled) + (assert tmp%15#0) // payouts_enabled + let reinterpret_bool%8#0: bool = (global PayoutsGoOnlineFee) + (assert reinterpret_bool%8#0) // payouts_go_online_fee + let reinterpret_bool%9#0: bool = (global PayoutsPercent) + (assert reinterpret_bool%9#0) // payouts_percent + let reinterpret_bool%10#0: bool = (global PayoutsMinBalance) + (assert reinterpret_bool%10#0) // payouts_min_balance + let reinterpret_bool%11#0: bool = (global PayoutsMaxBalance) + (assert reinterpret_bool%11#0) // payouts_max_balance + let (tuple_assignment%6#0: uint64, tuple_assignment%7#0: bool) = ((voter_params_get VoterBalance) 0u) + let g#0: uint64 = tuple_assignment%6#0 + let h#0: bool = tuple_assignment%7#0 + let (tuple_assignment%8#0: bool, tuple_assignment%9#0: bool) = ((voter_params_get VoterIncentiveEligible) 0u) + let i#0: bool = tuple_assignment%8#0 + let j#0: bool = tuple_assignment%9#0 + return + + subroutine tests/approvals/avm11.algo.ts::Avm11Contract.__algots__.defaultCreate() -> void: + block@0: // L11 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/avm11/Avm11Sig.ssa.ir b/tests/approvals/out/avm11/Avm11Sig.ssa.ir new file mode 100644 index 00000000..bab52bb6 --- /dev/null +++ b/tests/approvals/out/avm11/Avm11Sig.ssa.ir @@ -0,0 +1,6 @@ +program logicsig tests/approvals/avm11.algo.ts::Avm11Sig: + subroutine tests/approvals/avm11.algo.ts::program() -> uint64: + block@0: // L6 + let tmp%0#0: bytes = (sumhash512 "") + let tmp%1#0: uint64 = (len tmp%0#0) + return tmp%1#0 \ No newline at end of file diff --git a/tests/approvals/out/avm11/avm11.awst b/tests/approvals/out/avm11/avm11.awst new file mode 100644 index 00000000..da126224 --- /dev/null +++ b/tests/approvals/out/avm11/avm11.awst @@ -0,0 +1,63 @@ + +logicsig tests/approvals/avm11.algo.ts::Avm11Sig { + return len(sumhash512("")) +} +contract AVM11Contract +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + testNewOps(): void + { + assert(!falcon_verify(0x, 0x, bzero(1793))) + assert(Boolean(len(sumhash512(0x)))) + assert(Boolean(online_stake())) + [a, b]: readonlytuple[bool, bool] = acct_params_get(txn()) + [c, d]: readonlytuple[uint64, bool] = acct_params_get(txn()) + [e, f]: readonlytuple[uint64, bool] = acct_params_get(txn()) + assert(block(0) != global(), comment=proposer) + assert(Boolean(block(0)), comment=fees collected) + assert(Boolean(block(0)), comment=bonus) + assert(Boolean(len(block(0))), comment=branch) + assert(block(0) != global(), comment=fee sink) + assert(Boolean(len(block(0))), comment=protocol) + assert(Boolean(block(0)), comment=txn counter) + assert(Boolean(block(0)), comment=proposer payout) + assert(global(), comment=payouts_enabled) + assert(Boolean(global()), comment=payouts_go_online_fee) + assert(Boolean(global()), comment=payouts_percent) + assert(Boolean(global()), comment=payouts_min_balance) + assert(Boolean(global()), comment=payouts_max_balance) + [g, h]: readonlytuple[uint64, bool] = voter_params_get(0) + [i, j]: readonlytuple[bool, bool] = voter_params_get(0) + } + + constructor(): void + { + void + } + + Contract::constructor(): void + { + this.constructor() + } + + BaseContract::constructor(): void + { + } + + __algots__.defaultCreate(): void + { + } + +} \ No newline at end of file diff --git a/tests/approvals/out/avm11/avm11.awst.json b/tests/approvals/out/avm11/avm11.awst.json new file mode 100644 index 00000000..b5b9be48 --- /dev/null +++ b/tests/approvals/out/avm11/avm11.awst.json @@ -0,0 +1,2857 @@ +[ + { + "_type": "LogicSignature", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 4, + "end_line": 5, + "column": 0, + "end_column": 40 + }, + "id": "tests/approvals/avm11.algo.ts::Avm11Sig", + "short_name": "AVM11SIG", + "program": { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 19 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 6, + "end_line": 8, + "column": 20, + "end_column": 3 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 7, + "end_line": 7, + "column": 4, + "end_column": 42 + }, + "value": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 7, + "end_line": 7, + "column": 36, + "end_column": 42 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "len", + "immediates": [], + "stack_args": [ + { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 7, + "end_line": 7, + "column": 11, + "end_column": 35 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "sumhash512", + "immediates": [], + "stack_args": [ + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 7, + "end_line": 7, + "column": 31, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "", + "encoding": "utf8" + } + ] + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/avm11.algo.ts::program", + "name": "program" + }, + "docstring": null, + "avm_version": "11" + }, + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 11, + "end_line": 12, + "column": 0, + "end_column": 45 + }, + "id": "tests/approvals/avm11.algo.ts::Avm11Contract", + "name": "AVM11Contract", + "description": null, + "method_resolution_order": [ + "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [] + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 13, + "end_line": 13, + "column": 2, + "end_column": 14 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 13, + "end_line": 43, + "column": 15, + "end_column": 3 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 15, + "end_line": 15, + "column": 4, + "end_column": 62 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 15, + "end_line": 15, + "column": 4, + "end_column": 62 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "Not", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 15, + "end_line": 15, + "column": 11, + "end_column": 61 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 15, + "end_line": 15, + "column": 12, + "end_column": 61 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "falcon_verify", + "immediates": [], + "stack_args": [ + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 15, + "end_line": 15, + "column": 28, + "end_column": 35 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "", + "encoding": "unknown" + }, + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 15, + "end_line": 15, + "column": 37, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "", + "encoding": "unknown" + }, + { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 15, + "end_line": 15, + "column": 46, + "end_column": 60 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "bzero", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 15, + "end_line": 15, + "column": 55, + "end_column": 59 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1793", + "teal_alias": null + } + ] + } + ] + } + }, + "error_message": null + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 16, + "end_line": 16, + "column": 4, + "end_column": 34 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 16, + "end_line": 16, + "column": 4, + "end_column": 34 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 16, + "end_line": 16, + "column": 4, + "end_column": 34 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 16, + "end_line": 16, + "column": 4, + "end_column": 34 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "len", + "immediates": [], + "stack_args": [ + { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 16, + "end_line": 16, + "column": 11, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "sumhash512", + "immediates": [], + "stack_args": [ + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 16, + "end_line": 16, + "column": 25, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "", + "encoding": "unknown" + } + ] + } + ] + } + }, + "error_message": null + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 17, + "end_line": 17, + "column": 4, + "end_column": 28 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 17, + "end_line": 17, + "column": 4, + "end_column": 28 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 17, + "end_line": 17, + "column": 4, + "end_column": 28 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 17, + "end_line": 17, + "column": 11, + "end_column": 27 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "online_stake", + "immediates": [], + "stack_args": [] + } + }, + "error_message": null + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 20, + "end_line": 20, + "column": 10, + "end_column": 66 + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 20, + "end_line": 20, + "column": 10, + "end_column": 66 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 20, + "end_line": 20, + "column": 11, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "a" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 20, + "end_line": 20, + "column": 14, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "b" + } + ] + }, + "value": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 20, + "end_line": 20, + "column": 19, + "end_column": 66 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ] + }, + "op_code": "acct_params_get", + "immediates": [ + "AcctIncentiveEligible" + ], + "stack_args": [ + { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 20, + "end_line": 20, + "column": 59, + "end_column": 65 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "txn", + "immediates": [ + "Sender" + ], + "stack_args": [] + } + ] + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 21, + "end_line": 21, + "column": 10, + "end_column": 61 + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 21, + "end_line": 21, + "column": 10, + "end_column": 61 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 21, + "end_line": 21, + "column": 11, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "c" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 21, + "end_line": 21, + "column": 14, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "d" + } + ] + }, + "value": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 21, + "end_line": 21, + "column": 19, + "end_column": 61 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ] + }, + "op_code": "acct_params_get", + "immediates": [ + "AcctLastProposed" + ], + "stack_args": [ + { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 21, + "end_line": 21, + "column": 54, + "end_column": 60 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "txn", + "immediates": [ + "Sender" + ], + "stack_args": [] + } + ] + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 22, + "end_line": 22, + "column": 10, + "end_column": 61 + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 22, + "end_line": 22, + "column": 10, + "end_column": 61 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 22, + "end_line": 22, + "column": 11, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "e" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 22, + "end_line": 22, + "column": 14, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "f" + } + ] + }, + "value": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 22, + "end_line": 22, + "column": 19, + "end_column": 61 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ] + }, + "op_code": "acct_params_get", + "immediates": [ + "AcctLastProposed" + ], + "stack_args": [ + { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 22, + "end_line": 22, + "column": 54, + "end_column": 60 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "txn", + "immediates": [ + "Sender" + ], + "stack_args": [] + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 25, + "end_line": 25, + "column": 4, + "end_column": 70 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 25, + "end_line": 25, + "column": 4, + "end_column": 70 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "BytesComparisonExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 25, + "end_line": 25, + "column": 11, + "end_column": 57 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 25, + "end_line": 25, + "column": 11, + "end_column": 34 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "block", + "immediates": [ + "BlkProposer" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 25, + "end_line": 25, + "column": 32, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + }, + "operator": "!=", + "rhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 25, + "end_line": 25, + "column": 46, + "end_column": 57 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "global", + "immediates": [ + "ZeroAddress" + ], + "stack_args": [] + } + }, + "error_message": "proposer" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 26, + "end_line": 26, + "column": 4, + "end_column": 58 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 26, + "end_line": 26, + "column": 4, + "end_column": 58 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 26, + "end_line": 26, + "column": 4, + "end_column": 58 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 26, + "end_line": 26, + "column": 11, + "end_column": 39 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "block", + "immediates": [ + "BlkFeesCollected" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 26, + "end_line": 26, + "column": 37, + "end_column": 38 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + } + }, + "error_message": "fees collected" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 27, + "end_line": 27, + "column": 4, + "end_column": 41 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 27, + "end_line": 27, + "column": 4, + "end_column": 41 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 27, + "end_line": 27, + "column": 4, + "end_column": 41 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 27, + "end_line": 27, + "column": 11, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "block", + "immediates": [ + "BlkBonus" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 27, + "end_line": 27, + "column": 29, + "end_column": 30 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + } + }, + "error_message": "bonus" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 28, + "end_line": 28, + "column": 4, + "end_column": 43 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 28, + "end_line": 28, + "column": 4, + "end_column": 43 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 28, + "end_line": 28, + "column": 4, + "end_column": 43 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 28, + "end_line": 28, + "column": 4, + "end_column": 43 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "len", + "immediates": [], + "stack_args": [ + { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 28, + "end_line": 28, + "column": 11, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "block", + "immediates": [ + "BlkBranch" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 28, + "end_line": 28, + "column": 30, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + } + ] + } + }, + "error_message": "branch" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 29, + "end_line": 29, + "column": 4, + "end_column": 69 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 29, + "end_line": 29, + "column": 4, + "end_column": 69 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "BytesComparisonExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 29, + "end_line": 29, + "column": 11, + "end_column": 56 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 29, + "end_line": 29, + "column": 11, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "block", + "immediates": [ + "BlkFeeSink" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 29, + "end_line": 29, + "column": 31, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + }, + "operator": "!=", + "rhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 29, + "end_line": 29, + "column": 45, + "end_column": 56 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "global", + "immediates": [ + "ZeroAddress" + ], + "stack_args": [] + } + }, + "error_message": "fee sink" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 30, + "end_line": 30, + "column": 4, + "end_column": 47 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 30, + "end_line": 30, + "column": 4, + "end_column": 47 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 30, + "end_line": 30, + "column": 4, + "end_column": 47 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 30, + "end_line": 30, + "column": 4, + "end_column": 47 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "len", + "immediates": [], + "stack_args": [ + { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 30, + "end_line": 30, + "column": 11, + "end_column": 34 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "block", + "immediates": [ + "BlkProtocol" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 30, + "end_line": 30, + "column": 32, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + } + ] + } + }, + "error_message": "protocol" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 31, + "end_line": 31, + "column": 4, + "end_column": 52 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 31, + "end_line": 31, + "column": 4, + "end_column": 52 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 31, + "end_line": 31, + "column": 4, + "end_column": 52 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 31, + "end_line": 31, + "column": 11, + "end_column": 36 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "block", + "immediates": [ + "BlkTxnCounter" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 31, + "end_line": 31, + "column": 34, + "end_column": 35 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + } + }, + "error_message": "txn counter" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 32, + "end_line": 32, + "column": 4, + "end_column": 60 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 32, + "end_line": 32, + "column": 4, + "end_column": 60 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 32, + "end_line": 32, + "column": 4, + "end_column": 60 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 32, + "end_line": 32, + "column": 11, + "end_column": 40 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "block", + "immediates": [ + "BlkProposerPayout" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 32, + "end_line": 32, + "column": 38, + "end_column": 39 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + } + }, + "error_message": "proposer payout" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 35, + "end_line": 35, + "column": 4, + "end_column": 55 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 35, + "end_line": 35, + "column": 4, + "end_column": 55 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 35, + "end_line": 35, + "column": 21, + "end_column": 35 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "global", + "immediates": [ + "PayoutsEnabled" + ], + "stack_args": [] + }, + "error_message": "payouts_enabled" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 36, + "end_line": 36, + "column": 4, + "end_column": 65 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 36, + "end_line": 36, + "column": 4, + "end_column": 65 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 36, + "end_line": 36, + "column": 4, + "end_column": 65 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 36, + "end_line": 36, + "column": 21, + "end_column": 39 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "global", + "immediates": [ + "PayoutsGoOnlineFee" + ], + "stack_args": [] + } + }, + "error_message": "payouts_go_online_fee" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 37, + "end_line": 37, + "column": 4, + "end_column": 55 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 37, + "end_line": 37, + "column": 4, + "end_column": 55 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 37, + "end_line": 37, + "column": 4, + "end_column": 55 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 37, + "end_line": 37, + "column": 21, + "end_column": 35 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "global", + "immediates": [ + "PayoutsPercent" + ], + "stack_args": [] + } + }, + "error_message": "payouts_percent" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 38, + "end_line": 38, + "column": 4, + "end_column": 62 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 38, + "end_line": 38, + "column": 4, + "end_column": 62 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 38, + "end_line": 38, + "column": 4, + "end_column": 62 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 38, + "end_line": 38, + "column": 21, + "end_column": 38 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "global", + "immediates": [ + "PayoutsMinBalance" + ], + "stack_args": [] + } + }, + "error_message": "payouts_min_balance" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 39, + "end_line": 39, + "column": 4, + "end_column": 62 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 39, + "end_line": 39, + "column": 4, + "end_column": 62 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 39, + "end_line": 39, + "column": 4, + "end_column": 62 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 39, + "end_line": 39, + "column": 21, + "end_column": 38 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "global", + "immediates": [ + "PayoutsMaxBalance" + ], + "stack_args": [] + } + }, + "error_message": "payouts_max_balance" + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 41, + "end_line": 41, + "column": 10, + "end_column": 49 + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 41, + "end_line": 41, + "column": 10, + "end_column": 49 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 41, + "end_line": 41, + "column": 11, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "g" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 41, + "end_line": 41, + "column": 14, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "h" + } + ] + }, + "value": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 41, + "end_line": 41, + "column": 19, + "end_column": 49 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ] + }, + "op_code": "voter_params_get", + "immediates": [ + "VoterBalance" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 41, + "end_line": 41, + "column": 47, + "end_column": 48 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 42, + "end_line": 42, + "column": 10, + "end_column": 59 + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 42, + "end_line": 42, + "column": 10, + "end_column": 59 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 42, + "end_line": 42, + "column": 11, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "i" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 42, + "end_line": 42, + "column": 14, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "j" + } + ] + }, + "value": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 42, + "end_line": 42, + "column": 19, + "end_column": 59 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ] + }, + "op_code": "voter_params_get", + "immediates": [ + "VoterIncentiveEligible" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 42, + "end_line": 42, + "column": 57, + "end_column": 58 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/avm11.algo.ts::Avm11Contract", + "member_name": "testNewOps", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 13, + "end_line": 13, + "column": 2, + "end_column": 14 + }, + "name": "testNewOps", + "is_bare": false, + "create": 3, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 11, + "end_line": 12, + "column": 0, + "end_column": 45 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 11, + "end_line": 12, + "column": 0, + "end_column": 45 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 11, + "end_line": 12, + "column": 0, + "end_column": 45 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 11, + "end_line": 12, + "column": 0, + "end_column": 45 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/avm11.algo.ts::Avm11Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 11, + "end_line": 12, + "column": 0, + "end_column": 45 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 11, + "end_line": 12, + "column": 0, + "end_column": 45 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": "Implicitly generated create method", + "args": {}, + "returns": null + }, + "cref": "tests/approvals/avm11.algo.ts::Avm11Contract", + "member_name": "__algots__.defaultCreate", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/avm11.algo.ts", + "line": 11, + "end_line": 12, + "column": 0, + "end_column": 45 + }, + "allowed_completion_types": [ + 0 + ], + "create": 2, + "is_bare": true + } + } + ], + "app_state": [], + "state_totals": { + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null + }, + "reserved_scratch_space": [], + "avm_version": "11" + } +] \ No newline at end of file diff --git a/tests/approvals/out/biguint-expressions/biguint-expressions.awst.json b/tests/approvals/out/biguint-expressions/biguint-expressions.awst.json index a5bdd2a6..07336703 100644 --- a/tests/approvals/out/biguint-expressions/biguint-expressions.awst.json +++ b/tests/approvals/out/biguint-expressions/biguint-expressions.awst.json @@ -1979,10 +1979,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/byte-expressions/byte-expressions.awst.json b/tests/approvals/out/byte-expressions/byte-expressions.awst.json index e8c96646..37249f52 100644 --- a/tests/approvals/out/byte-expressions/byte-expressions.awst.json +++ b/tests/approvals/out/byte-expressions/byte-expressions.awst.json @@ -1415,10 +1415,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/call-expressions/call-expressions.awst.json b/tests/approvals/out/call-expressions/call-expressions.awst.json index afcb0e18..86f4ac92 100644 --- a/tests/approvals/out/call-expressions/call-expressions.awst.json +++ b/tests/approvals/out/call-expressions/call-expressions.awst.json @@ -813,10 +813,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/ensure-budget/ensure-budget.awst.json b/tests/approvals/out/ensure-budget/ensure-budget.awst.json index 7a3b7092..0a70a37e 100644 --- a/tests/approvals/out/ensure-budget/ensure-budget.awst.json +++ b/tests/approvals/out/ensure-budget/ensure-budget.awst.json @@ -709,10 +709,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/global-state/global-state.awst.json b/tests/approvals/out/global-state/global-state.awst.json index 9c2a2e4d..f2dbaeac 100644 --- a/tests/approvals/out/global-state/global-state.awst.json +++ b/tests/approvals/out/global-state/global-state.awst.json @@ -1453,10 +1453,11 @@ } ], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/implicit-create/implicit-create.awst.json b/tests/approvals/out/implicit-create/implicit-create.awst.json index 48586113..3872d3a3 100644 --- a/tests/approvals/out/implicit-create/implicit-create.awst.json +++ b/tests/approvals/out/implicit-create/implicit-create.awst.json @@ -598,10 +598,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null @@ -1201,10 +1202,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null @@ -1750,10 +1752,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null @@ -2303,10 +2306,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null @@ -2926,10 +2930,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null @@ -3553,10 +3558,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/inheritance-b/inheritance-b.awst.json b/tests/approvals/out/inheritance-b/inheritance-b.awst.json index 5607391c..57f0c64e 100644 --- a/tests/approvals/out/inheritance-b/inheritance-b.awst.json +++ b/tests/approvals/out/inheritance-b/inheritance-b.awst.json @@ -964,10 +964,11 @@ } ], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null @@ -2017,10 +2018,11 @@ } ], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/itxn/itxn.awst.json b/tests/approvals/out/itxn/itxn.awst.json index 8856e25b..6e7ea341 100644 --- a/tests/approvals/out/itxn/itxn.awst.json +++ b/tests/approvals/out/itxn/itxn.awst.json @@ -4267,10 +4267,11 @@ } ], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/jsdoc/jsdoc.awst.json b/tests/approvals/out/jsdoc/jsdoc.awst.json index cc2b503b..9aa977c6 100644 --- a/tests/approvals/out/jsdoc/jsdoc.awst.json +++ b/tests/approvals/out/jsdoc/jsdoc.awst.json @@ -1207,10 +1207,11 @@ } ], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/local-state/local-state.awst.json b/tests/approvals/out/local-state/local-state.awst.json index 377489d7..e72f1f0c 100644 --- a/tests/approvals/out/local-state/local-state.awst.json +++ b/tests/approvals/out/local-state/local-state.awst.json @@ -5020,10 +5020,11 @@ } ], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/logic-sig/logic-sig.awst.json b/tests/approvals/out/logic-sig/logic-sig.awst.json index b54078fa..ae60fe44 100644 --- a/tests/approvals/out/logic-sig/logic-sig.awst.json +++ b/tests/approvals/out/logic-sig/logic-sig.awst.json @@ -78,7 +78,7 @@ "id": "tests/approvals/logic-sig.algo.ts::program", "name": "program" }, - "docstring": "", + "docstring": null, "avm_version": null }, { @@ -320,7 +320,7 @@ "id": "tests/approvals/logic-sig.algo.ts::program", "name": "program" }, - "docstring": "", + "docstring": null, "avm_version": null } ] \ No newline at end of file diff --git a/tests/approvals/out/named-types/named-types.awst.json b/tests/approvals/out/named-types/named-types.awst.json index 604d3bb2..944b1610 100644 --- a/tests/approvals/out/named-types/named-types.awst.json +++ b/tests/approvals/out/named-types/named-types.awst.json @@ -3064,10 +3064,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/non-arc4/non-arc4.awst.json b/tests/approvals/out/non-arc4/non-arc4.awst.json index b15026a1..c1ff87f7 100644 --- a/tests/approvals/out/non-arc4/non-arc4.awst.json +++ b/tests/approvals/out/non-arc4/non-arc4.awst.json @@ -663,10 +663,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/pre-approved-sale/pre-approved-sale.awst.json b/tests/approvals/out/pre-approved-sale/pre-approved-sale.awst.json index 06a0b4d5..2bb232a9 100644 --- a/tests/approvals/out/pre-approved-sale/pre-approved-sale.awst.json +++ b/tests/approvals/out/pre-approved-sale/pre-approved-sale.awst.json @@ -1049,7 +1049,7 @@ "id": "tests/approvals/pre-approved-sale.algo.ts::program", "name": "program" }, - "docstring": "", + "docstring": "Allows for pre-authorising the sale of an asset for a pre-determined price, but to an\nundetermined buyer.\n\nThe checks here are not meant to be exhaustive", "avm_version": null } ] \ No newline at end of file diff --git a/tests/approvals/out/precompiled-apps/precompiled-apps.awst.json b/tests/approvals/out/precompiled-apps/precompiled-apps.awst.json index 823d9a69..80f7600e 100644 --- a/tests/approvals/out/precompiled-apps/precompiled-apps.awst.json +++ b/tests/approvals/out/precompiled-apps/precompiled-apps.awst.json @@ -1158,10 +1158,11 @@ } ], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null @@ -2319,10 +2320,11 @@ } ], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null @@ -3480,10 +3482,11 @@ } ], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null @@ -4289,10 +4292,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null @@ -4376,7 +4380,7 @@ "id": "tests/approvals/precompiled-apps.algo.ts::program", "name": "program" }, - "docstring": "", + "docstring": "This logic sig can be used to create a custodial account that will allow any transaction to transfer its\nfunds/assets.", "avm_version": null } ] \ No newline at end of file diff --git a/tests/approvals/out/precompiled-factory/precompiled-factory.awst.json b/tests/approvals/out/precompiled-factory/precompiled-factory.awst.json index 97a8350f..d523dc8a 100644 --- a/tests/approvals/out/precompiled-factory/precompiled-factory.awst.json +++ b/tests/approvals/out/precompiled-factory/precompiled-factory.awst.json @@ -8934,10 +8934,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/property-ordering/property-ordering.awst.json b/tests/approvals/out/property-ordering/property-ordering.awst.json index eee2cc02..ef028b49 100644 --- a/tests/approvals/out/property-ordering/property-ordering.awst.json +++ b/tests/approvals/out/property-ordering/property-ordering.awst.json @@ -1633,10 +1633,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/shadowed-variables/shadowed-variables.awst.json b/tests/approvals/out/shadowed-variables/shadowed-variables.awst.json index 01f94e99..1ca4c35a 100644 --- a/tests/approvals/out/shadowed-variables/shadowed-variables.awst.json +++ b/tests/approvals/out/shadowed-variables/shadowed-variables.awst.json @@ -1413,10 +1413,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/strings/strings.awst.json b/tests/approvals/out/strings/strings.awst.json index 94b193d6..88d4fbe8 100644 --- a/tests/approvals/out/strings/strings.awst.json +++ b/tests/approvals/out/strings/strings.awst.json @@ -845,10 +845,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/approvals/out/uint64-expressions/uint64-expressions.awst.json b/tests/approvals/out/uint64-expressions/uint64-expressions.awst.json index 025edeca..84450181 100644 --- a/tests/approvals/out/uint64-expressions/uint64-expressions.awst.json +++ b/tests/approvals/out/uint64-expressions/uint64-expressions.awst.json @@ -644,10 +644,11 @@ ], "app_state": [], "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null }, "reserved_scratch_space": [], "avm_version": null diff --git a/tests/expected-output/abi-decorators.algo.ts b/tests/expected-output/abi-decorators.algo.ts index 6491d38a..4223bd65 100644 --- a/tests/expected-output/abi-decorators.algo.ts +++ b/tests/expected-output/abi-decorators.algo.ts @@ -8,8 +8,8 @@ export default class AbiDecorators extends Contract { // @expect-error Private or protected methods cannot be exposed as an abi method @abimethod({ onCreate: 'require' }) private createMethod(): void {} - // @expect-error Only one decorator is allowed per method. Multiple on complete actions can be provided in a single decorator @abimethod({ allowActions: ['NoOp'] }) + // @expect-error Only one decorator is allowed per method. Multiple on complete actions can be provided in a single decorator @abimethod({ allowActions: ['OptIn'] }) public duplicateDecorators(): void {} From d8c8c9af9ce55392fc1bf06563d18d9602277df2 Mon Sep 17 00:00:00 2001 From: Tristan Menzel Date: Fri, 6 Dec 2024 08:10:00 -0800 Subject: [PATCH 4/7] build: Tweak approval tests for ci --- .github/workflows/ci-all.yml | 2 ++ .github/workflows/node-ci.yml | 2 +- .github/workflows/pr.yml | 1 + .github/workflows/release.yml | 1 + package-lock.json | 20 +++++++++++++++++++ package.json | 3 ++- tests/approvals.spec.ts | 11 ++++++---- ...11Contract.ssa.ir => AVM11Contract.ssa.ir} | 0 .../{Avm11Sig.ssa.ir => AVM11SIG.ssa.ir} | 0 tests/constants.ts | 3 +++ 10 files changed, 37 insertions(+), 6 deletions(-) rename tests/approvals/out/avm11/{Avm11Contract.ssa.ir => AVM11Contract.ssa.ir} (100%) rename tests/approvals/out/avm11/{Avm11Sig.ssa.ir => AVM11SIG.ssa.ir} (100%) create mode 100644 tests/constants.ts diff --git a/.github/workflows/ci-all.yml b/.github/workflows/ci-all.yml index c9458b6f..9be04e46 100644 --- a/.github/workflows/ci-all.yml +++ b/.github/workflows/ci-all.yml @@ -49,3 +49,5 @@ jobs: pipx install algokit --python 3.12.6 algokit localnet reset --update pipx install git+https://github.com/algorandfoundation/puya --python 3.12.6 + test-script: npm run test:ci + output-test-results: true diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index f569f3d8..9ed07ff4 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -162,7 +162,7 @@ jobs: #Requires permissions.checks: write - name: Publish test results - if: ${{ inputs.output-test-results }} + if: ${{ inputs.output-test-results && always() }} uses: phoenix-actions/test-reporting@v10 with: name: Test results diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 13264b52..b322532f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -12,6 +12,7 @@ on: permissions: contents: read + checks: write jobs: ci-all: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7dd5ff0..41045049 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,7 @@ permissions: contents: write issues: write pull-requests: write + checks: write jobs: ci: diff --git a/package-lock.json b/package-lock.json index 218577eb..1679b107 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,6 +44,7 @@ "better-npm-audit": "3.11.0", "conventional-changelog-conventionalcommits": "^8.0.0", "copyfiles": "2.4.1", + "cross-env": "^7.0.3", "eslint": "9.15.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", @@ -3834,6 +3835,25 @@ "typescript": ">=4" } }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", diff --git a/package.json b/package.json index 3ff0a0ce..c926bf2c 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "test:approvals": "vitest run tests/approvals.spec.ts", "test:expected-output": "vitest run tests/expected-output.spec.ts", "test:coverage": "vitest run --coverage", - "test:ci": "vitest run --coverage --reporter junit --outputFile test-results.xml", + "test:ci": "cross-env NODE_ENV=ci vitest run --coverage --reporter junit --outputFile test-results.xml", "install-local-packages": "npm run algo-ts", "watch-local-packages": "npm run algo-ts:build:watch", "algo-ts": "run-s algo-ts:*", @@ -60,6 +60,7 @@ "better-npm-audit": "3.11.0", "conventional-changelog-conventionalcommits": "^8.0.0", "copyfiles": "2.4.1", + "cross-env": "^7.0.3", "eslint": "9.15.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", diff --git a/tests/approvals.spec.ts b/tests/approvals.spec.ts index 770f88d4..042d2d47 100644 --- a/tests/approvals.spec.ts +++ b/tests/approvals.spec.ts @@ -6,6 +6,7 @@ import { buildCompileOptions } from '../src/compile-options' import { isErrorOrCritical, LoggingContext, LogLevel } from '../src/logger' import { defaultPuyaOptions } from '../src/puya/options' import { invariant } from '../src/util' +import { Environment } from './constants' describe('Approvals', async () => { await rimraf('tests/approvals/out') @@ -55,10 +56,12 @@ describe('Approvals', async () => { }) it('There should be no differences to committed changes', () => { - // // Run git add to force line ending changes - // sync('git', ['add', '.'], { - // stdio: 'inherit', - // }) + if (Environment.IsCi) { + // Run git add to force line ending changes + sync('git', ['add', '.'], { + stdio: 'inherit', + }) + } const result = sync('git', ['status', '--porcelain'], { stdio: 'pipe', }) diff --git a/tests/approvals/out/avm11/Avm11Contract.ssa.ir b/tests/approvals/out/avm11/AVM11Contract.ssa.ir similarity index 100% rename from tests/approvals/out/avm11/Avm11Contract.ssa.ir rename to tests/approvals/out/avm11/AVM11Contract.ssa.ir diff --git a/tests/approvals/out/avm11/Avm11Sig.ssa.ir b/tests/approvals/out/avm11/AVM11SIG.ssa.ir similarity index 100% rename from tests/approvals/out/avm11/Avm11Sig.ssa.ir rename to tests/approvals/out/avm11/AVM11SIG.ssa.ir diff --git a/tests/constants.ts b/tests/constants.ts new file mode 100644 index 00000000..13ee3391 --- /dev/null +++ b/tests/constants.ts @@ -0,0 +1,3 @@ +export const Environment = { + IsCi: process.env.NODE_ENV === 'ci', +} as const From 56725d2734c2230ed38ea2fbe12d13b28fda8825 Mon Sep 17 00:00:00 2001 From: Tristan Menzel Date: Fri, 6 Dec 2024 09:36:59 -0800 Subject: [PATCH 5/7] fix: Typo in logic sig visitor and typing of options decorators + increase test coverage --- packages/algo-ts/src/base-contract.ts | 2 +- packages/algo-ts/src/logic-sig.ts | 2 +- .../ast-visitors/logic-sig-visitor.ts | 14 +++---- tests/expected-output/logic-sig.algo.ts | 40 +++++++++++++++++++ 4 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 tests/expected-output/logic-sig.algo.ts diff --git a/packages/algo-ts/src/base-contract.ts b/packages/algo-ts/src/base-contract.ts index 9f9009ed..f66a9780 100644 --- a/packages/algo-ts/src/base-contract.ts +++ b/packages/algo-ts/src/base-contract.ts @@ -72,5 +72,5 @@ type ContractOptions = { * @param options An object containing the configuration options */ export function contract(options: ContractOptions) { - return (contract: ConstructorFor) => contract + return >(contract: T) => contract } diff --git a/packages/algo-ts/src/logic-sig.ts b/packages/algo-ts/src/logic-sig.ts index 50331a22..37c677b5 100644 --- a/packages/algo-ts/src/logic-sig.ts +++ b/packages/algo-ts/src/logic-sig.ts @@ -26,5 +26,5 @@ type LogicSigOptions = { * @param options An object containing the configuration options */ export function logicsig(options: LogicSigOptions) { - return (logicSig: ConstructorFor) => logicSig + return >(logicSig: T) => logicSig } diff --git a/src/awst_build/ast-visitors/logic-sig-visitor.ts b/src/awst_build/ast-visitors/logic-sig-visitor.ts index f10ee21d..c3c582e6 100644 --- a/src/awst_build/ast-visitors/logic-sig-visitor.ts +++ b/src/awst_build/ast-visitors/logic-sig-visitor.ts @@ -69,23 +69,23 @@ export class LogicSigVisitor extends BaseVisitor implements Visitor Date: Fri, 6 Dec 2024 11:02:48 -0800 Subject: [PATCH 6/7] feat: Allow stateTotals to be specified statically in contract options --- package.json | 2 +- packages/algo-ts/src/base-contract.ts | 4 +- src/awst_build/eb/contract-builder.ts | 26 +- src/awst_build/models/contract-class-model.ts | 23 +- .../state-totals/BaseWithState.approval.teal | 123 + .../out/state-totals/BaseWithState.arc32.json | 69 + .../out/state-totals/BaseWithState.arc56.json | 112 + .../out/state-totals/BaseWithState.clear.teal | 5 + .../out/state-totals/BaseWithState.ssa.ir | 71 + .../ExtendsSubWithTotals.approval.teal | 172 + .../ExtendsSubWithTotals.arc32.json | 73 + .../ExtendsSubWithTotals.arc56.json | 117 + .../ExtendsSubWithTotals.clear.teal | 5 + .../state-totals/ExtendsSubWithTotals.ssa.ir | 88 + .../SubClassWithExplicitTotals.approval.teal | 139 + .../SubClassWithExplicitTotals.arc32.json | 69 + .../SubClassWithExplicitTotals.arc56.json | 112 + .../SubClassWithExplicitTotals.clear.teal | 5 + .../SubClassWithExplicitTotals.ssa.ir | 76 + .../SubClassWithState.approval.teal | 151 + .../state-totals/SubClassWithState.arc32.json | 77 + .../state-totals/SubClassWithState.arc56.json | 122 + .../state-totals/SubClassWithState.clear.teal | 5 + .../out/state-totals/SubClassWithState.ssa.ir | 82 + .../out/state-totals/state-totals.awst | 227 + .../out/state-totals/state-totals.awst.json | 4616 +++++++++++++++++ tests/approvals/state-totals.algo.ts | 37 + tests/onchain/state-totals.spec.ts | 57 + tests/onchain/util/test-fixture.ts | 25 +- 29 files changed, 6671 insertions(+), 19 deletions(-) create mode 100644 tests/approvals/out/state-totals/BaseWithState.approval.teal create mode 100644 tests/approvals/out/state-totals/BaseWithState.arc32.json create mode 100644 tests/approvals/out/state-totals/BaseWithState.arc56.json create mode 100644 tests/approvals/out/state-totals/BaseWithState.clear.teal create mode 100644 tests/approvals/out/state-totals/BaseWithState.ssa.ir create mode 100644 tests/approvals/out/state-totals/ExtendsSubWithTotals.approval.teal create mode 100644 tests/approvals/out/state-totals/ExtendsSubWithTotals.arc32.json create mode 100644 tests/approvals/out/state-totals/ExtendsSubWithTotals.arc56.json create mode 100644 tests/approvals/out/state-totals/ExtendsSubWithTotals.clear.teal create mode 100644 tests/approvals/out/state-totals/ExtendsSubWithTotals.ssa.ir create mode 100644 tests/approvals/out/state-totals/SubClassWithExplicitTotals.approval.teal create mode 100644 tests/approvals/out/state-totals/SubClassWithExplicitTotals.arc32.json create mode 100644 tests/approvals/out/state-totals/SubClassWithExplicitTotals.arc56.json create mode 100644 tests/approvals/out/state-totals/SubClassWithExplicitTotals.clear.teal create mode 100644 tests/approvals/out/state-totals/SubClassWithExplicitTotals.ssa.ir create mode 100644 tests/approvals/out/state-totals/SubClassWithState.approval.teal create mode 100644 tests/approvals/out/state-totals/SubClassWithState.arc32.json create mode 100644 tests/approvals/out/state-totals/SubClassWithState.arc56.json create mode 100644 tests/approvals/out/state-totals/SubClassWithState.clear.teal create mode 100644 tests/approvals/out/state-totals/SubClassWithState.ssa.ir create mode 100644 tests/approvals/out/state-totals/state-totals.awst create mode 100644 tests/approvals/out/state-totals/state-totals.awst.json create mode 100644 tests/approvals/state-totals.algo.ts create mode 100644 tests/onchain/state-totals.spec.ts diff --git a/package.json b/package.json index c926bf2c..c6659fe0 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "dev:examples": "tsx src/cli.ts build examples --output-awst --output-awst-json", "dev:approvals": "rimraf tests/approvals/out && tsx src/cli.ts build tests/approvals --dry-run", "dev:expected-output": "tsx src/cli.ts build tests/expected-output --dry-run", - "dev:testing": "tsx src/cli.ts build tests/approvals/avm11.algo.ts --output-awst --output-awst-json --output-ssa-ir --log-level=info --out-dir out/[name] --optimization-level=0", + "dev:testing": "tsx src/cli.ts build tests/approvals/state-totals.algo.ts --output-awst --output-awst-json --output-ssa-ir --log-level=info --out-dir out/[name] --optimization-level=0", "audit": "better-npm-audit audit", "format": "prettier --write .", "lint": "eslint \"src/**/*.ts\"", diff --git a/packages/algo-ts/src/base-contract.ts b/packages/algo-ts/src/base-contract.ts index f66a9780..64f6b93d 100644 --- a/packages/algo-ts/src/base-contract.ts +++ b/packages/algo-ts/src/base-contract.ts @@ -55,12 +55,12 @@ type ContractOptions = { * Allows defining what values should be used for global and local uint and bytes storage * values when creating a contract. Used when outputting ARC-32 application.json schemas. * - * If let unspecified, the totals will be determined by the compiler based on state + * If left unspecified, the totals will be determined by the compiler based on state * variables assigned to `this`. * * This setting is not inherited, and only applies to the exact `Contract` it is specified * on. If a base class does specify this setting, and a derived class does not, a warning - * will be emitted for the derived class. To resolve this warning, `state_totals` must be + * will be emitted for the derived class. To resolve this warning, `stateTotals` must be * specified. An empty object may be provided in order to indicate that this contract should * revert to the default behaviour */ diff --git a/src/awst_build/eb/contract-builder.ts b/src/awst_build/eb/contract-builder.ts index ea5bb191..953acff1 100644 --- a/src/awst_build/eb/contract-builder.ts +++ b/src/awst_build/eb/contract-builder.ts @@ -7,6 +7,7 @@ import { Constants } from '../../constants' import { CodeError } from '../../errors' import { codeInvariant, invariant } from '../../util' import type { AwstBuildContext } from '../context/awst-build-context' +import type { ContractOptionsDecoratorData } from '../models/decorator-data' import type { PType } from '../ptypes' import { arc4BaseContractType, @@ -23,7 +24,7 @@ import { instanceEb } from '../type-registry' import { BaseContractMethodExpressionBuilder, ContractMethodExpressionBuilder } from './free-subroutine-expression-builder' import type { NodeBuilder } from './index' import { DecoratorDataBuilder, FunctionBuilder, InstanceBuilder } from './index' -import { requireStringConstant } from './util' +import { requireIntegerConstant, requireStringConstant } from './util' import { parseFunctionArgs } from './util/arg-parsing' import { requireAvmVersion } from './util/avm-version' import { VoidExpressionBuilder } from './void-expression-builder' @@ -126,7 +127,7 @@ export class ContractOptionsDecoratorBuilder extends FunctionBuilder { readonly ptype = contractOptionsDecorator call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { - args: [{ avmVersion, name }], + args: [{ avmVersion, name, stateTotals }], } = parseFunctionArgs({ args, typeArgs, @@ -145,9 +146,26 @@ export class ContractOptionsDecoratorBuilder extends FunctionBuilder { return new DecoratorDataBuilder(sourceLocation, { type: 'contract', - avmVersion: avmVersion ? requireAvmVersion(avmVersion) : undefined, - name: name ? requireStringConstant(name).value : undefined, + avmVersion: avmVersion && requireAvmVersion(avmVersion), + name: name && requireStringConstant(name).value, + stateTotals: stateTotals && buildStateTotals(stateTotals), sourceLocation, }) } } + +function buildStateTotals(builder: NodeBuilder): ContractOptionsDecoratorData['stateTotals'] { + function tryGetProp(name: string): bigint | undefined { + if (builder.hasProperty(name)) { + return requireIntegerConstant(builder.memberAccess(name, builder.sourceLocation)).value + } + return undefined + } + + return { + globalBytes: tryGetProp('globalBytes'), + globalUints: tryGetProp('globalUints'), + localBytes: tryGetProp('localBytes'), + localUints: tryGetProp('localUints'), + } +} diff --git a/src/awst_build/models/contract-class-model.ts b/src/awst_build/models/contract-class-model.ts index 3dca9a67..6da47461 100644 --- a/src/awst_build/models/contract-class-model.ts +++ b/src/awst_build/models/contract-class-model.ts @@ -49,14 +49,23 @@ export class ContractClassModel { this.options = props.options } + hasExplicitStateTotals() { + return this.options?.stateTotals !== undefined + } + buildContract(compilationSet: CompilationSet): awst.Contract { let approvalProgram: ContractMethod | null = this.approvalProgram let clearProgram: ContractMethod | null = this.clearProgram const methods: ContractMethod[] = [...this.methods, this.ctor] const methodResolutionOrder: ContractReference[] = [] + + let firstBaseWithStateTotals: ContractClassModel | undefined = undefined for (const baseType of this.type.allBases()) { const cref = ContractReference.fromPType(baseType) const baseClass = compilationSet.getContractClass(cref) + if (baseClass.hasExplicitStateTotals() && firstBaseWithStateTotals === undefined) { + firstBaseWithStateTotals = baseClass + } methodResolutionOrder.push(cref) approvalProgram ??= baseClass.approvalProgram clearProgram ??= baseClass.clearProgram @@ -91,7 +100,13 @@ export class ContractClassModel { codeInvariant(approvalProgram, 'must have approval') codeInvariant(clearProgram, 'must have clear') - // TODO: Tally from bases + if (!this.hasExplicitStateTotals && firstBaseWithStateTotals) { + logger.warn( + this.options?.sourceLocation ?? this.sourceLocation, + `Contract extends base contract ${firstBaseWithStateTotals.id} with explicit stateTotals, but does not define its own stateTotals. This could result in insufficient reserved state at run time. An empty object may be provided in order to indicate that this contract should revert to the default behaviour`, + ) + } + const stateTotals = new StateTotals({ globalBytes: this.options?.stateTotals?.globalBytes ?? null, globalUints: this.options?.stateTotals?.globalUints ?? null, @@ -121,11 +136,11 @@ export class ContractClassModel { clearProgram, methodResolutionOrder, methods, - appState: this.appState, // TODO: Tally from base - stateTotals: stateTotals, // TODO: Tally + appState: this.appState, + stateTotals, reservedScratchSpace: reservedScratchSpace, sourceLocation: this.sourceLocation, - avmVersion: this.options?.avmVersion ?? null, // TODO: Allow this to be set with class decorator + avmVersion: this.options?.avmVersion ?? null, }) } diff --git a/tests/approvals/out/state-totals/BaseWithState.approval.teal b/tests/approvals/out/state-totals/BaseWithState.approval.teal new file mode 100644 index 00000000..0b4605ae --- /dev/null +++ b/tests/approvals/out/state-totals/BaseWithState.approval.teal @@ -0,0 +1,123 @@ +#pragma version 10 + +tests/approvals/state-totals.algo.ts::BaseWithState.approvalProgram: + intcblock 0 1 + bytecblock "oneGlobal" + txn ApplicationID + bnz main_after_if_else@2 + callsub constructor + +main_after_if_else@2: + callsub __puya_arc4_router__ + return + + +// tests/approvals/state-totals.algo.ts::BaseWithState.constructor() -> void: +constructor: + // tests/approvals/state-totals.algo.ts:4 + // export class BaseWithState extends Contract { + proto 0 0 + // tests/approvals/state-totals.algo.ts:5 + // oneGlobal = GlobalState({ initialValue: Uint64(1) }) + bytec_0 // "oneGlobal" + intc_1 // 1 + app_global_put + retsub + + +// tests/approvals/state-totals.algo.ts::BaseWithState.__puya_arc4_router__() -> uint64: +__puya_arc4_router__: + // tests/approvals/state-totals.algo.ts:4 + // export class BaseWithState extends Contract { + proto 0 1 + txn NumAppArgs + intc_0 // 0 + != + bz __puya_arc4_router___bare_routing@5 + txna ApplicationArgs 0 + pushbytes 0x2cd95aa1 // method "setState(uint64)void" + swap + match __puya_arc4_router___setState_route@2 + b __puya_arc4_router___switch_case_default@3 + +__puya_arc4_router___setState_route@2: + // tests/approvals/state-totals.algo.ts:9 + // setState(n: uint64) { + txn OnCompletion + intc_0 // NoOp + == + assert // OnCompletion is not NoOp + txn ApplicationID + intc_0 // 0 + != + assert // can only call when not creating + // tests/approvals/state-totals.algo.ts:4 + // export class BaseWithState extends Contract { + txna ApplicationArgs 1 + btoi + // tests/approvals/state-totals.algo.ts:9 + // setState(n: uint64) { + callsub setState + intc_1 // 1 + retsub + +__puya_arc4_router___switch_case_default@3: + b __puya_arc4_router___after_if_else@9 + +__puya_arc4_router___bare_routing@5: + // tests/approvals/state-totals.algo.ts:4 + // export class BaseWithState extends Contract { + txn OnCompletion + intc_0 // 0 + swap + match __puya_arc4_router_____algots__.defaultCreate@6 + b __puya_arc4_router___switch_case_default@7 + +__puya_arc4_router_____algots__.defaultCreate@6: + // tests/approvals/state-totals.algo.ts:4 + // export class BaseWithState extends Contract { + txn ApplicationID + intc_0 // 0 + == + assert // can only call when creating + callsub __algots__.defaultCreate + intc_1 // 1 + retsub + +__puya_arc4_router___switch_case_default@7: + +__puya_arc4_router___after_if_else@9: + // tests/approvals/state-totals.algo.ts:4 + // export class BaseWithState extends Contract { + intc_0 // 0 + retsub + + +// tests/approvals/state-totals.algo.ts::BaseWithState.setState(n: uint64) -> void: +setState: + // tests/approvals/state-totals.algo.ts:9 + // setState(n: uint64) { + proto 1 0 + // tests/approvals/state-totals.algo.ts:5 + // oneGlobal = GlobalState({ initialValue: Uint64(1) }) + bytec_0 // "oneGlobal" + // tests/approvals/state-totals.algo.ts:10 + // this.oneGlobal.value = n + frame_dig -1 + app_global_put + // tests/approvals/state-totals.algo.ts:6 + // twoGlobal = GlobalState() + pushbytes "twoGlobal" + // tests/approvals/state-totals.algo.ts:11 + // this.twoGlobal.value = n + frame_dig -1 + app_global_put + retsub + + +// tests/approvals/state-totals.algo.ts::BaseWithState.__algots__.defaultCreate() -> void: +__algots__.defaultCreate: + // tests/approvals/state-totals.algo.ts:4 + // export class BaseWithState extends Contract { + proto 0 0 + retsub diff --git a/tests/approvals/out/state-totals/BaseWithState.arc32.json b/tests/approvals/out/state-totals/BaseWithState.arc32.json new file mode 100644 index 00000000..6d00d08e --- /dev/null +++ b/tests/approvals/out/state-totals/BaseWithState.arc32.json @@ -0,0 +1,69 @@ +{ + "hints": { + "setState(uint64)void": { + "call_config": { + "no_op": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkJhc2VXaXRoU3RhdGUuYXBwcm92YWxQcm9ncmFtOgogICAgaW50Y2Jsb2NrIDAgMQogICAgYnl0ZWNibG9jayAib25lR2xvYmFsIgogICAgdHhuIEFwcGxpY2F0aW9uSUQKICAgIGJueiBtYWluX2FmdGVyX2lmX2Vsc2VAMgogICAgY2FsbHN1YiBjb25zdHJ1Y3RvcgoKbWFpbl9hZnRlcl9pZl9lbHNlQDI6CiAgICBjYWxsc3ViIF9fcHV5YV9hcmM0X3JvdXRlcl9fCiAgICByZXR1cm4KCgovLyB0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkJhc2VXaXRoU3RhdGU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U3RhdGUuY2xlYXJTdGF0ZVByb2dyYW06CiAgICBwdXNoaW50IDEgLy8gMQogICAgcmV0dXJuCg==" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 2 + }, + "local": { + "num_byte_slices": 1, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": { + "oneGlobal": { + "type": "uint64", + "key": "oneGlobal" + }, + "twoGlobal": { + "type": "uint64", + "key": "twoGlobal" + } + }, + "reserved": {} + }, + "local": { + "declared": { + "oneLocalBytes": { + "type": "bytes", + "key": "oneLocalBytes" + } + }, + "reserved": {} + } + }, + "contract": { + "name": "BaseWithState", + "methods": [ + { + "name": "setState", + "args": [ + { + "type": "uint64", + "name": "n" + } + ], + "readonly": false, + "returns": { + "type": "void" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/tests/approvals/out/state-totals/BaseWithState.arc56.json b/tests/approvals/out/state-totals/BaseWithState.arc56.json new file mode 100644 index 00000000..6cb58b48 --- /dev/null +++ b/tests/approvals/out/state-totals/BaseWithState.arc56.json @@ -0,0 +1,112 @@ +{ + "name": "BaseWithState", + "structs": {}, + "methods": [ + { + "name": "setState", + "args": [ + { + "type": "uint64", + "name": "n" + } + ], + "returns": { + "type": "void" + }, + "actions": { + "create": [], + "call": [ + "NoOp" + ] + }, + "readonly": false, + "events": [], + "recommendations": {} + } + ], + "arcs": [ + 22, + 28 + ], + "networks": {}, + "state": { + "schema": { + "global": { + "ints": 2, + "bytes": 0 + }, + "local": { + "ints": 0, + "bytes": 1 + } + }, + "keys": { + "global": { + "oneGlobal": { + "keyType": "AVMString", + "valueType": "AVMUint64", + "key": "b25lR2xvYmFs" + }, + "twoGlobal": { + "keyType": "AVMString", + "valueType": "AVMUint64", + "key": "dHdvR2xvYmFs" + } + }, + "local": { + "oneLocalBytes": { + "keyType": "AVMString", + "valueType": "AVMBytes", + "key": "b25lTG9jYWxCeXRlcw==" + } + }, + "box": {} + }, + "maps": { + "global": {}, + "local": {}, + "box": {} + } + }, + "bareActions": { + "create": [ + "NoOp" + ], + "call": [] + }, + "sourceInfo": { + "approval": { + "sourceInfo": [ + { + "pc": [ + 67 + ], + "errorMessage": "OnCompletion is not NoOp" + }, + { + "pc": [ + 100 + ], + "errorMessage": "can only call when creating" + }, + { + "pc": [ + 72 + ], + "errorMessage": "can only call when not creating" + } + ], + "pcOffsetMethod": "none" + }, + "clear": { + "sourceInfo": [], + "pcOffsetMethod": "none" + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkJhc2VXaXRoU3RhdGUuYXBwcm92YWxQcm9ncmFtOgogICAgaW50Y2Jsb2NrIDAgMQogICAgYnl0ZWNibG9jayAib25lR2xvYmFsIgogICAgdHhuIEFwcGxpY2F0aW9uSUQKICAgIGJueiBtYWluX2FmdGVyX2lmX2Vsc2VAMgogICAgY2FsbHN1YiBjb25zdHJ1Y3RvcgoKbWFpbl9hZnRlcl9pZl9lbHNlQDI6CiAgICBjYWxsc3ViIF9fcHV5YV9hcmM0X3JvdXRlcl9fCiAgICByZXR1cm4KCgovLyB0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkJhc2VXaXRoU3RhdGUuY29uc3RydWN0b3IoKSAtPiB2b2lkOgpjb25zdHJ1Y3RvcjoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9zdGF0ZS10b3RhbHMuYWxnby50czo0CiAgICAvLyBleHBvcnQgY2xhc3MgQmFzZVdpdGhTdGF0ZSBleHRlbmRzIENvbnRyYWN0IHsKICAgIHByb3RvIDAgMAogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjUKICAgIC8vIG9uZUdsb2JhbCA9IEdsb2JhbFN0YXRlKHsgaW5pdGlhbFZhbHVlOiBVaW50NjQoMSkgfSkKICAgIGJ5d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ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6NgogICAgLy8gdHdvR2xvYmFsID0gR2xvYmFsU3RhdGU8dWludDY0PigpCiAgICBwdXNoYnl0ZXMgInR3b0dsb2JhbCIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9zdGF0ZS10b3RhbHMuYWxnby50czoxMQogICAgLy8gdGhpcy50d29HbG9iYWwudmFsdWUgPSBuCiAgICBmcmFtZV9kaWcgLTEKICAgIGFwcF9nbG9iYWxfcHV0CiAgICByZXRzdWIKCgovLyB0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkJhc2VXaXRoU3RhdGUuX19hbGdvdHNfXy5kZWZhdWx0Q3JlYXRlKCkgLT4gdm9pZDoKX19hbGdvdHNfXy5kZWZhdWx0Q3JlYXRlOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjQKICAgIC8vIGV4cG9ydCBjbGFzcyBCYXNlV2l0aFN0YXRlIGV4dGVuZHMgQ29udHJhY3QgewogICAgcHJvdG8gMCAwCiAgICByZXRzdWIK", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkJhc2VXaXRoU3RhdGUuY2xlYXJTdGF0ZVByb2dyYW06CiAgICBwdXNoaW50IDEgLy8gMQogICAgcmV0dXJuCg==" + }, + "events": [], + "templateVariables": {} +} \ No newline at end of file diff --git a/tests/approvals/out/state-totals/BaseWithState.clear.teal b/tests/approvals/out/state-totals/BaseWithState.clear.teal new file mode 100644 index 00000000..7fd413dd --- /dev/null +++ b/tests/approvals/out/state-totals/BaseWithState.clear.teal @@ -0,0 +1,5 @@ +#pragma version 10 + +tests/approvals/state-totals.algo.ts::BaseWithState.clearStateProgram: + pushint 1 // 1 + return diff --git a/tests/approvals/out/state-totals/BaseWithState.ssa.ir b/tests/approvals/out/state-totals/BaseWithState.ssa.ir new file mode 100644 index 00000000..5b655f06 --- /dev/null +++ b/tests/approvals/out/state-totals/BaseWithState.ssa.ir @@ -0,0 +1,71 @@ +contract tests/approvals/state-totals.algo.ts::BaseWithState: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/state-totals.algo.ts::BaseWithState.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/state-totals.algo.ts::BaseWithState.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/state-totals.algo.ts::BaseWithState.constructor() -> void: + block@0: // L4 + (app_global_put "oneGlobal" 1u) + return + + subroutine tests/approvals/state-totals.algo.ts::BaseWithState.__puya_arc4_router__() -> bool: + block@0: // L4 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@5 + block@1: // abi_routing_L4 + let tmp%2#0: bytes = (txna ApplicationArgs 0) + switch tmp%2#0 {method "setState(uint64)void" => block@2, * => block@3} + block@2: // setState_route_L9 + let tmp%3#0: uint64 = (txn OnCompletion) + let tmp%4#0: bool = (== tmp%3#0 NoOp) + (assert tmp%4#0) // OnCompletion is not NoOp + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (!= tmp%5#0 0u) + (assert tmp%6#0) // can only call when not creating + let tmp%7#0: bytes = (txna ApplicationArgs 1) + let tmp%8#0: uint64 = (btoi tmp%7#0) + tests/approvals/state-totals.algo.ts::BaseWithState.setState(tmp%8#0) + return 1u + block@3: // switch_case_default_L4 + goto block@4 + block@4: // switch_case_next_L4 + goto block@9 + block@5: // bare_routing_L4 + let tmp%9#0: uint64 = (txn OnCompletion) + switch tmp%9#0 {0u => block@6, * => block@7} + block@6: // __algots__.defaultCreate_L4 + let tmp%10#0: uint64 = (txn ApplicationID) + let tmp%11#0: bool = (== tmp%10#0 0u) + (assert tmp%11#0) // can only call when creating + tests/approvals/state-totals.algo.ts::BaseWithState.__algots__.defaultCreate() + return 1u + block@7: // switch_case_default_L4 + goto block@8 + block@8: // switch_case_next_L4 + goto block@9 + block@9: // after_if_else_L4 + return 0u + + subroutine tests/approvals/state-totals.algo.ts::BaseWithState.setState(n: uint64) -> void: + block@0: // L9 + (app_global_put "oneGlobal" n#0) + (app_global_put "twoGlobal" n#0) + return + + subroutine tests/approvals/state-totals.algo.ts::BaseWithState.__algots__.defaultCreate() -> void: + block@0: // L4 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/state-totals/ExtendsSubWithTotals.approval.teal b/tests/approvals/out/state-totals/ExtendsSubWithTotals.approval.teal new file mode 100644 index 00000000..2a83b0c7 --- /dev/null +++ b/tests/approvals/out/state-totals/ExtendsSubWithTotals.approval.teal @@ -0,0 +1,172 @@ +#pragma version 10 + +tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.approvalProgram: + intcblock 0 1 + bytecblock "oneGlobal" + txn ApplicationID + bnz main_after_if_else@2 + callsub constructor + +main_after_if_else@2: + callsub __puya_arc4_router__ + return + + +// tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.constructor() -> void: +constructor: + // tests/approvals/state-totals.algo.ts:27-28 + // @contract({ stateTotals: {} }) + // export class ExtendsSubWithTotals extends SubClassWithExplicitTotals { + proto 0 0 + callsub tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.constructor + retsub + + +// tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.constructor() -> void: +tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.constructor: + // tests/approvals/state-totals.algo.ts:24-25 + // @contract({ stateTotals: { globalUints: 4, localUints: 0 } }) + // export class SubClassWithExplicitTotals extends BaseWithState {} + proto 0 0 + callsub tests/approvals/state-totals.algo.ts::BaseWithState.constructor + retsub + + +// tests/approvals/state-totals.algo.ts::BaseWithState.constructor() -> void: +tests/approvals/state-totals.algo.ts::BaseWithState.constructor: + // tests/approvals/state-totals.algo.ts:4 + // export class BaseWithState extends Contract { + proto 0 0 + // tests/approvals/state-totals.algo.ts:5 + // oneGlobal = GlobalState({ initialValue: Uint64(1) }) + bytec_0 // "oneGlobal" + intc_1 // 1 + app_global_put + retsub + + +// tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.__puya_arc4_router__() -> uint64: +__puya_arc4_router__: + // tests/approvals/state-totals.algo.ts:27-28 + // @contract({ stateTotals: {} }) + // export class ExtendsSubWithTotals extends SubClassWithExplicitTotals { + proto 0 1 + txn NumAppArgs + intc_0 // 0 + != + bz __puya_arc4_router___bare_routing@5 + txna ApplicationArgs 0 + pushbytes 0x2cd95aa1 // method "setState(uint64)void" + swap + match __puya_arc4_router___setState_route@2 + b __puya_arc4_router___switch_case_default@3 + +__puya_arc4_router___setState_route@2: + // tests/approvals/state-totals.algo.ts:31 + // @abimethod({ allowActions: 'OptIn' }) + txn OnCompletion + intc_1 // OptIn + == + assert // OnCompletion is not OptIn + txn ApplicationID + intc_0 // 0 + != + assert // can only call when not creating + // tests/approvals/state-totals.algo.ts:27-28 + // @contract({ stateTotals: {} }) + // export class ExtendsSubWithTotals extends SubClassWithExplicitTotals { + txna ApplicationArgs 1 + btoi + // tests/approvals/state-totals.algo.ts:31 + // @abimethod({ allowActions: 'OptIn' }) + callsub setState + intc_1 // 1 + retsub + +__puya_arc4_router___switch_case_default@3: + b __puya_arc4_router___after_if_else@9 + +__puya_arc4_router___bare_routing@5: + // tests/approvals/state-totals.algo.ts:27-28 + // @contract({ stateTotals: {} }) + // export class ExtendsSubWithTotals extends SubClassWithExplicitTotals { + txn OnCompletion + intc_0 // 0 + swap + match __puya_arc4_router_____algots__.defaultCreate@6 + b __puya_arc4_router___switch_case_default@7 + +__puya_arc4_router_____algots__.defaultCreate@6: + // tests/approvals/state-totals.algo.ts:27-28 + // @contract({ stateTotals: {} }) + // export class ExtendsSubWithTotals extends SubClassWithExplicitTotals { + txn ApplicationID + intc_0 // 0 + == + assert // can only call when creating + callsub __algots__.defaultCreate + intc_1 // 1 + retsub + +__puya_arc4_router___switch_case_default@7: + +__puya_arc4_router___after_if_else@9: + // tests/approvals/state-totals.algo.ts:27-28 + // @contract({ stateTotals: {} }) + // export class ExtendsSubWithTotals extends SubClassWithExplicitTotals { + intc_0 // 0 + retsub + + +// tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.setState(n: uint64) -> void: +setState: + // tests/approvals/state-totals.algo.ts:31-32 + // @abimethod({ allowActions: 'OptIn' }) + // setState(n: uint64) { + proto 1 0 + // tests/approvals/state-totals.algo.ts:33 + // super.setState(n) + frame_dig -1 + callsub tests/approvals/state-totals.algo.ts::BaseWithState.setState + // tests/approvals/state-totals.algo.ts:35 + // this.oneLocal(Txn.sender).value = n + txn Sender + // tests/approvals/state-totals.algo.ts:29 + // oneLocal = LocalState() + pushbytes "oneLocal" + // tests/approvals/state-totals.algo.ts:35 + // this.oneLocal(Txn.sender).value = n + frame_dig -1 + app_local_put + retsub + + +// tests/approvals/state-totals.algo.ts::BaseWithState.setState(n: uint64) -> void: +tests/approvals/state-totals.algo.ts::BaseWithState.setState: + // tests/approvals/state-totals.algo.ts:9 + // setState(n: uint64) { + proto 1 0 + // tests/approvals/state-totals.algo.ts:5 + // oneGlobal = GlobalState({ initialValue: Uint64(1) }) + bytec_0 // "oneGlobal" + // tests/approvals/state-totals.algo.ts:10 + // this.oneGlobal.value = n + frame_dig -1 + app_global_put + // tests/approvals/state-totals.algo.ts:6 + // twoGlobal = GlobalState() + pushbytes "twoGlobal" + // tests/approvals/state-totals.algo.ts:11 + // this.twoGlobal.value = n + frame_dig -1 + app_global_put + retsub + + +// tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.__algots__.defaultCreate() -> void: +__algots__.defaultCreate: + // tests/approvals/state-totals.algo.ts:27-28 + // @contract({ stateTotals: {} }) + // export class ExtendsSubWithTotals extends SubClassWithExplicitTotals { + proto 0 0 + retsub diff --git a/tests/approvals/out/state-totals/ExtendsSubWithTotals.arc32.json b/tests/approvals/out/state-totals/ExtendsSubWithTotals.arc32.json new file mode 100644 index 00000000..155a9145 --- /dev/null +++ b/tests/approvals/out/state-totals/ExtendsSubWithTotals.arc32.json @@ -0,0 +1,73 @@ +{ + "hints": { + "setState(uint64)void": { + "call_config": { + "opt_in": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkV4dGVuZHNTdWJXaXRoVG90YWxzLmFwcHJvdmFsUHJvZ3JhbToKICAgIGludGNibG9jayAwIDEKICAgIGJ5dGVjYmxvY2sgIm9uZUdsb2JhbCIKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBibnogbWFpbl9hZnRlcl9pZl9lbHNlQDIKICAgIGNhbGxzdWIgY29uc3RydWN0b3IKCm1haW5fYWZ0ZXJfaWZfZWxzZUAyOgogICAgY2FsbHN1YiBfX3B1eWFfYXJjNF9yb3V0ZXJfXwogICAgcmV0dXJuCgoKLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjpFeHRlbmRzU3ViV2l0aFRvdGFscy5jb25zdHJ1Y3RvcigpIC0+IHZvaWQ6CmNvbnN0cnVjdG9yOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjI3LTI4CiAgICAvLyBAY29udHJhY3QoeyBzdGF0ZVRvdGFsczoge30gfSkKICAgIC8vIGV4cG9ydCBjbGFzcyBFeHRlbmRzU3ViV2l0aFRvdGFscyBleHRlbmRzIFN1YkNsYXNzV2l0aEV4cGxpY2l0VG90YWxzIHsKICAgIHByb3R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hdWx0Q3JlYXRlKCkgLT4gdm9pZDoKX19hbGdvdHNfXy5kZWZhdWx0Q3JlYXRlOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjI3LTI4CiAgICAvLyBAY29udHJhY3QoeyBzdGF0ZVRvdGFsczoge30gfSkKICAgIC8vIGV4cG9ydCBjbGFzcyBFeHRlbmRzU3ViV2l0aFRvdGFscyBleHRlbmRzIFN1YkNsYXNzV2l0aEV4cGxpY2l0VG90YWxzIHsKICAgIHByb3RvIDAgMAogICAgcmV0c3ViCg==", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkV4dGVuZHNTdWJXaXRoVG90YWxzLmNsZWFyU3RhdGVQcm9ncmFtOgogICAgcHVzaGludCAxIC8vIDEKICAgIHJldHVybgo=" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 2 + }, + "local": { + "num_byte_slices": 1, + "num_uints": 1 + } + }, + "schema": { + "global": { + "declared": { + "oneGlobal": { + "type": "uint64", + "key": "oneGlobal" + }, + "twoGlobal": { + "type": "uint64", + "key": "twoGlobal" + } + }, + "reserved": {} + }, + "local": { + "declared": { + "oneLocal": { + "type": "uint64", + "key": "oneLocal" + }, + "oneLocalBytes": { + "type": "bytes", + "key": "oneLocalBytes" + } + }, + "reserved": {} + } + }, + "contract": { + "name": "ExtendsSubWithTotals", + "methods": [ + { + "name": "setState", + "args": [ + { + "type": "uint64", + "name": "n" + } + ], + "readonly": false, + "returns": { + "type": "void" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/tests/approvals/out/state-totals/ExtendsSubWithTotals.arc56.json b/tests/approvals/out/state-totals/ExtendsSubWithTotals.arc56.json new file mode 100644 index 00000000..0bf70264 --- /dev/null +++ b/tests/approvals/out/state-totals/ExtendsSubWithTotals.arc56.json @@ -0,0 +1,117 @@ +{ + "name": "ExtendsSubWithTotals", + "structs": {}, + "methods": [ + { + "name": "setState", + "args": [ + { + "type": "uint64", + "name": "n" + } + ], + "returns": { + "type": "void" + }, + "actions": { + "create": [], + "call": [ + "OptIn" + ] + }, + "readonly": false, + "events": [], + "recommendations": {} + } + ], + "arcs": [ + 22, + 28 + ], + "networks": {}, + "state": { + "schema": { + "global": { + "ints": 2, + "bytes": 0 + }, + "local": { + "ints": 1, + "bytes": 1 + } + }, + "keys": { + "global": { + "oneGlobal": { + "keyType": "AVMString", + "valueType": "AVMUint64", + "key": "b25lR2xvYmFs" + }, + "twoGlobal": { + "keyType": "AVMString", + "valueType": "AVMUint64", + "key": "dHdvR2xvYmFs" + } + }, + "local": { + "oneLocalBytes": { + "keyType": "AVMString", + "valueType": "AVMBytes", + "key": "b25lTG9jYWxCeXRlcw==" + }, + "oneLocal": { + "keyType": "AVMString", + "valueType": "AVMUint64", + "key": "b25lTG9jYWw=" + } + }, + "box": {} + }, + "maps": { + "global": {}, + "local": {}, + "box": {} + } + }, + "bareActions": { + "create": [ + "NoOp" + ], + "call": [] + }, + "sourceInfo": { + "approval": { + "sourceInfo": [ + { + "pc": [ + 81 + ], + "errorMessage": "OnCompletion is not OptIn" + }, + { + "pc": [ + 114 + ], + "errorMessage": "can only call when creating" + }, + { + "pc": [ + 86 + ], + "errorMessage": "can only call when not creating" + } + ], + "pcOffsetMethod": "none" + }, + "clear": { + "sourceInfo": [], + "pcOffsetMethod": "none" + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkV4dGVuZHNTdWJXaXRoVG90YWxzLmFwcHJvdmFsUHJvZ3JhbToKICAgIGludGNibG9jayAwIDEKICAgIGJ5dGVjYmxvY2sgIm9uZUdsb2JhbCIKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBibnogbWFpbl9hZnRlcl9pZl9lbHN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m9uZUdsb2JhbC52YWx1ZSA9IG4KICAgIGZyYW1lX2RpZyAtMQogICAgYXBwX2dsb2JhbF9wdXQKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9zdGF0ZS10b3RhbHMuYWxnby50czo2CiAgICAvLyB0d29HbG9iYWwgPSBHbG9iYWxTdGF0ZTx1aW50NjQ+KCkKICAgIHB1c2hieXRlcyAidHdvR2xvYmFsIgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjExCiAgICAvLyB0aGlzLnR3b0dsb2JhbC52YWx1ZSA9IG4KICAgIGZyYW1lX2RpZyAtMQogICAgYXBwX2dsb2JhbF9wdXQKICAgIHJldHN1YgoKCi8vIHRlc3RzL2FwcHJvdmFscy9zdGF0ZS10b3RhbHMuYWxnby50czo6RXh0ZW5kc1N1YldpdGhUb3RhbHMuX19hbGdvdHNfXy5kZWZhdWx0Q3JlYXRlKCkgLT4gdm9pZDoKX19hbGdvdHNfXy5kZWZhdWx0Q3JlYXRlOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjI3LTI4CiAgICAvLyBAY29udHJhY3QoeyBzdGF0ZVRvdGFsczoge30gfSkKICAgIC8vIGV4cG9ydCBjbGFzcyBFeHRlbmRzU3ViV2l0aFRvdGFscyBleHRlbmRzIFN1YkNsYXNzV2l0aEV4cGxpY2l0VG90YWxzIHsKICAgIHByb3RvIDAgMAogICAgcmV0c3ViCg==", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkV4dGVuZHNTdWJXaXRoVG90YWxzLmNsZWFyU3RhdGVQcm9ncmFtOgogICAgcHVzaGludCAxIC8vIDEKICAgIHJldHVybgo=" + }, + "events": [], + "templateVariables": {} +} \ No newline at end of file diff --git a/tests/approvals/out/state-totals/ExtendsSubWithTotals.clear.teal b/tests/approvals/out/state-totals/ExtendsSubWithTotals.clear.teal new file mode 100644 index 00000000..92df2d7c --- /dev/null +++ b/tests/approvals/out/state-totals/ExtendsSubWithTotals.clear.teal @@ -0,0 +1,5 @@ +#pragma version 10 + +tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.clearStateProgram: + pushint 1 // 1 + return diff --git a/tests/approvals/out/state-totals/ExtendsSubWithTotals.ssa.ir b/tests/approvals/out/state-totals/ExtendsSubWithTotals.ssa.ir new file mode 100644 index 00000000..e7c276d3 --- /dev/null +++ b/tests/approvals/out/state-totals/ExtendsSubWithTotals.ssa.ir @@ -0,0 +1,88 @@ +contract tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.constructor() -> void: + block@0: // L27 + tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.constructor() + return + + subroutine tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.constructor() -> void: + block@0: // L24 + tests/approvals/state-totals.algo.ts::BaseWithState.constructor() + return + + subroutine tests/approvals/state-totals.algo.ts::BaseWithState.constructor() -> void: + block@0: // L4 + (app_global_put "oneGlobal" 1u) + return + + subroutine tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.__puya_arc4_router__() -> bool: + block@0: // L27 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@5 + block@1: // abi_routing_L27 + let tmp%2#0: bytes = (txna ApplicationArgs 0) + switch tmp%2#0 {method "setState(uint64)void" => block@2, * => block@3} + block@2: // setState_route_L31 + let tmp%3#0: uint64 = (txn OnCompletion) + let tmp%4#0: bool = (== tmp%3#0 OptIn) + (assert tmp%4#0) // OnCompletion is not OptIn + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (!= tmp%5#0 0u) + (assert tmp%6#0) // can only call when not creating + let tmp%7#0: bytes = (txna ApplicationArgs 1) + let tmp%8#0: uint64 = (btoi tmp%7#0) + tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.setState(tmp%8#0) + return 1u + block@3: // switch_case_default_L27 + goto block@4 + block@4: // switch_case_next_L27 + goto block@9 + block@5: // bare_routing_L27 + let tmp%9#0: uint64 = (txn OnCompletion) + switch tmp%9#0 {0u => block@6, * => block@7} + block@6: // __algots__.defaultCreate_L27 + let tmp%10#0: uint64 = (txn ApplicationID) + let tmp%11#0: bool = (== tmp%10#0 0u) + (assert tmp%11#0) // can only call when creating + tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.__algots__.defaultCreate() + return 1u + block@7: // switch_case_default_L27 + goto block@8 + block@8: // switch_case_next_L27 + goto block@9 + block@9: // after_if_else_L27 + return 0u + + subroutine tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.setState(n: uint64) -> void: + block@0: // L31 + tests/approvals/state-totals.algo.ts::BaseWithState.setState(n#0) + let tmp%0#0: bytes = (txn Sender) + (app_local_put tmp%0#0 "oneLocal" n#0) + return + + subroutine tests/approvals/state-totals.algo.ts::BaseWithState.setState(n: uint64) -> void: + block@0: // L9 + (app_global_put "oneGlobal" n#0) + (app_global_put "twoGlobal" n#0) + return + + subroutine tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals.__algots__.defaultCreate() -> void: + block@0: // L27 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/state-totals/SubClassWithExplicitTotals.approval.teal b/tests/approvals/out/state-totals/SubClassWithExplicitTotals.approval.teal new file mode 100644 index 00000000..1527213a --- /dev/null +++ b/tests/approvals/out/state-totals/SubClassWithExplicitTotals.approval.teal @@ -0,0 +1,139 @@ +#pragma version 10 + +tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.approvalProgram: + intcblock 0 1 + bytecblock "oneGlobal" + txn ApplicationID + bnz main_after_if_else@2 + callsub constructor + +main_after_if_else@2: + callsub __puya_arc4_router__ + return + + +// tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.constructor() -> void: +constructor: + // tests/approvals/state-totals.algo.ts:24-25 + // @contract({ stateTotals: { globalUints: 4, localUints: 0 } }) + // export class SubClassWithExplicitTotals extends BaseWithState {} + proto 0 0 + callsub tests/approvals/state-totals.algo.ts::BaseWithState.constructor + retsub + + +// tests/approvals/state-totals.algo.ts::BaseWithState.constructor() -> void: +tests/approvals/state-totals.algo.ts::BaseWithState.constructor: + // tests/approvals/state-totals.algo.ts:4 + // export class BaseWithState extends Contract { + proto 0 0 + // tests/approvals/state-totals.algo.ts:5 + // oneGlobal = GlobalState({ initialValue: Uint64(1) }) + bytec_0 // "oneGlobal" + intc_1 // 1 + app_global_put + retsub + + +// tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.__puya_arc4_router__() -> uint64: +__puya_arc4_router__: + // tests/approvals/state-totals.algo.ts:24-25 + // @contract({ stateTotals: { globalUints: 4, localUints: 0 } }) + // export class SubClassWithExplicitTotals extends BaseWithState {} + proto 0 1 + txn NumAppArgs + intc_0 // 0 + != + bz __puya_arc4_router___bare_routing@5 + txna ApplicationArgs 0 + pushbytes 0x2cd95aa1 // method "setState(uint64)void" + swap + match __puya_arc4_router___setState_route@2 + b __puya_arc4_router___switch_case_default@3 + +__puya_arc4_router___setState_route@2: + // tests/approvals/state-totals.algo.ts:9 + // setState(n: uint64) { + txn OnCompletion + intc_0 // NoOp + == + assert // OnCompletion is not NoOp + txn ApplicationID + intc_0 // 0 + != + assert // can only call when not creating + // tests/approvals/state-totals.algo.ts:24-25 + // @contract({ stateTotals: { globalUints: 4, localUints: 0 } }) + // export class SubClassWithExplicitTotals extends BaseWithState {} + txna ApplicationArgs 1 + btoi + // tests/approvals/state-totals.algo.ts:9 + // setState(n: uint64) { + callsub setState + intc_1 // 1 + retsub + +__puya_arc4_router___switch_case_default@3: + b __puya_arc4_router___after_if_else@9 + +__puya_arc4_router___bare_routing@5: + // tests/approvals/state-totals.algo.ts:24-25 + // @contract({ stateTotals: { globalUints: 4, localUints: 0 } }) + // export class SubClassWithExplicitTotals extends BaseWithState {} + txn OnCompletion + intc_0 // 0 + swap + match __puya_arc4_router_____algots__.defaultCreate@6 + b __puya_arc4_router___switch_case_default@7 + +__puya_arc4_router_____algots__.defaultCreate@6: + // tests/approvals/state-totals.algo.ts:24-25 + // @contract({ stateTotals: { globalUints: 4, localUints: 0 } }) + // export class SubClassWithExplicitTotals extends BaseWithState {} + txn ApplicationID + intc_0 // 0 + == + assert // can only call when creating + callsub __algots__.defaultCreate + intc_1 // 1 + retsub + +__puya_arc4_router___switch_case_default@7: + +__puya_arc4_router___after_if_else@9: + // tests/approvals/state-totals.algo.ts:24-25 + // @contract({ stateTotals: { globalUints: 4, localUints: 0 } }) + // export class SubClassWithExplicitTotals extends BaseWithState {} + intc_0 // 0 + retsub + + +// tests/approvals/state-totals.algo.ts::BaseWithState.setState(n: uint64) -> void: +setState: + // tests/approvals/state-totals.algo.ts:9 + // setState(n: uint64) { + proto 1 0 + // tests/approvals/state-totals.algo.ts:5 + // oneGlobal = GlobalState({ initialValue: Uint64(1) }) + bytec_0 // "oneGlobal" + // tests/approvals/state-totals.algo.ts:10 + // this.oneGlobal.value = n + frame_dig -1 + app_global_put + // tests/approvals/state-totals.algo.ts:6 + // twoGlobal = GlobalState() + pushbytes "twoGlobal" + // tests/approvals/state-totals.algo.ts:11 + // this.twoGlobal.value = n + frame_dig -1 + app_global_put + retsub + + +// tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.__algots__.defaultCreate() -> void: +__algots__.defaultCreate: + // tests/approvals/state-totals.algo.ts:24-25 + // @contract({ stateTotals: { globalUints: 4, localUints: 0 } }) + // export class SubClassWithExplicitTotals extends BaseWithState {} + proto 0 0 + retsub diff --git a/tests/approvals/out/state-totals/SubClassWithExplicitTotals.arc32.json b/tests/approvals/out/state-totals/SubClassWithExplicitTotals.arc32.json new file mode 100644 index 00000000..de5150dd --- /dev/null +++ b/tests/approvals/out/state-totals/SubClassWithExplicitTotals.arc32.json @@ -0,0 +1,69 @@ +{ + "hints": { + "setState(uint64)void": { + "call_config": { + "no_op": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OlN1YkNsYXNzV2l0aEV4cGxpY2l0VG90YWxzLmFwcHJvdmFsUHJvZ3JhbToKICAgIGludGNibG9jayAwIDEKICAgIGJ5dGVjYmxvY2sgIm9uZUdsb2JhbCIKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBibnogbWFpbl9hZnRlcl9pZl9lbHNlQDIKICAgIGNhbGxzdWIgY29uc3RydWN0b3IKCm1haW5fYWZ0ZXJfaWZfZWxzZUAyOgogICAgY2FsbHN1YiBfX3B1eWFfYXJjNF9yb3V0ZXJfXwogICAgcmV0dXJuCgoKLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjpTdWJDbGFzc1dpdGhFeHBsaWNpdFRvdGFscy5jb25zdHJ1Y3RvcigpIC0+IHZvaWQ6CmNvbnN0cnVjdG9yOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjI0LTI1CiAgICAvLyBAY29udHJhY3QoeyBzdGF0ZVRvdGFsczogeyBnbG9iYWxVaW50czogNCwgbG9jYWxVaW50czogMCB9IH0pCi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SB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OlN1YkNsYXNzV2l0aEV4cGxpY2l0VG90YWxzLmNsZWFyU3RhdGVQcm9ncmFtOgogICAgcHVzaGludCAxIC8vIDEKICAgIHJldHVybgo=" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 4 + }, + "local": { + "num_byte_slices": 1, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": { + "oneGlobal": { + "type": "uint64", + "key": "oneGlobal" + }, + "twoGlobal": { + "type": "uint64", + "key": "twoGlobal" + } + }, + "reserved": {} + }, + "local": { + "declared": { + "oneLocalBytes": { + "type": "bytes", + "key": "oneLocalBytes" + } + }, + "reserved": {} + } + }, + "contract": { + "name": "SubClassWithExplicitTotals", + "methods": [ + { + "name": "setState", + "args": [ + { + "type": "uint64", + "name": "n" + } + ], + "readonly": false, + "returns": { + "type": "void" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/tests/approvals/out/state-totals/SubClassWithExplicitTotals.arc56.json b/tests/approvals/out/state-totals/SubClassWithExplicitTotals.arc56.json new file mode 100644 index 00000000..2c0481ce --- /dev/null +++ b/tests/approvals/out/state-totals/SubClassWithExplicitTotals.arc56.json @@ -0,0 +1,112 @@ +{ + "name": "SubClassWithExplicitTotals", + "structs": {}, + "methods": [ + { + "name": "setState", + "args": [ + { + "type": "uint64", + "name": "n" + } + ], + "returns": { + "type": "void" + }, + "actions": { + "create": [], + "call": [ + "NoOp" + ] + }, + "readonly": false, + "events": [], + "recommendations": {} + } + ], + "arcs": [ + 22, + 28 + ], + "networks": {}, + "state": { + "schema": { + "global": { + "ints": 4, + "bytes": 0 + }, + "local": { + "ints": 0, + "bytes": 1 + } + }, + "keys": { + "global": { + "oneGlobal": { + "keyType": "AVMString", + "valueType": "AVMUint64", + "key": "b25lR2xvYmFs" + }, + "twoGlobal": { + "keyType": "AVMString", + "valueType": "AVMUint64", + "key": "dHdvR2xvYmFs" + } + }, + "local": { + "oneLocalBytes": { + "keyType": "AVMString", + "valueType": "AVMBytes", + "key": "b25lTG9jYWxCeXRlcw==" + } + }, + "box": {} + }, + "maps": { + "global": {}, + "local": {}, + "box": {} + } + }, + "bareActions": { + "create": [ + "NoOp" + ], + "call": [] + }, + "sourceInfo": { + "approval": { + "sourceInfo": [ + { + "pc": [ + 74 + ], + "errorMessage": "OnCompletion is not NoOp" + }, + { + "pc": [ + 107 + ], + "errorMessage": "can only call when creating" + }, + { + "pc": [ + 79 + ], + "errorMessage": "can only call when not creating" + } + ], + "pcOffsetMethod": "none" + }, + "clear": { + "sourceInfo": [], + "pcOffsetMethod": "none" + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OlN1YkNsYXNzV2l0aEV4cGxpY2l0VG90YWxzLmFwcHJvdmFsUHJvZ3JhbToKICAgIGludGNibG9jayAwIDEKICAgIGJ5dGVjYmxvY2sgIm9uZUdsb2JhbCIKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBibnogbWFpbl9hZnRlcl9pZl9lbHNlQDIKICAgIGNhbGxzdWIgY29uc3RydWN0b3IKCm1haW5fYWZ0ZXJfaWZfZWxzZUAyOgogICAgY2FsbHN1YiBfX3B1eWFfYXJjNF9yb3V0ZXJfXwogICAgcmV0dXJuCgoKLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjpTdWJDbGFzc1dpdGhFeHBsaWNpdFRvdGFscy5jb25zdHJ1Y3RvcigpIC0+IHZvaWQ6CmNvbnN0cnVjdG9yOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjI0LTI1CiAgICAvLyBAY29udHJhY3QoeyBzdGF0ZVRvdGFsczogeyBnbG9iYWxVaW50czogNCwgbG9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dWIK", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OlN1YkNsYXNzV2l0aEV4cGxpY2l0VG90YWxzLmNsZWFyU3RhdGVQcm9ncmFtOgogICAgcHVzaGludCAxIC8vIDEKICAgIHJldHVybgo=" + }, + "events": [], + "templateVariables": {} +} \ No newline at end of file diff --git a/tests/approvals/out/state-totals/SubClassWithExplicitTotals.clear.teal b/tests/approvals/out/state-totals/SubClassWithExplicitTotals.clear.teal new file mode 100644 index 00000000..bb0cb81c --- /dev/null +++ b/tests/approvals/out/state-totals/SubClassWithExplicitTotals.clear.teal @@ -0,0 +1,5 @@ +#pragma version 10 + +tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.clearStateProgram: + pushint 1 // 1 + return diff --git a/tests/approvals/out/state-totals/SubClassWithExplicitTotals.ssa.ir b/tests/approvals/out/state-totals/SubClassWithExplicitTotals.ssa.ir new file mode 100644 index 00000000..35726863 --- /dev/null +++ b/tests/approvals/out/state-totals/SubClassWithExplicitTotals.ssa.ir @@ -0,0 +1,76 @@ +contract tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.constructor() -> void: + block@0: // L24 + tests/approvals/state-totals.algo.ts::BaseWithState.constructor() + return + + subroutine tests/approvals/state-totals.algo.ts::BaseWithState.constructor() -> void: + block@0: // L4 + (app_global_put "oneGlobal" 1u) + return + + subroutine tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.__puya_arc4_router__() -> bool: + block@0: // L24 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@5 + block@1: // abi_routing_L24 + let tmp%2#0: bytes = (txna ApplicationArgs 0) + switch tmp%2#0 {method "setState(uint64)void" => block@2, * => block@3} + block@2: // setState_route_L9 + let tmp%3#0: uint64 = (txn OnCompletion) + let tmp%4#0: bool = (== tmp%3#0 NoOp) + (assert tmp%4#0) // OnCompletion is not NoOp + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (!= tmp%5#0 0u) + (assert tmp%6#0) // can only call when not creating + let tmp%7#0: bytes = (txna ApplicationArgs 1) + let tmp%8#0: uint64 = (btoi tmp%7#0) + tests/approvals/state-totals.algo.ts::BaseWithState.setState(tmp%8#0) + return 1u + block@3: // switch_case_default_L24 + goto block@4 + block@4: // switch_case_next_L24 + goto block@9 + block@5: // bare_routing_L24 + let tmp%9#0: uint64 = (txn OnCompletion) + switch tmp%9#0 {0u => block@6, * => block@7} + block@6: // __algots__.defaultCreate_L24 + let tmp%10#0: uint64 = (txn ApplicationID) + let tmp%11#0: bool = (== tmp%10#0 0u) + (assert tmp%11#0) // can only call when creating + tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.__algots__.defaultCreate() + return 1u + block@7: // switch_case_default_L24 + goto block@8 + block@8: // switch_case_next_L24 + goto block@9 + block@9: // after_if_else_L24 + return 0u + + subroutine tests/approvals/state-totals.algo.ts::BaseWithState.setState(n: uint64) -> void: + block@0: // L9 + (app_global_put "oneGlobal" n#0) + (app_global_put "twoGlobal" n#0) + return + + subroutine tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals.__algots__.defaultCreate() -> void: + block@0: // L24 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/state-totals/SubClassWithState.approval.teal b/tests/approvals/out/state-totals/SubClassWithState.approval.teal new file mode 100644 index 00000000..fccd7897 --- /dev/null +++ b/tests/approvals/out/state-totals/SubClassWithState.approval.teal @@ -0,0 +1,151 @@ +#pragma version 10 + +tests/approvals/state-totals.algo.ts::SubClassWithState.approvalProgram: + intcblock 0 1 + bytecblock "oneGlobal" + txn ApplicationID + bnz main_after_if_else@2 + callsub constructor + +main_after_if_else@2: + callsub __puya_arc4_router__ + return + + +// tests/approvals/state-totals.algo.ts::SubClassWithState.constructor() -> void: +constructor: + // tests/approvals/state-totals.algo.ts:15 + // export class SubClassWithState extends BaseWithState { + proto 0 0 + callsub tests/approvals/state-totals.algo.ts::BaseWithState.constructor + retsub + + +// tests/approvals/state-totals.algo.ts::BaseWithState.constructor() -> void: +tests/approvals/state-totals.algo.ts::BaseWithState.constructor: + // tests/approvals/state-totals.algo.ts:4 + // export class BaseWithState extends Contract { + proto 0 0 + // tests/approvals/state-totals.algo.ts:5 + // oneGlobal = GlobalState({ initialValue: Uint64(1) }) + bytec_0 // "oneGlobal" + intc_1 // 1 + app_global_put + retsub + + +// tests/approvals/state-totals.algo.ts::SubClassWithState.__puya_arc4_router__() -> uint64: +__puya_arc4_router__: + // tests/approvals/state-totals.algo.ts:15 + // export class SubClassWithState extends BaseWithState { + proto 0 1 + txn NumAppArgs + intc_0 // 0 + != + bz __puya_arc4_router___bare_routing@5 + txna ApplicationArgs 0 + pushbytes 0x2cd95aa1 // method "setState(uint64)void" + swap + match __puya_arc4_router___setState_route@2 + b __puya_arc4_router___switch_case_default@3 + +__puya_arc4_router___setState_route@2: + // tests/approvals/state-totals.algo.ts:18 + // setState(n: uint64) { + txn OnCompletion + intc_0 // NoOp + == + assert // OnCompletion is not NoOp + txn ApplicationID + intc_0 // 0 + != + assert // can only call when not creating + // tests/approvals/state-totals.algo.ts:15 + // export class SubClassWithState extends BaseWithState { + txna ApplicationArgs 1 + btoi + // tests/approvals/state-totals.algo.ts:18 + // setState(n: uint64) { + callsub setState + intc_1 // 1 + retsub + +__puya_arc4_router___switch_case_default@3: + b __puya_arc4_router___after_if_else@9 + +__puya_arc4_router___bare_routing@5: + // tests/approvals/state-totals.algo.ts:15 + // export class SubClassWithState extends BaseWithState { + txn OnCompletion + intc_0 // 0 + swap + match __puya_arc4_router_____algots__.defaultCreate@6 + b __puya_arc4_router___switch_case_default@7 + +__puya_arc4_router_____algots__.defaultCreate@6: + // tests/approvals/state-totals.algo.ts:15 + // export class SubClassWithState extends BaseWithState { + txn ApplicationID + intc_0 // 0 + == + assert // can only call when creating + callsub __algots__.defaultCreate + intc_1 // 1 + retsub + +__puya_arc4_router___switch_case_default@7: + +__puya_arc4_router___after_if_else@9: + // tests/approvals/state-totals.algo.ts:15 + // export class SubClassWithState extends BaseWithState { + intc_0 // 0 + retsub + + +// tests/approvals/state-totals.algo.ts::SubClassWithState.setState(n: uint64) -> void: +setState: + // tests/approvals/state-totals.algo.ts:18 + // setState(n: uint64) { + proto 1 0 + // tests/approvals/state-totals.algo.ts:19 + // super.setState(n) + frame_dig -1 + callsub tests/approvals/state-totals.algo.ts::BaseWithState.setState + // tests/approvals/state-totals.algo.ts:16 + // threeGlobal = GlobalState() + pushbytes "threeGlobal" + // tests/approvals/state-totals.algo.ts:20 + // this.threeGlobal.value = n + frame_dig -1 + app_global_put + retsub + + +// tests/approvals/state-totals.algo.ts::BaseWithState.setState(n: uint64) -> void: +tests/approvals/state-totals.algo.ts::BaseWithState.setState: + // tests/approvals/state-totals.algo.ts:9 + // setState(n: uint64) { + proto 1 0 + // tests/approvals/state-totals.algo.ts:5 + // oneGlobal = GlobalState({ initialValue: Uint64(1) }) + bytec_0 // "oneGlobal" + // tests/approvals/state-totals.algo.ts:10 + // this.oneGlobal.value = n + frame_dig -1 + app_global_put + // tests/approvals/state-totals.algo.ts:6 + // twoGlobal = GlobalState() + pushbytes "twoGlobal" + // tests/approvals/state-totals.algo.ts:11 + // this.twoGlobal.value = n + frame_dig -1 + app_global_put + retsub + + +// tests/approvals/state-totals.algo.ts::SubClassWithState.__algots__.defaultCreate() -> void: +__algots__.defaultCreate: + // tests/approvals/state-totals.algo.ts:15 + // export class SubClassWithState extends BaseWithState { + proto 0 0 + retsub diff --git a/tests/approvals/out/state-totals/SubClassWithState.arc32.json b/tests/approvals/out/state-totals/SubClassWithState.arc32.json new file mode 100644 index 00000000..45f77a85 --- /dev/null +++ b/tests/approvals/out/state-totals/SubClassWithState.arc32.json @@ -0,0 +1,77 @@ +{ + "hints": { + "setState(uint64)void": { + "call_config": { + "no_op": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OlN1YkNsYXNzV2l0aFN0YXRlLmFwcHJvdmFsUHJvZ3JhbToKICAgIGludGNibG9jayAwIDEKICAgIGJ5dGVjYmxvY2sgIm9uZUdsb2JhbCIKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBibnogbWFpbl9hZnRlcl9pZl9lbHNlQDIKICAgIGNhbGxzdWIgY29uc3RydWN0b3IKCm1haW5fYWZ0ZXJfaWZfZWxzZUAyOgogICAgY2FsbHN1YiBfX3B1eWFfYXJjNF9yb3V0ZXJfXwogICAgcmV0dXJuCgoKLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjpTdWJDbGFzc1dpdGhTdGF0ZS5jb25zdHJ1Y3RvcigpIC0+IHZvaWQ6CmNvbnN0cnVjdG9yOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjE1CiAgICAvLyBleHBvcnQgY2xhc3MgU3ViQ2xhc3NXaXRoU3RhdGUgZXh0ZW5kcyBCYXNlV2l0aFN0YXRlIHsKICAgIHByb3RvIDAgMAogICAgY2FsbHN1YiB0ZXN0cy9hcHByb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XaXRoU3RhdGUgewogICAgcHJvdG8gMCAwCiAgICByZXRzdWIK", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OlN1YkNsYXNzV2l0aFN0YXRlLmNsZWFyU3RhdGVQcm9ncmFtOgogICAgcHVzaGludCAxIC8vIDEKICAgIHJldHVybgo=" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 3 + }, + "local": { + "num_byte_slices": 2, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": { + "oneGlobal": { + "type": "uint64", + "key": "oneGlobal" + }, + "threeGlobal": { + "type": "uint64", + "key": "threeGlobal" + }, + "twoGlobal": { + "type": "uint64", + "key": "twoGlobal" + } + }, + "reserved": {} + }, + "local": { + "declared": { + "oneLocalBytes": { + "type": "bytes", + "key": "oneLocalBytes" + }, + "twoLocalBytes": { + "type": "bytes", + "key": "twoLocalBytes" + } + }, + "reserved": {} + } + }, + "contract": { + "name": "SubClassWithState", + "methods": [ + { + "name": "setState", + "args": [ + { + "type": "uint64", + "name": "n" + } + ], + "readonly": false, + "returns": { + "type": "void" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/tests/approvals/out/state-totals/SubClassWithState.arc56.json b/tests/approvals/out/state-totals/SubClassWithState.arc56.json new file mode 100644 index 00000000..1715ff2b --- /dev/null +++ b/tests/approvals/out/state-totals/SubClassWithState.arc56.json @@ -0,0 +1,122 @@ +{ + "name": "SubClassWithState", + "structs": {}, + "methods": [ + { + "name": "setState", + "args": [ + { + "type": "uint64", + "name": "n" + } + ], + "returns": { + "type": "void" + }, + "actions": { + "create": [], + "call": [ + "NoOp" + ] + }, + "readonly": false, + "events": [], + "recommendations": {} + } + ], + "arcs": [ + 22, + 28 + ], + "networks": {}, + "state": { + "schema": { + "global": { + "ints": 3, + "bytes": 0 + }, + "local": { + "ints": 0, + "bytes": 2 + } + }, + "keys": { + "global": { + "oneGlobal": { + "keyType": "AVMString", + "valueType": "AVMUint64", + "key": "b25lR2xvYmFs" + }, + "twoGlobal": { + "keyType": "AVMString", + "valueType": "AVMUint64", + "key": "dHdvR2xvYmFs" + }, + "threeGlobal": { + "keyType": "AVMString", + "valueType": "AVMUint64", + "key": "dGhyZWVHbG9iYWw=" + } + }, + "local": { + "oneLocalBytes": { + "keyType": "AVMString", + "valueType": "AVMBytes", + "key": "b25lTG9jYWxCeXRlcw==" + }, + "twoLocalBytes": { + "keyType": "AVMString", + "valueType": "AVMBytes", + "key": "dHdvTG9jYWxCeXRlcw==" + } + }, + "box": {} + }, + "maps": { + "global": {}, + "local": {}, + "box": {} + } + }, + "bareActions": { + "create": [ + "NoOp" + ], + "call": [] + }, + "sourceInfo": { + "approval": { + "sourceInfo": [ + { + "pc": [ + 74 + ], + "errorMessage": "OnCompletion is not NoOp" + }, + { + "pc": [ + 107 + ], + "errorMessage": "can only call when creating" + }, + { + "pc": [ + 79 + ], + "errorMessage": "can only call when not creating" + } + ], + "pcOffsetMethod": "none" + }, + "clear": { + "sourceInfo": [], + "pcOffsetMethod": "none" + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OlN1YkNsYXNzV2l0aFN0YXRlLmFwcHJvdmFsUHJvZ3JhbToKICAgIGludGNibG9jayAwIDEKICAgIGJ5dGVjYmxvY2sgIm9uZUdsb2JhbCIKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBibnogbWFpbl9hZnRlcl9pZl9lbHNlQDIKICAgIGNhbGxzdWIgY29uc3RydWN0b3IKCm1haW5fYWZ0ZXJfaWZfZWxzZUAyOgogICAgY2FsbHN1YiBfX3B1eWFfYXJjNF9yb3V0ZXJfXwogICAgcmV0dXJuCgoKLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjpTd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N0YXRlLXRvdGFscy5hbGdvLnRzOjpTdWJDbGFzc1dpdGhTdGF0ZS5fX2FsZ290c19fLmRlZmF1bHRDcmVhdGUoKSAtPiB2b2lkOgpfX2FsZ290c19fLmRlZmF1bHRDcmVhdGU6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6MTUKICAgIC8vIGV4cG9ydCBjbGFzcyBTdWJDbGFzc1dpdGhTdGF0ZSBleHRlbmRzIEJhc2VXaXRoU3RhdGUgewogICAgcHJvdG8gMCAwCiAgICByZXRzdWIK", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OlN1YkNsYXNzV2l0aFN0YXRlLmNsZWFyU3RhdGVQcm9ncmFtOgogICAgcHVzaGludCAxIC8vIDEKICAgIHJldHVybgo=" + }, + "events": [], + "templateVariables": {} +} \ No newline at end of file diff --git a/tests/approvals/out/state-totals/SubClassWithState.clear.teal b/tests/approvals/out/state-totals/SubClassWithState.clear.teal new file mode 100644 index 00000000..09c86e12 --- /dev/null +++ b/tests/approvals/out/state-totals/SubClassWithState.clear.teal @@ -0,0 +1,5 @@ +#pragma version 10 + +tests/approvals/state-totals.algo.ts::SubClassWithState.clearStateProgram: + pushint 1 // 1 + return diff --git a/tests/approvals/out/state-totals/SubClassWithState.ssa.ir b/tests/approvals/out/state-totals/SubClassWithState.ssa.ir new file mode 100644 index 00000000..42c8c543 --- /dev/null +++ b/tests/approvals/out/state-totals/SubClassWithState.ssa.ir @@ -0,0 +1,82 @@ +contract tests/approvals/state-totals.algo.ts::SubClassWithState: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/state-totals.algo.ts::SubClassWithState.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/state-totals.algo.ts::SubClassWithState.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/state-totals.algo.ts::SubClassWithState.constructor() -> void: + block@0: // L15 + tests/approvals/state-totals.algo.ts::BaseWithState.constructor() + return + + subroutine tests/approvals/state-totals.algo.ts::BaseWithState.constructor() -> void: + block@0: // L4 + (app_global_put "oneGlobal" 1u) + return + + subroutine tests/approvals/state-totals.algo.ts::SubClassWithState.__puya_arc4_router__() -> bool: + block@0: // L15 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@5 + block@1: // abi_routing_L15 + let tmp%2#0: bytes = (txna ApplicationArgs 0) + switch tmp%2#0 {method "setState(uint64)void" => block@2, * => block@3} + block@2: // setState_route_L18 + let tmp%3#0: uint64 = (txn OnCompletion) + let tmp%4#0: bool = (== tmp%3#0 NoOp) + (assert tmp%4#0) // OnCompletion is not NoOp + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (!= tmp%5#0 0u) + (assert tmp%6#0) // can only call when not creating + let tmp%7#0: bytes = (txna ApplicationArgs 1) + let tmp%8#0: uint64 = (btoi tmp%7#0) + tests/approvals/state-totals.algo.ts::SubClassWithState.setState(tmp%8#0) + return 1u + block@3: // switch_case_default_L15 + goto block@4 + block@4: // switch_case_next_L15 + goto block@9 + block@5: // bare_routing_L15 + let tmp%9#0: uint64 = (txn OnCompletion) + switch tmp%9#0 {0u => block@6, * => block@7} + block@6: // __algots__.defaultCreate_L15 + let tmp%10#0: uint64 = (txn ApplicationID) + let tmp%11#0: bool = (== tmp%10#0 0u) + (assert tmp%11#0) // can only call when creating + tests/approvals/state-totals.algo.ts::SubClassWithState.__algots__.defaultCreate() + return 1u + block@7: // switch_case_default_L15 + goto block@8 + block@8: // switch_case_next_L15 + goto block@9 + block@9: // after_if_else_L15 + return 0u + + subroutine tests/approvals/state-totals.algo.ts::SubClassWithState.setState(n: uint64) -> void: + block@0: // L18 + tests/approvals/state-totals.algo.ts::BaseWithState.setState(n#0) + (app_global_put "threeGlobal" n#0) + return + + subroutine tests/approvals/state-totals.algo.ts::BaseWithState.setState(n: uint64) -> void: + block@0: // L9 + (app_global_put "oneGlobal" n#0) + (app_global_put "twoGlobal" n#0) + return + + subroutine tests/approvals/state-totals.algo.ts::SubClassWithState.__algots__.defaultCreate() -> void: + block@0: // L15 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/state-totals/state-totals.awst b/tests/approvals/out/state-totals/state-totals.awst new file mode 100644 index 00000000..b026192c --- /dev/null +++ b/tests/approvals/out/state-totals/state-totals.awst @@ -0,0 +1,227 @@ +contract BaseWithState +{ + globals { + ["oneGlobal"]: uint64 + ["twoGlobal"]: uint64 + } + locals { + ["oneLocalBytes"]: bytes + } + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + setState(): void + { + GlobalState["oneGlobal"]: uint64 = n + GlobalState["twoGlobal"]: uint64 = n + } + + constructor(): void + { + void + GlobalState["oneGlobal"]: uint64 = 1 + } + + Contract::constructor(): void + { + this.constructor() + } + + BaseContract::constructor(): void + { + } + + __algots__.defaultCreate(): void + { + } + +} +contract SubClassWithState +{ + globals { + ["oneGlobal"]: uint64 + ["twoGlobal"]: uint64 + ["threeGlobal"]: uint64 + } + locals { + ["oneLocalBytes"]: bytes + ["twoLocalBytes"]: bytes + } + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + setState(): void + { + super.setState(n) + GlobalState["threeGlobal"]: uint64 = n + } + + constructor(): void + { + super.constructor() + } + + BaseWithState::setState(): void + { + GlobalState["oneGlobal"]: uint64 = n + GlobalState["twoGlobal"]: uint64 = n + } + + BaseWithState::constructor(): void + { + void + GlobalState["oneGlobal"]: uint64 = 1 + } + + Contract::constructor(): void + { + this.constructor() + } + + BaseContract::constructor(): void + { + } + + __algots__.defaultCreate(): void + { + } + +} +contract SubClassWithExplicitTotals +{ + globals { + ["oneGlobal"]: uint64 + ["twoGlobal"]: uint64 + } + locals { + ["oneLocalBytes"]: bytes + } + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + constructor(): void + { + super.constructor() + } + + BaseWithState::setState(): void + { + GlobalState["oneGlobal"]: uint64 = n + GlobalState["twoGlobal"]: uint64 = n + } + + BaseWithState::constructor(): void + { + void + GlobalState["oneGlobal"]: uint64 = 1 + } + + Contract::constructor(): void + { + this.constructor() + } + + BaseContract::constructor(): void + { + } + + __algots__.defaultCreate(): void + { + } + +} +contract ExtendsSubWithTotals +{ + globals { + ["oneGlobal"]: uint64 + ["twoGlobal"]: uint64 + } + locals { + ["oneLocalBytes"]: bytes + ["oneLocal"]: uint64 + } + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + setState(): void + { + super.setState(n) + LocalState[txn()]["oneLocal"]: uint64 = n + } + + constructor(): void + { + super.constructor() + } + + SubClassWithExplicitTotals::constructor(): void + { + super.constructor() + } + + BaseWithState::setState(): void + { + GlobalState["oneGlobal"]: uint64 = n + GlobalState["twoGlobal"]: uint64 = n + } + + BaseWithState::constructor(): void + { + void + GlobalState["oneGlobal"]: uint64 = 1 + } + + Contract::constructor(): void + { + this.constructor() + } + + BaseContract::constructor(): void + { + } + + __algots__.defaultCreate(): void + { + } + +} \ No newline at end of file diff --git a/tests/approvals/out/state-totals/state-totals.awst.json b/tests/approvals/out/state-totals/state-totals.awst.json new file mode 100644 index 00000000..3dc6841a --- /dev/null +++ b/tests/approvals/out/state-totals/state-totals.awst.json @@ -0,0 +1,4616 @@ +[ + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "id": "tests/approvals/state-totals.algo.ts::BaseWithState", + "name": "BaseWithState", + "description": null, + "method_resolution_order": [ + "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [] + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 9, + "column": 2, + "end_column": 21 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "n", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 9, + "column": 11, + "end_column": 20 + } + } + ], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 12, + "column": 22, + "end_column": 3 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 10, + "end_line": 10, + "column": 4, + "end_column": 28 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 10, + "end_line": 10, + "column": 19, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBrY;R&=Yy", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + }, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 10, + "end_line": 10, + "column": 27, + "end_column": 28 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 11, + "end_line": 11, + "column": 4, + "end_column": 28 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 11, + "end_line": 11, + "column": 19, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "ba!t@Y;R&=Yy", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + }, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 11, + "end_line": 11, + "column": 27, + "end_column": 28 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::BaseWithState", + "member_name": "setState", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 9, + "column": 2, + "end_column": 21 + }, + "name": "setState", + "is_bare": false, + "create": 3, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 54 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBrY;R&=Yy", + "encoding": "utf8" + }, + "exists_assertion_message": null + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 49, + "end_column": 50 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::BaseWithState", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": "Implicitly generated create method", + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::BaseWithState", + "member_name": "__algots__.defaultCreate", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "allowed_completion_types": [ + 0 + ], + "create": 2, + "is_bare": true + } + } + ], + "app_state": [ + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "member_name": "oneGlobal", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBrY;R&=Yy", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 11 + }, + "member_name": "twoGlobal", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "ba!t@Y;R&=Yy", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 7, + "end_line": 7, + "column": 2, + "end_column": 15 + }, + "member_name": "oneLocalBytes", + "kind": 2, + "storage_wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 7, + "end_line": 7, + "column": 2, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBwZ)0I>LV0v$a{", + "encoding": "utf8" + }, + "description": null + } + ], + "state_totals": { + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null + }, + "reserved_scratch_space": [], + "avm_version": null + }, + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 15, + "end_line": 15, + "column": 0, + "end_column": 54 + }, + "id": "tests/approvals/state-totals.algo.ts::SubClassWithState", + "name": "SubClassWithState", + "description": null, + "method_resolution_order": [ + "tests/approvals/state-totals.algo.ts::BaseWithState", + "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [] + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 18, + "end_line": 18, + "column": 2, + "end_column": 21 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "n", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 18, + "end_line": 18, + "column": 11, + "end_column": 20 + } + } + ], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 18, + "end_line": 21, + "column": 22, + "end_column": 3 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 19, + "end_line": 19, + "column": 4, + "end_column": 21 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 19, + "end_line": 19, + "column": 4, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "setState" + }, + "args": [ + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 19, + "end_line": 19, + "column": 19, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + } + ] + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 20, + "end_line": 20, + "column": 4, + "end_column": 30 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 20, + "end_line": 20, + "column": 21, + "end_column": 26 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 16, + "end_line": 16, + "column": 2, + "end_column": 13 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "bZByAWk+mpVqt6", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + }, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 20, + "end_line": 20, + "column": 29, + "end_column": 30 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::SubClassWithState", + "member_name": "setState", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 18, + "end_line": 18, + "column": 2, + "end_column": 21 + }, + "name": "setState", + "is_bare": false, + "create": 3, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 15, + "end_line": 15, + "column": 0, + "end_column": 54 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 15, + "end_line": 15, + "column": 0, + "end_column": 54 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 15, + "end_line": 15, + "column": 0, + "end_column": 54 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 15, + "end_line": 15, + "column": 0, + "end_column": 54 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::SubClassWithState", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 9, + "column": 2, + "end_column": 21 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "n", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 9, + "column": 11, + "end_column": 20 + } + } + ], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 12, + "column": 22, + "end_column": 3 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 10, + "end_line": 10, + "column": 4, + "end_column": 28 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 10, + "end_line": 10, + "column": 19, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBrY;R&=Yy", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + }, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 10, + "end_line": 10, + "column": 27, + "end_column": 28 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 11, + "end_line": 11, + "column": 4, + "end_column": 28 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 11, + "end_line": 11, + "column": 19, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "ba!t@Y;R&=Yy", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + }, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 11, + "end_line": 11, + "column": 27, + "end_column": 28 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::BaseWithState", + "member_name": "setState", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 9, + "column": 2, + "end_column": 21 + }, + "name": "setState", + "is_bare": false, + "create": 3, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 54 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBrY;R&=Yy", + "encoding": "utf8" + }, + "exists_assertion_message": null + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 49, + "end_column": 50 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::BaseWithState", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 15, + "end_line": 15, + "column": 0, + "end_column": 54 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 15, + "end_line": 15, + "column": 0, + "end_column": 54 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": "Implicitly generated create method", + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::SubClassWithState", + "member_name": "__algots__.defaultCreate", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 15, + "end_line": 15, + "column": 0, + "end_column": 54 + }, + "allowed_completion_types": [ + 0 + ], + "create": 2, + "is_bare": true + } + } + ], + "app_state": [ + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "member_name": "oneGlobal", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBrY;R&=Yy", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 11 + }, + "member_name": "twoGlobal", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "ba!t@Y;R&=Yy", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 7, + "end_line": 7, + "column": 2, + "end_column": 15 + }, + "member_name": "oneLocalBytes", + "kind": 2, + "storage_wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 7, + "end_line": 7, + "column": 2, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBwZ)0I>LV0v$a{", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 16, + "end_line": 16, + "column": 2, + "end_column": 13 + }, + "member_name": "threeGlobal", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 16, + "end_line": 16, + "column": 2, + "end_column": 13 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "bZByAWk+mpVqt6", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 17, + "end_line": 17, + "column": 2, + "end_column": 15 + }, + "member_name": "twoLocalBytes", + "kind": 2, + "storage_wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 17, + "end_line": 17, + "column": 2, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "ba!t|Z)0I>LV0v$a{", + "encoding": "utf8" + }, + "description": null + } + ], + "state_totals": { + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null + }, + "reserved_scratch_space": [], + "avm_version": null + }, + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 24, + "end_line": 25, + "column": 0, + "end_column": 64 + }, + "id": "tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals", + "name": "SubClassWithExplicitTotals", + "description": null, + "method_resolution_order": [ + "tests/approvals/state-totals.algo.ts::BaseWithState", + "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [] + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 24, + "end_line": 25, + "column": 0, + "end_column": 64 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 24, + "end_line": 25, + "column": 0, + "end_column": 64 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 24, + "end_line": 25, + "column": 0, + "end_column": 64 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 24, + "end_line": 25, + "column": 0, + "end_column": 64 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 9, + "column": 2, + "end_column": 21 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "n", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 9, + "column": 11, + "end_column": 20 + } + } + ], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 12, + "column": 22, + "end_column": 3 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 10, + "end_line": 10, + "column": 4, + "end_column": 28 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 10, + "end_line": 10, + "column": 19, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBrY;R&=Yy", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + }, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 10, + "end_line": 10, + "column": 27, + "end_column": 28 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 11, + "end_line": 11, + "column": 4, + "end_column": 28 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 11, + "end_line": 11, + "column": 19, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "ba!t@Y;R&=Yy", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + }, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 11, + "end_line": 11, + "column": 27, + "end_column": 28 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::BaseWithState", + "member_name": "setState", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 9, + "column": 2, + "end_column": 21 + }, + "name": "setState", + "is_bare": false, + "create": 3, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 54 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBrY;R&=Yy", + "encoding": "utf8" + }, + "exists_assertion_message": null + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 49, + "end_column": 50 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::BaseWithState", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 24, + "end_line": 25, + "column": 0, + "end_column": 64 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 24, + "end_line": 25, + "column": 0, + "end_column": 64 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": "Implicitly generated create method", + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals", + "member_name": "__algots__.defaultCreate", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 24, + "end_line": 25, + "column": 0, + "end_column": 64 + }, + "allowed_completion_types": [ + 0 + ], + "create": 2, + "is_bare": true + } + } + ], + "app_state": [ + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "member_name": "oneGlobal", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBrY;R&=Yy", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 11 + }, + "member_name": "twoGlobal", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "ba!t@Y;R&=Yy", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 7, + "end_line": 7, + "column": 2, + "end_column": 15 + }, + "member_name": "oneLocalBytes", + "kind": 2, + "storage_wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 7, + "end_line": 7, + "column": 2, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBwZ)0I>LV0v$a{", + "encoding": "utf8" + }, + "description": null + } + ], + "state_totals": { + "_type": "StateTotals", + "global_uints": "4", + "local_uints": "0", + "global_bytes": null, + "local_bytes": null + }, + "reserved_scratch_space": [], + "avm_version": null + }, + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 27, + "end_line": 28, + "column": 0, + "end_column": 70 + }, + "id": "tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals", + "name": "ExtendsSubWithTotals", + "description": null, + "method_resolution_order": [ + "tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals", + "tests/approvals/state-totals.algo.ts::BaseWithState", + "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [] + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 31, + "end_line": 32, + "column": 2, + "end_column": 21 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "n", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 32, + "end_line": 32, + "column": 11, + "end_column": 20 + } + } + ], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 32, + "end_line": 36, + "column": 22, + "end_column": 3 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 33, + "end_line": 33, + "column": 4, + "end_column": 21 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 33, + "end_line": 33, + "column": 4, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "setState" + }, + "args": [ + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 33, + "end_line": 33, + "column": 19, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + } + ] + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 35, + "end_line": 35, + "column": 4, + "end_column": 39 + }, + "target": { + "_type": "AppAccountStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 35, + "end_line": 35, + "column": 30, + "end_column": 35 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 29, + "end_line": 29, + "column": 2, + "end_column": 10 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBwZ)0I>", + "encoding": "utf8" + }, + "exists_assertion_message": "check LocalState exists", + "account": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 35, + "end_line": 35, + "column": 22, + "end_column": 28 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "txn", + "immediates": [ + "Sender" + ], + "stack_args": [] + } + }, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 35, + "end_line": 35, + "column": 38, + "end_column": 39 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals", + "member_name": "setState", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 31, + "end_line": 31, + "column": 3, + "end_column": 39 + }, + "name": "setState", + "is_bare": false, + "create": 3, + "readonly": false, + "allowed_completion_types": [ + 1 + ], + "default_args": {}, + "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 27, + "end_line": 28, + "column": 0, + "end_column": 70 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 27, + "end_line": 28, + "column": 0, + "end_column": 70 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 27, + "end_line": 28, + "column": 0, + "end_column": 70 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 27, + "end_line": 28, + "column": 0, + "end_column": 70 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 24, + "end_line": 25, + "column": 0, + "end_column": 64 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 24, + "end_line": 25, + "column": 0, + "end_column": 64 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 24, + "end_line": 25, + "column": 0, + "end_column": 64 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 24, + "end_line": 25, + "column": 0, + "end_column": 64 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::SubClassWithExplicitTotals", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 9, + "column": 2, + "end_column": 21 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "n", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 9, + "column": 11, + "end_column": 20 + } + } + ], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 12, + "column": 22, + "end_column": 3 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 10, + "end_line": 10, + "column": 4, + "end_column": 28 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 10, + "end_line": 10, + "column": 19, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBrY;R&=Yy", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + }, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 10, + "end_line": 10, + "column": 27, + "end_column": 28 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 11, + "end_line": 11, + "column": 4, + "end_column": 28 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 11, + "end_line": 11, + "column": 19, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "ba!t@Y;R&=Yy", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + }, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 11, + "end_line": 11, + "column": 27, + "end_column": 28 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::BaseWithState", + "member_name": "setState", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 9, + "end_line": 9, + "column": 2, + "end_column": 21 + }, + "name": "setState", + "is_bare": false, + "create": 3, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 45 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 54 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBrY;R&=Yy", + "encoding": "utf8" + }, + "exists_assertion_message": null + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 49, + "end_column": 50 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::BaseWithState", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 27, + "end_line": 28, + "column": 0, + "end_column": 70 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 27, + "end_line": 28, + "column": 0, + "end_column": 70 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": "Implicitly generated create method", + "args": {}, + "returns": null + }, + "cref": "tests/approvals/state-totals.algo.ts::ExtendsSubWithTotals", + "member_name": "__algots__.defaultCreate", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 27, + "end_line": 28, + "column": 0, + "end_column": 70 + }, + "allowed_completion_types": [ + 0 + ], + "create": 2, + "is_bare": true + } + } + ], + "app_state": [ + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "member_name": "oneGlobal", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBrY;R&=Yy", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 11 + }, + "member_name": "twoGlobal", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "ba!t@Y;R&=Yy", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 7, + "end_line": 7, + "column": 2, + "end_column": 15 + }, + "member_name": "oneLocalBytes", + "kind": 2, + "storage_wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 7, + "end_line": 7, + "column": 2, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBwZ)0I>LV0v$a{", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 29, + "end_line": 29, + "column": 2, + "end_column": 10 + }, + "member_name": "oneLocal", + "kind": 2, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/state-totals.algo.ts", + "line": 29, + "end_line": 29, + "column": 2, + "end_column": 10 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Z*FBwZ)0I>", + "encoding": "utf8" + }, + "description": null + } + ], + "state_totals": { + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null + }, + "reserved_scratch_space": [], + "avm_version": null + } +] \ No newline at end of file diff --git a/tests/approvals/state-totals.algo.ts b/tests/approvals/state-totals.algo.ts new file mode 100644 index 00000000..c4a5732c --- /dev/null +++ b/tests/approvals/state-totals.algo.ts @@ -0,0 +1,37 @@ +import type { bytes, uint64 } from '@algorandfoundation/algorand-typescript' +import { abimethod, contract, Contract, GlobalState, LocalState, Txn, Uint64 } from '@algorandfoundation/algorand-typescript' + +export class BaseWithState extends Contract { + oneGlobal = GlobalState({ initialValue: Uint64(1) }) + twoGlobal = GlobalState() + oneLocalBytes = LocalState() + + setState(n: uint64) { + this.oneGlobal.value = n + this.twoGlobal.value = n + } +} + +export class SubClassWithState extends BaseWithState { + threeGlobal = GlobalState() + twoLocalBytes = LocalState() + setState(n: uint64) { + super.setState(n) + this.threeGlobal.value = n + } +} + +@contract({ stateTotals: { globalUints: 4, localUints: 0 } }) +export class SubClassWithExplicitTotals extends BaseWithState {} + +@contract({ stateTotals: {} }) +export class ExtendsSubWithTotals extends SubClassWithExplicitTotals { + oneLocal = LocalState() + + @abimethod({ allowActions: 'OptIn' }) + setState(n: uint64) { + super.setState(n) + + this.oneLocal(Txn.sender).value = n + } +} diff --git a/tests/onchain/state-totals.spec.ts b/tests/onchain/state-totals.spec.ts new file mode 100644 index 00000000..137c03f8 --- /dev/null +++ b/tests/onchain/state-totals.spec.ts @@ -0,0 +1,57 @@ +import { OnApplicationComplete } from 'algosdk' +import { describe, expect } from 'vitest' +import { createArc4TestFixture } from './util/test-fixture' + +describe('State totals', () => { + const test = createArc4TestFixture('tests/approvals/state-totals.algo.ts', { + ExtendsSubWithTotals: {}, + BaseWithState: {}, + SubClassWithState: {}, + SubClassWithExplicitTotals: {}, + }) + + test('BaseWithState has correct totals', ({ appSpecBaseWithState }) => { + expect(appSpecBaseWithState.state.global.num_uints).toBe(2) + expect(appSpecBaseWithState.state.local.num_byte_slices).toBe(1) + }) + test('BaseWithState runs', async ({ appClientBaseWithState }) => { + await appClientBaseWithState.send.call({ method: 'setState', args: [123] }) + + const state = await appClientBaseWithState.getGlobalState() + expect(state['oneGlobal'].value).toBe(123n) + expect(state['twoGlobal'].value).toBe(123n) + }) + test('SubClassWithState has correct totals', ({ appSpecSubClassWithState }) => { + expect(appSpecSubClassWithState.state.global.num_uints).toBe(3) + expect(appSpecSubClassWithState.state.local.num_byte_slices).toBe(2) + }) + test('SubClassWithState runs', async ({ appClientSubClassWithState }) => { + await appClientSubClassWithState.send.call({ method: 'setState', args: [456] }) + + const state = await appClientSubClassWithState.getGlobalState() + expect(state['oneGlobal'].value).toBe(456n) + expect(state['twoGlobal'].value).toBe(456n) + expect(state['threeGlobal'].value).toBe(456n) + }) + test('SubClassWithExplicitTotals has correct totals', ({ appSpecSubClassWithExplicitTotals }) => { + expect(appSpecSubClassWithExplicitTotals.state.global.num_uints).toBe(4) + expect(appSpecSubClassWithExplicitTotals.state.global.num_byte_slices).toBe(0) + expect(appSpecSubClassWithExplicitTotals.state.local.num_uints).toBe(0) + expect(appSpecSubClassWithExplicitTotals.state.local.num_byte_slices).toBe(1) + }) + test('ExtendsSubWithTotals has correct totals', ({ appSpecExtendsSubWithTotals }) => { + expect(appSpecExtendsSubWithTotals.state.global.num_uints).toBe(2) + expect(appSpecExtendsSubWithTotals.state.local.num_uints).toBe(1) + expect(appSpecExtendsSubWithTotals.state.local.num_byte_slices).toBe(1) + }) + test('ExtendsSubWithTotals runs', async ({ appClientExtendsSubWithTotals, testAccount }) => { + await appClientExtendsSubWithTotals.send.call({ method: 'setState', args: [789], onComplete: OnApplicationComplete.OptInOC }) + + const state = await appClientExtendsSubWithTotals.getGlobalState() + expect(state['oneGlobal'].value).toBe(789n) + expect(state['twoGlobal'].value).toBe(789n) + const localState = await appClientExtendsSubWithTotals.getLocalState(testAccount) + + expect(localState['oneLocal'].value).toBe(789n) + }) +}) diff --git a/tests/onchain/util/test-fixture.ts b/tests/onchain/util/test-fixture.ts index a9a46a2c..1d6a631f 100644 --- a/tests/onchain/util/test-fixture.ts +++ b/tests/onchain/util/test-fixture.ts @@ -123,6 +123,8 @@ type Arc4FixtureContextFor = { [key in T as `appFactory${key}`]: AppFactory } & { [key in T as `appClient${key}`]: AppClient +} & { + [key in T as `appSpec${key}`]: AppSpec } type ContractConfig = { @@ -139,16 +141,26 @@ export function createArc4TestFixture(path: stri logger: nullLogger, }) + function getAppSpec(expect: ExpectStatic, contractName: string) { + const appSpec = lazyCompile.getCompileResult(expect).appSpecs.find((s) => s.contract.name === contractName) + if (appSpec === undefined) { + expect.fail(`${path} does not contain an ARC4 contract "${contractName}"`) + } else { + return appSpec + } + } + const ctx: DeliberateAny = {} for (const [contractName, config] of Object.entries(contracts) as Array<[TContracts, ContractConfig]>) { + ctx[`appSpec${contractName}`] = async ({ expect }: { expect: ExpectStatic }, use: Use) => { + await use(getAppSpec(expect, contractName)) + } + ctx[`appFactory${contractName}`] = async ( { expect, localnet }: { expect: ExpectStatic; localnet: AlgorandFixture }, use: Use, ) => { - const appSpec = lazyCompile.getCompileResult(expect).appSpecs.find((s) => s.contract.name === contractName) - if (appSpec === undefined) { - expect.fail(`${path} does not contain an ARC4 contract "${contractName}"`) - } + const appSpec = getAppSpec(expect, contractName) await use( localnet.algorand.client.getAppFactory({ defaultSender: localnet.context.testAccount.addr, @@ -160,10 +172,7 @@ export function createArc4TestFixture(path: stri { expect, localnet }: { expect: ExpectStatic; localnet: AlgorandFixture }, use: Use, ) => { - const appSpec = lazyCompile.getCompileResult(expect).appSpecs.find((s) => s.contract.name === contractName) - if (appSpec === undefined) { - expect.fail(`${path} does not contain an ARC4 contract "${contractName}"`) - } + const appSpec = getAppSpec(expect, contractName) const appFactory = localnet.algorand.client.getAppFactory({ defaultSender: localnet.context.testAccount.addr, appSpec: appSpec!, From 59e176ef38b5a31bffa2656d0d7230b70861fa99 Mon Sep 17 00:00:00 2001 From: Tristan Menzel Date: Fri, 6 Dec 2024 15:03:53 -0800 Subject: [PATCH 7/7] feat: Reserved scratch space --- package.json | 2 +- src/awst/to-code-visitor.ts | 3 +- src/awst_build/eb/contract-builder.ts | 45 +- .../eb/literal-expression-builder.ts | 2 +- src/awst_build/models/contract-class-model.ts | 19 +- src/awst_build/models/decorator-data.ts | 3 +- src/util/intersect-sets.ts | 3 + .../ReserveScratchAlgo.approval.teal | 70 + .../ReserveScratchAlgo.clear.teal | 5 + .../reserve-scratch/ReserveScratchAlgo.ssa.ir | 37 + .../SubReserveScratchAlgo.approval.teal | 105 + .../SubReserveScratchAlgo.clear.teal | 5 + .../SubReserveScratchAlgo.ssa.ir | 49 + .../out/reserve-scratch/reserve-scratch.awst | 87 + .../reserve-scratch/reserve-scratch.awst.json | 2364 +++++++++++++++++ tests/approvals/reserve-scratch.algo.ts | 30 + 16 files changed, 2808 insertions(+), 21 deletions(-) create mode 100644 src/util/intersect-sets.ts create mode 100644 tests/approvals/out/reserve-scratch/ReserveScratchAlgo.approval.teal create mode 100644 tests/approvals/out/reserve-scratch/ReserveScratchAlgo.clear.teal create mode 100644 tests/approvals/out/reserve-scratch/ReserveScratchAlgo.ssa.ir create mode 100644 tests/approvals/out/reserve-scratch/SubReserveScratchAlgo.approval.teal create mode 100644 tests/approvals/out/reserve-scratch/SubReserveScratchAlgo.clear.teal create mode 100644 tests/approvals/out/reserve-scratch/SubReserveScratchAlgo.ssa.ir create mode 100644 tests/approvals/out/reserve-scratch/reserve-scratch.awst create mode 100644 tests/approvals/out/reserve-scratch/reserve-scratch.awst.json create mode 100644 tests/approvals/reserve-scratch.algo.ts diff --git a/package.json b/package.json index c6659fe0..ae4302a3 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "dev:examples": "tsx src/cli.ts build examples --output-awst --output-awst-json", "dev:approvals": "rimraf tests/approvals/out && tsx src/cli.ts build tests/approvals --dry-run", "dev:expected-output": "tsx src/cli.ts build tests/expected-output --dry-run", - "dev:testing": "tsx src/cli.ts build tests/approvals/state-totals.algo.ts --output-awst --output-awst-json --output-ssa-ir --log-level=info --out-dir out/[name] --optimization-level=0", + "dev:testing": "tsx src/cli.ts build tests/approvals/reserve-scratch.algo.ts --output-awst --output-awst-json --output-ssa-ir --log-level=info --out-dir out/[name] --optimization-level=0", "audit": "better-npm-audit audit", "format": "prettier --write .", "lint": "eslint \"src/**/*.ts\"", diff --git a/src/awst/to-code-visitor.ts b/src/awst/to-code-visitor.ts index c882e557..2c687d86 100644 --- a/src/awst/to-code-visitor.ts +++ b/src/awst/to-code-visitor.ts @@ -1,6 +1,5 @@ import { Buffer } from 'node:buffer' import { TodoError } from '../errors' -import { logger } from '../logger' import { uint8ArrayToBase32, uint8ArrayToUtf8 } from '../util' import type { ContractReference } from './models' import type { @@ -408,7 +407,7 @@ export class ToCodeVisitor } } if (c.reservedScratchSpace.size) { - logger.warn(c.sourceLocation, 'Handle reservedScratchSpace to-code') + body.push(`reservedScratchSpace: [${Array.from(c.reservedScratchSpace).join(', ')}]`) } if (c.approvalProgram) { body.push(...this.visitSpecialMethod(c.approvalProgram, 'approvalProgram')) diff --git a/src/awst_build/eb/contract-builder.ts b/src/awst_build/eb/contract-builder.ts index 953acff1..acecc7df 100644 --- a/src/awst_build/eb/contract-builder.ts +++ b/src/awst_build/eb/contract-builder.ts @@ -24,7 +24,9 @@ import { instanceEb } from '../type-registry' import { BaseContractMethodExpressionBuilder, ContractMethodExpressionBuilder } from './free-subroutine-expression-builder' import type { NodeBuilder } from './index' import { DecoratorDataBuilder, FunctionBuilder, InstanceBuilder } from './index' -import { requireIntegerConstant, requireStringConstant } from './util' +import { ArrayLiteralExpressionBuilder } from './literal/array-literal-expression-builder' +import { BigIntLiteralExpressionBuilder } from './literal/big-int-literal-expression-builder' +import { requireStringConstant } from './util' import { parseFunctionArgs } from './util/arg-parsing' import { requireAvmVersion } from './util/avm-version' import { VoidExpressionBuilder } from './void-expression-builder' @@ -127,7 +129,7 @@ export class ContractOptionsDecoratorBuilder extends FunctionBuilder { readonly ptype = contractOptionsDecorator call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { - args: [{ avmVersion, name, stateTotals }], + args: [{ avmVersion, name, stateTotals, scratchSlots }], } = parseFunctionArgs({ args, typeArgs, @@ -149,15 +151,52 @@ export class ContractOptionsDecoratorBuilder extends FunctionBuilder { avmVersion: avmVersion && requireAvmVersion(avmVersion), name: name && requireStringConstant(name).value, stateTotals: stateTotals && buildStateTotals(stateTotals), + scratchSlots: scratchSlots && processScratchRanges(scratchSlots), sourceLocation, }) } } +function getRangeProp(builder: NodeBuilder, name: string): bigint { + if (builder.hasProperty(name)) { + return getLiteralNumber(builder.memberAccess(name, builder.sourceLocation)) + } + throw new CodeError('Scratch slot reservations should be either a single slot or an object containing a from and to property', { + sourceLocation: builder.sourceLocation, + }) +} + +function getLiteralNumber(builder: NodeBuilder) { + codeInvariant(builder instanceof BigIntLiteralExpressionBuilder, 'Expected numeric literal', builder.sourceLocation) + return builder.value +} + +function processScratchRanges(builder: NodeBuilder): Set { + codeInvariant( + builder instanceof ArrayLiteralExpressionBuilder, + 'Scratch ranges should be specified in an array literal', + builder.sourceLocation, + ) + const slots = new Set() + for (const item of builder.getItemBuilders()) { + if (item.resolvableToPType(numberPType)) { + slots.add(getLiteralNumber(item)) + } else { + const from = getRangeProp(item, 'from') + const to = getRangeProp(item, 'to') + for (let i = from; i <= to; i++) { + slots.add(i) + } + } + } + + return slots +} + function buildStateTotals(builder: NodeBuilder): ContractOptionsDecoratorData['stateTotals'] { function tryGetProp(name: string): bigint | undefined { if (builder.hasProperty(name)) { - return requireIntegerConstant(builder.memberAccess(name, builder.sourceLocation)).value + return getLiteralNumber(builder.memberAccess(name, builder.sourceLocation)) } return undefined } diff --git a/src/awst_build/eb/literal-expression-builder.ts b/src/awst_build/eb/literal-expression-builder.ts index 3df240c8..13cfb05d 100644 --- a/src/awst_build/eb/literal-expression-builder.ts +++ b/src/awst_build/eb/literal-expression-builder.ts @@ -74,6 +74,6 @@ export abstract class LiteralExpressionBuilder extends InstanceBuilder { } hasProperty(_name: string): boolean { - this.throwInvalidExpression() + return false } } diff --git a/src/awst_build/models/contract-class-model.ts b/src/awst_build/models/contract-class-model.ts index 6da47461..a60dfa32 100644 --- a/src/awst_build/models/contract-class-model.ts +++ b/src/awst_build/models/contract-class-model.ts @@ -11,6 +11,7 @@ import { logger } from '../../logger' import type { Props } from '../../typescript-helpers' import { codeInvariant, invariant, isIn } from '../../util' import { CustomKeyMap } from '../../util/custom-key-map' +import { intersectSets } from '../../util/intersect-sets' import type { ContractClassPType } from '../ptypes' import type { ContractOptionsDecoratorData } from './decorator-data' import { LogicSigClassModel } from './logic-sig-class-model' @@ -58,14 +59,18 @@ export class ContractClassModel { let clearProgram: ContractMethod | null = this.clearProgram const methods: ContractMethod[] = [...this.methods, this.ctor] const methodResolutionOrder: ContractReference[] = [] - let firstBaseWithStateTotals: ContractClassModel | undefined = undefined + let reservedScratchSpace = new Set() + for (const baseType of this.type.allBases()) { const cref = ContractReference.fromPType(baseType) const baseClass = compilationSet.getContractClass(cref) if (baseClass.hasExplicitStateTotals() && firstBaseWithStateTotals === undefined) { firstBaseWithStateTotals = baseClass } + if (baseClass.options?.scratchSlots) { + reservedScratchSpace = intersectSets(reservedScratchSpace, baseClass.options.scratchSlots) + } methodResolutionOrder.push(cref) approvalProgram ??= baseClass.approvalProgram clearProgram ??= baseClass.clearProgram @@ -114,18 +119,8 @@ export class ContractClassModel { localUints: this.options?.stateTotals?.localUints ?? null, }) - // TODO: Tally from bases - const reservedScratchSpace = new Set() if (this.options?.scratchSlots) { - for (const reservation of this.options.scratchSlots) { - if (typeof reservation === 'bigint') { - reservedScratchSpace.add(reservation) - } else { - for (let i = reservation.from; i <= reservation.to; i++) { - reservedScratchSpace.add(i) - } - } - } + reservedScratchSpace = intersectSets(reservedScratchSpace, this.options.scratchSlots) } return nodeFactory.contract({ diff --git a/src/awst_build/models/decorator-data.ts b/src/awst_build/models/decorator-data.ts index e796794c..0f4309bb 100644 --- a/src/awst_build/models/decorator-data.ts +++ b/src/awst_build/models/decorator-data.ts @@ -35,13 +35,12 @@ export type LogicSigOptionsDecoratorData = { avmVersion?: SupportedAvmVersion name?: string } -type NumberRange = { from: bigint; to: bigint } export type ContractOptionsDecoratorData = { type: typeof Constants.contractOptionsDecoratorName sourceLocation: SourceLocation avmVersion?: SupportedAvmVersion name?: string - scratchSlots?: Array + scratchSlots?: Set stateTotals?: { globalUints?: bigint globalBytes?: bigint diff --git a/src/util/intersect-sets.ts b/src/util/intersect-sets.ts new file mode 100644 index 00000000..fae364e0 --- /dev/null +++ b/src/util/intersect-sets.ts @@ -0,0 +1,3 @@ +export function intersectSets(...sets: Set[]): Set { + return new Set(sets.flatMap((s) => [...s])) +} diff --git a/tests/approvals/out/reserve-scratch/ReserveScratchAlgo.approval.teal b/tests/approvals/out/reserve-scratch/ReserveScratchAlgo.approval.teal new file mode 100644 index 00000000..98ed9f36 --- /dev/null +++ b/tests/approvals/out/reserve-scratch/ReserveScratchAlgo.approval.teal @@ -0,0 +1,70 @@ +#pragma version 10 + +tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.approvalProgram: + intcblock 1 0 15 45 + bytecblock "hello" + txn ApplicationID + bnz main_after_if_else@2 + callsub constructor + +main_after_if_else@2: + // tests/approvals/reserve-scratch.algo.ts:13 + // this.setThings() + callsub setThings + // tests/approvals/reserve-scratch.algo.ts:15 + // assert(Scratch.loadUint64(0) === 1) + intc_1 // 0 + loads + intc_0 // 1 + == + assert + // tests/approvals/reserve-scratch.algo.ts:16 + // assert(Scratch.loadBytes(0) === Bytes('hello')) + intc_1 // 0 + loads + bytec_0 // "hello" + == + assert + // tests/approvals/reserve-scratch.algo.ts:17 + // assert(Scratch.loadUint64(15) === 45) + intc_2 // 15 + loads + intc_3 // 45 + == + assert + // tests/approvals/reserve-scratch.algo.ts:18 + // return true + intc_0 // 1 + return + + +// tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.constructor() -> void: +constructor: + // tests/approvals/reserve-scratch.algo.ts:4-5 + // @contract({ scratchSlots: [0, 1, { from: 10, to: 20 }] }) + // export class ReserveScratchAlgo extends BaseContract { + proto 0 0 + retsub + + +// tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.setThings() -> void: +setThings: + // tests/approvals/reserve-scratch.algo.ts:6 + // setThings() { + proto 0 0 + // tests/approvals/reserve-scratch.algo.ts:7 + // Scratch.store(0, 1) + intc_1 // 0 + intc_0 // 1 + stores + // tests/approvals/reserve-scratch.algo.ts:8 + // Scratch.store(1, Bytes('hello')) + intc_0 // 1 + bytec_0 // "hello" + stores + // tests/approvals/reserve-scratch.algo.ts:9 + // Scratch.store(15, 45) + intc_2 // 15 + intc_3 // 45 + stores + retsub diff --git a/tests/approvals/out/reserve-scratch/ReserveScratchAlgo.clear.teal b/tests/approvals/out/reserve-scratch/ReserveScratchAlgo.clear.teal new file mode 100644 index 00000000..a73a2abc --- /dev/null +++ b/tests/approvals/out/reserve-scratch/ReserveScratchAlgo.clear.teal @@ -0,0 +1,5 @@ +#pragma version 10 + +tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.clearStateProgram: + pushint 1 // 1 + return diff --git a/tests/approvals/out/reserve-scratch/ReserveScratchAlgo.ssa.ir b/tests/approvals/out/reserve-scratch/ReserveScratchAlgo.ssa.ir new file mode 100644 index 00000000..775720ce --- /dev/null +++ b/tests/approvals/out/reserve-scratch/ReserveScratchAlgo.ssa.ir @@ -0,0 +1,37 @@ +contract tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo: + program approval: + subroutine tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.approvalProgram() -> bool: + block@0: // L12 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.constructor() + goto block@2 + block@2: // after_if_else_L1 + tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.setThings() + let tmp%0#0: uint64 = (loads 0u) + let tmp%1#0: bool = (== tmp%0#0 1u) + (assert tmp%1#0) + let tmp%2#0: bytes = (loads 0u) + let tmp%3#0: bool = (== tmp%2#0 "hello") + (assert tmp%3#0) + let tmp%4#0: uint64 = (loads 15u) + let tmp%5#0: bool = (== tmp%4#0 45u) + (assert tmp%5#0) + return 1u + + subroutine tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.constructor() -> void: + block@0: // L4 + return + + subroutine tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.setThings() -> void: + block@0: // L6 + (stores 0u 1u) + (stores 1u "hello") + (stores 15u 45u) + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/reserve-scratch/SubReserveScratchAlgo.approval.teal b/tests/approvals/out/reserve-scratch/SubReserveScratchAlgo.approval.teal new file mode 100644 index 00000000..6ee7cb73 --- /dev/null +++ b/tests/approvals/out/reserve-scratch/SubReserveScratchAlgo.approval.teal @@ -0,0 +1,105 @@ +#pragma version 10 + +tests/approvals/reserve-scratch.algo.ts::SubReserveScratchAlgo.approvalProgram: + intcblock 1 0 15 45 + bytecblock "world" "hello" + txn ApplicationID + bnz main_after_if_else@2 + callsub constructor + +main_after_if_else@2: + // tests/approvals/reserve-scratch.algo.ts:25 + // super.approvalProgram() + callsub approvalProgram + pop + // tests/approvals/reserve-scratch.algo.ts:26 + // Scratch.store(50, Bytes('world')) + pushint 50 // 50 + bytec_0 // "world" + stores + // tests/approvals/reserve-scratch.algo.ts:27 + // Scratch.store(16, Bytes('world')) + pushint 16 // 16 + bytec_0 // "world" + stores + // tests/approvals/reserve-scratch.algo.ts:28 + // return true + intc_0 // 1 + return + + +// tests/approvals/reserve-scratch.algo.ts::SubReserveScratchAlgo.constructor() -> void: +constructor: + // tests/approvals/reserve-scratch.algo.ts:22-23 + // @contract({ scratchSlots: [50] }) + // export class SubReserveScratchAlgo extends ReserveScratchAlgo { + proto 0 0 + callsub tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.constructor + retsub + + +// tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.constructor() -> void: +tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.constructor: + // tests/approvals/reserve-scratch.algo.ts:4-5 + // @contract({ scratchSlots: [0, 1, { from: 10, to: 20 }] }) + // export class ReserveScratchAlgo extends BaseContract { + proto 0 0 + retsub + + +// tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.approvalProgram() -> uint64: +approvalProgram: + // tests/approvals/reserve-scratch.algo.ts:12 + // approvalProgram(): boolean { + proto 0 1 + // tests/approvals/reserve-scratch.algo.ts:13 + // this.setThings() + callsub setThings + // tests/approvals/reserve-scratch.algo.ts:15 + // assert(Scratch.loadUint64(0) === 1) + intc_1 // 0 + loads + intc_0 // 1 + == + assert + // tests/approvals/reserve-scratch.algo.ts:16 + // assert(Scratch.loadBytes(0) === Bytes('hello')) + intc_1 // 0 + loads + bytec_1 // "hello" + == + assert + // tests/approvals/reserve-scratch.algo.ts:17 + // assert(Scratch.loadUint64(15) === 45) + intc_2 // 15 + loads + intc_3 // 45 + == + assert + // tests/approvals/reserve-scratch.algo.ts:18 + // return true + intc_0 // 1 + retsub + + +// tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.setThings() -> void: +setThings: + // tests/approvals/reserve-scratch.algo.ts:6 + // setThings() { + proto 0 0 + // tests/approvals/reserve-scratch.algo.ts:7 + // Scratch.store(0, 1) + intc_1 // 0 + intc_0 // 1 + stores + // tests/approvals/reserve-scratch.algo.ts:8 + // Scratch.store(1, Bytes('hello')) + intc_0 // 1 + bytec_1 // "hello" + stores + // tests/approvals/reserve-scratch.algo.ts:9 + // Scratch.store(15, 45) + intc_2 // 15 + intc_3 // 45 + stores + retsub diff --git a/tests/approvals/out/reserve-scratch/SubReserveScratchAlgo.clear.teal b/tests/approvals/out/reserve-scratch/SubReserveScratchAlgo.clear.teal new file mode 100644 index 00000000..e5a0b635 --- /dev/null +++ b/tests/approvals/out/reserve-scratch/SubReserveScratchAlgo.clear.teal @@ -0,0 +1,5 @@ +#pragma version 10 + +tests/approvals/reserve-scratch.algo.ts::SubReserveScratchAlgo.clearStateProgram: + pushint 1 // 1 + return diff --git a/tests/approvals/out/reserve-scratch/SubReserveScratchAlgo.ssa.ir b/tests/approvals/out/reserve-scratch/SubReserveScratchAlgo.ssa.ir new file mode 100644 index 00000000..9d4420f3 --- /dev/null +++ b/tests/approvals/out/reserve-scratch/SubReserveScratchAlgo.ssa.ir @@ -0,0 +1,49 @@ +contract tests/approvals/reserve-scratch.algo.ts::SubReserveScratchAlgo: + program approval: + subroutine tests/approvals/reserve-scratch.algo.ts::SubReserveScratchAlgo.approvalProgram() -> bool: + block@0: // L24 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/reserve-scratch.algo.ts::SubReserveScratchAlgo.constructor() + goto block@2 + block@2: // after_if_else_L1 + tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.approvalProgram() + (stores 50u "world") + (stores 16u "world") + return 1u + + subroutine tests/approvals/reserve-scratch.algo.ts::SubReserveScratchAlgo.constructor() -> void: + block@0: // L22 + tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.constructor() + return + + subroutine tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.constructor() -> void: + block@0: // L4 + return + + subroutine tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.approvalProgram() -> bool: + block@0: // L12 + tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.setThings() + let tmp%0#0: uint64 = (loads 0u) + let tmp%1#0: bool = (== tmp%0#0 1u) + (assert tmp%1#0) + let tmp%2#0: bytes = (loads 0u) + let tmp%3#0: bool = (== tmp%2#0 "hello") + (assert tmp%3#0) + let tmp%4#0: uint64 = (loads 15u) + let tmp%5#0: bool = (== tmp%4#0 45u) + (assert tmp%5#0) + return 1u + + subroutine tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo.setThings() -> void: + block@0: // L6 + (stores 0u 1u) + (stores 1u "hello") + (stores 15u 45u) + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/reserve-scratch/reserve-scratch.awst b/tests/approvals/out/reserve-scratch/reserve-scratch.awst new file mode 100644 index 00000000..8c51e675 --- /dev/null +++ b/tests/approvals/out/reserve-scratch/reserve-scratch.awst @@ -0,0 +1,87 @@ +contract ReserveScratchAlgo +{ + reservedScratchSpace: [0, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + this.setThings() + assert(loads(0) == 1) + assert(loads(0) == "hello") + assert(loads(15) == 45) + return True + } + + clearProgram(): bool + { + return True + } + + setThings(): void + { + stores(0, 1) + stores(1, "hello") + stores(15, 45) + } + + constructor(): void + { + void + } + + BaseContract::constructor(): void + { + } + +} +contract SubReserveScratchAlgo +{ + reservedScratchSpace: [0, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 50] + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + super.approvalProgram() + stores(50, "world") + stores(16, "world") + return True + } + + clearProgram(): bool + { + return True + } + + constructor(): void + { + super.constructor() + } + + ReserveScratchAlgo::approvalProgram(): bool + { + this.setThings() + assert(loads(0) == 1) + assert(loads(0) == "hello") + assert(loads(15) == 45) + return True + } + + ReserveScratchAlgo::setThings(): void + { + stores(0, 1) + stores(1, "hello") + stores(15, 45) + } + + ReserveScratchAlgo::constructor(): void + { + void + } + + BaseContract::constructor(): void + { + } + +} \ No newline at end of file diff --git a/tests/approvals/out/reserve-scratch/reserve-scratch.awst.json b/tests/approvals/out/reserve-scratch/reserve-scratch.awst.json new file mode 100644 index 00000000..d7c72f07 --- /dev/null +++ b/tests/approvals/out/reserve-scratch/reserve-scratch.awst.json @@ -0,0 +1,2364 @@ +[ + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 4, + "end_line": 5, + "column": 0, + "end_column": 54 + }, + "id": "tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo", + "name": "ReserveScratchAlgo", + "description": null, + "method_resolution_order": [ + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 12, + "end_line": 12, + "column": 2, + "end_column": 28 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [] + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 12, + "end_line": 19, + "column": 29, + "end_column": 3 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 13, + "end_line": 13, + "column": 4, + "end_column": 20 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 13, + "end_line": 13, + "column": 4, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "setThings" + }, + "args": [] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 15, + "end_line": 15, + "column": 4, + "end_column": 39 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 15, + "end_line": 15, + "column": 4, + "end_column": 39 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "NumericComparisonExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 15, + "end_line": 15, + "column": 11, + "end_column": 38 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 15, + "end_line": 15, + "column": 11, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "loads", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + }, + "operator": "==", + "rhs": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 15, + "end_line": 15, + "column": 37, + "end_column": 38 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + }, + "error_message": null + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 16, + "end_line": 16, + "column": 4, + "end_column": 51 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 16, + "end_line": 16, + "column": 4, + "end_column": 51 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "BytesComparisonExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 16, + "end_line": 16, + "column": 11, + "end_column": 50 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 16, + "end_line": 16, + "column": 11, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "loads", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 16, + "end_line": 16, + "column": 29, + "end_column": 30 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + }, + "operator": "==", + "rhs": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 16, + "end_line": 16, + "column": 42, + "end_column": 49 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Xk~0{Zv", + "encoding": "utf8" + } + }, + "error_message": null + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 17, + "end_line": 17, + "column": 4, + "end_column": 41 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 17, + "end_line": 17, + "column": 4, + "end_column": 41 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "NumericComparisonExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 17, + "end_line": 17, + "column": 11, + "end_column": 40 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 17, + "end_line": 17, + "column": 11, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "loads", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 17, + "end_line": 17, + "column": 30, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "15", + "teal_alias": null + } + ] + }, + "operator": "==", + "rhs": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 17, + "end_line": 17, + "column": 38, + "end_column": 40 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "45", + "teal_alias": null + } + }, + "error_message": null + } + }, + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 18, + "end_line": 18, + "column": 4, + "end_column": 15 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 18, + "end_line": 18, + "column": 11, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 13 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 6, + "end_line": 10, + "column": 14, + "end_column": 3 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 7, + "end_line": 7, + "column": 4, + "end_column": 23 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 7, + "end_line": 7, + "column": 4, + "end_column": 23 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "stores", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 7, + "end_line": 7, + "column": 18, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 7, + "end_line": 7, + "column": 21, + "end_column": 22 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 8, + "end_line": 8, + "column": 4, + "end_column": 36 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 8, + "end_line": 8, + "column": 4, + "end_column": 36 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "stores", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 8, + "end_line": 8, + "column": 18, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + }, + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 8, + "end_line": 8, + "column": 27, + "end_column": 34 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Xk~0{Zv", + "encoding": "utf8" + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 9, + "end_line": 9, + "column": 4, + "end_column": 25 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 9, + "end_line": 9, + "column": 4, + "end_column": 25 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "stores", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 9, + "end_line": 9, + "column": 18, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "15", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 9, + "end_line": 9, + "column": 22, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "45", + "teal_alias": null + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo", + "member_name": "setThings", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 4, + "end_line": 5, + "column": 0, + "end_column": 54 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 4, + "end_line": 5, + "column": 0, + "end_column": 54 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 4, + "end_line": 5, + "column": 0, + "end_column": 54 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 4, + "end_line": 5, + "column": 0, + "end_column": 54 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [], + "state_totals": { + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null + }, + "reserved_scratch_space": [ + "0", + "1", + "10", + "11", + "12", + "13", + "14", + "15", + "16", + "17", + "18", + "19", + "20" + ], + "avm_version": null + }, + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 22, + "end_line": 23, + "column": 0, + "end_column": 63 + }, + "id": "tests/approvals/reserve-scratch.algo.ts::SubReserveScratchAlgo", + "name": "SubReserveScratchAlgo", + "description": null, + "method_resolution_order": [ + "tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 24, + "end_line": 24, + "column": 2, + "end_column": 28 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [] + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 24, + "end_line": 29, + "column": 29, + "end_column": 3 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 25, + "end_line": 25, + "column": 4, + "end_column": 27 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 25, + "end_line": 25, + "column": 4, + "end_column": 27 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "approvalProgram" + }, + "args": [] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 26, + "end_line": 26, + "column": 4, + "end_column": 37 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 26, + "end_line": 26, + "column": 4, + "end_column": 37 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "stores", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 26, + "end_line": 26, + "column": 18, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "50", + "teal_alias": null + }, + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 26, + "end_line": 26, + "column": 28, + "end_column": 35 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "cW-iRWB", + "encoding": "utf8" + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 27, + "end_line": 27, + "column": 4, + "end_column": 37 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 27, + "end_line": 27, + "column": 4, + "end_column": 37 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "stores", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 27, + "end_line": 27, + "column": 18, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "16", + "teal_alias": null + }, + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 27, + "end_line": 27, + "column": 28, + "end_column": 35 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "cW-iRWB", + "encoding": "utf8" + } + ] + } + }, + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 28, + "end_line": 28, + "column": 4, + "end_column": 15 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 28, + "end_line": 28, + "column": 11, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/reserve-scratch.algo.ts::SubReserveScratchAlgo", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 22, + "end_line": 23, + "column": 0, + "end_column": 63 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 22, + "end_line": 23, + "column": 0, + "end_column": 63 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 22, + "end_line": 23, + "column": 0, + "end_column": 63 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 22, + "end_line": 23, + "column": 0, + "end_column": 63 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/reserve-scratch.algo.ts::SubReserveScratchAlgo", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 12, + "end_line": 12, + "column": 2, + "end_column": 28 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 12, + "end_line": 19, + "column": 29, + "end_column": 3 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 13, + "end_line": 13, + "column": 4, + "end_column": 20 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 13, + "end_line": 13, + "column": 4, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "setThings" + }, + "args": [] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 15, + "end_line": 15, + "column": 4, + "end_column": 39 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 15, + "end_line": 15, + "column": 4, + "end_column": 39 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "NumericComparisonExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 15, + "end_line": 15, + "column": 11, + "end_column": 38 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 15, + "end_line": 15, + "column": 11, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "loads", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + }, + "operator": "==", + "rhs": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 15, + "end_line": 15, + "column": 37, + "end_column": 38 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + }, + "error_message": null + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 16, + "end_line": 16, + "column": 4, + "end_column": 51 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 16, + "end_line": 16, + "column": 4, + "end_column": 51 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "BytesComparisonExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 16, + "end_line": 16, + "column": 11, + "end_column": 50 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 16, + "end_line": 16, + "column": 11, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "loads", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 16, + "end_line": 16, + "column": 29, + "end_column": 30 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ] + }, + "operator": "==", + "rhs": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 16, + "end_line": 16, + "column": 42, + "end_column": 49 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Xk~0{Zv", + "encoding": "utf8" + } + }, + "error_message": null + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 17, + "end_line": 17, + "column": 4, + "end_column": 41 + }, + "expr": { + "_type": "AssertExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 17, + "end_line": 17, + "column": 4, + "end_column": 41 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "condition": { + "_type": "NumericComparisonExpression", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 17, + "end_line": 17, + "column": 11, + "end_column": 40 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 17, + "end_line": 17, + "column": 11, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "loads", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 17, + "end_line": 17, + "column": 30, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "15", + "teal_alias": null + } + ] + }, + "operator": "==", + "rhs": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 17, + "end_line": 17, + "column": 38, + "end_column": 40 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "45", + "teal_alias": null + } + }, + "error_message": null + } + }, + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 18, + "end_line": 18, + "column": 4, + "end_column": 15 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 18, + "end_line": 18, + "column": 11, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 13 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 6, + "end_line": 10, + "column": 14, + "end_column": 3 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 7, + "end_line": 7, + "column": 4, + "end_column": 23 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 7, + "end_line": 7, + "column": 4, + "end_column": 23 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "stores", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 7, + "end_line": 7, + "column": 18, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 7, + "end_line": 7, + "column": 21, + "end_column": 22 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 8, + "end_line": 8, + "column": 4, + "end_column": 36 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 8, + "end_line": 8, + "column": 4, + "end_column": 36 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "stores", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 8, + "end_line": 8, + "column": 18, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + }, + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 8, + "end_line": 8, + "column": 27, + "end_column": 34 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Xk~0{Zv", + "encoding": "utf8" + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 9, + "end_line": 9, + "column": 4, + "end_column": 25 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 9, + "end_line": 9, + "column": 4, + "end_column": 25 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "stores", + "immediates": [], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 9, + "end_line": 9, + "column": 18, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "15", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 9, + "end_line": 9, + "column": 22, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "45", + "teal_alias": null + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo", + "member_name": "setThings", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 4, + "end_line": 5, + "column": 0, + "end_column": 54 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 4, + "end_line": 5, + "column": 0, + "end_column": 54 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 4, + "end_line": 5, + "column": 0, + "end_column": 54 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/reserve-scratch.algo.ts", + "line": 4, + "end_line": 5, + "column": 0, + "end_column": 54 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/reserve-scratch.algo.ts::ReserveScratchAlgo", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [], + "state_totals": { + "_type": "StateTotals", + "global_uints": null, + "local_uints": null, + "global_bytes": null, + "local_bytes": null + }, + "reserved_scratch_space": [ + "0", + "1", + "10", + "11", + "12", + "13", + "14", + "15", + "16", + "17", + "18", + "19", + "20", + "50" + ], + "avm_version": null + } +] \ No newline at end of file diff --git a/tests/approvals/reserve-scratch.algo.ts b/tests/approvals/reserve-scratch.algo.ts new file mode 100644 index 00000000..cd209de2 --- /dev/null +++ b/tests/approvals/reserve-scratch.algo.ts @@ -0,0 +1,30 @@ +import { assert, BaseContract, Bytes, contract } from '@algorandfoundation/algorand-typescript' +import { Scratch } from '@algorandfoundation/algorand-typescript/op' + +@contract({ scratchSlots: [0, 1, { from: 10, to: 20 }] }) +export class ReserveScratchAlgo extends BaseContract { + setThings() { + Scratch.store(0, 1) + Scratch.store(1, Bytes('hello')) + Scratch.store(15, 45) + } + + approvalProgram(): boolean { + this.setThings() + + assert(Scratch.loadUint64(0) === 1) + assert(Scratch.loadBytes(0) === Bytes('hello')) + assert(Scratch.loadUint64(15) === 45) + return true + } +} + +@contract({ scratchSlots: [50] }) +export class SubReserveScratchAlgo extends ReserveScratchAlgo { + approvalProgram(): boolean { + super.approvalProgram() + Scratch.store(50, Bytes('world')) + Scratch.store(16, Bytes('world')) + return true + } +}