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": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkJhc2VXaXRoU3RhdGUuYXBwcm92YWxQcm9ncmFtOgogICAgaW50Y2Jsb2NrIDAgMQogICAgYnl0ZWNibG9jayAib25lR2xvYmFsIgogICAgdHhuIEFwcGxpY2F0aW9uSUQKICAgIGJueiBtYWluX2FmdGVyX2lmX2Vsc2VAMgogICAgY2FsbHN1YiBjb25zdHJ1Y3RvcgoKbWFpbl9hZnRlcl9pZl9lbHNlQDI6CiAgICBjYWxsc3ViIF9fcHV5YV9hcmM0X3JvdXRlcl9fCiAgICByZXR1cm4KCgovLyB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IDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkJhc2VXaXRoU3RhdGUuY2xlYXJTdGF0ZVByb2dyYW06CiAgICBwdXNoaW50IDEgLy8gMQogICAgcmV0dXJuCg==" + }, + "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": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkJhc2VXaXRoU3RhdGUuYXBwcm92YWxQcm9ncmFtOgogICAgaW50Y2Jsb2NrIDAgMQogICAgYnl0ZWNibG9jayAib25lR2xvYmFsIgogICAgdHhuIEFwcGxpY2F0aW9uSUQKICAgIGJueiBtYWluX2FmdGVyX2lmX2Vsc2VAMgogICAgY2FsbHN1YiBjb25zdHJ1Y3RvcgoKbWFpbl9hZnRlcl9pZl9lbHNlQDI6CiAgICBjYWxsc3ViIF9fcHV5YV9hcmM0X3JvdXRlcl9fCiAgICByZXR1cm4KCgovLyB0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkJhc2VXaXRoU3RhdGUuY29uc3RydWN0b3IoKSAtPiB2b2lkOgpjb25zdHJ1Y3RvcjoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9zdGF0ZS10b3RhbHMuYWxnby50czo0CiAgICAvLyBleHBvcnQgY2xhc3MgQmFzZVdpdGhTdGF0ZSBleHRlbmRzIENvbnRyYWN0IHsKICAgIHByb3RvIDAgMAogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjUKICAgIC8vIG9uZUdsb2Jhb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sdWUgPSBuCiAgICBmcmFtZV9kaWcgLTEKICAgIGFwcF9nbG9iYWxfcHV0CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6NgogICAgLy8gdHdvR2xvYmFsID0gR2xvYmFsU3RhdGU8dWludDY0PigpCiAgICBwdXNoYnl0ZXMgInR3b0dsb2JhbCIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9zdGF0ZS10b3RhbHMuYWxnby50czoxMQogICAgLy8gdGhpcy50d29HbG9iYWwudmFsdWUgPSBuCiAgICBmcmFtZV9kaWcgLTEKICAgIGFwcF9nbG9iYWxfcHV0CiAgICByZXRzdWIKCgovLyB0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkJhc2VXaXRoU3RhdGUuX19hbGdvdHNfXy5kZWZhdWx0Q3JlYXRlKCkgLT4gdm9pZDoKX19hbGdvdHNfXy5kZWZhdWx0Q3JlYXRlOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjQKICAgIC8vIGV4cG9ydCBjbGFzcyBCYXNlV2l0aFN0YXRlIGV4dGVuZHMgQ29udHJhY3QgewogICAgcHJvdG8gMCAwCiAgICByZXRzdWIK", + "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+IHZvaWQ6CmNvbnN0cnVjdG9yOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjI3LTI4CiAgICAvLyBAY29udHJhY3QoeyBzdGF0ZVRvdGFsczoge30gfSkKICAgIC8vIGV4cG9ydCBjbGFzcyBFeHRlbmRzU3ViV2l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ZS10b3RhbHMuYWxnby50czo6RXh0ZW5kc1N1YldpdGhUb3RhbHMuX19hbGdvdHNfXy5kZWZhdWx0Q3JlYXRlKCkgLT4gdm9pZDoKX19hbGdvdHNfXy5kZWZhdWx0Q3JlYXRlOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjI3LTI4CiAgICAvLyBAY29udHJhY3QoeyBzdGF0ZVRvdGFsczoge30gfSkKICAgIC8vIGV4cG9ydCBjbGFzcyBFeHRlbmRzU3ViV2l0aFRvdGFscyBleHRlbmRzIFN1YkNsYXNzV2l0aEV4cGxpY2l0VG90YWxzIHsKICAgIHByb3RvIDAgMAogICAgcmV0c3ViCg==", + "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": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkV4dGVuZHNTdWJXaXRoVG90YWxzLmFwcHJvdmFsUHJvZ3JhbToKICAgIGludGNibG9jayAwIDEKICAgIGJ5dGVjYmxvY2sgIm9uZ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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+IHZvaWQ6CmNvbnN0cnVjdG9yOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjI0LTI1CiAgICAvLyBAY29udHJh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FzZVdpdGhTdGF0ZSB7fQogICAgcHJvdG8gMCAwCiAgICByZXRzdWIK", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OlN1YkNsYXNzV2l0aEV4cGxpY2l0VG90YWxzLmNsZWFyU3RhdGVQcm9ncmFtOgogICAgcHVzaGludCAxIC8vIDEKICAgIHJldHVybgo=" + }, + "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+IHZvaWQ6CmNvbnN0cnVjdG9yOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjI0L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G90YWxzIGV4dGVuZHMgQmFzZVdpdGhTdGF0ZSB7fQogICAgcHJvdG8gMCAwCiAgICByZXRzdWIK", + "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+IHZvaWQ6CmNvbnN0cnVjdG9yOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjE1CiAgICAvLyBleHBvcnQgY2xhc3MgU3ViQ2xhc3NXaXRoU3RhdGUgZXh0ZW5kcy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KICAgIC8vIGV4cG9ydCBjbGFzcyBTdWJDbGFzc1dpdGhTdGF0ZSBleHRlbmRzIEJhc2VXaXRoU3RhdGUgewogICAgcHJvdG8gMCAwCiAgICByZXRzdWIK", + "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": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OlN1YkNsYXNzV2l0aFN0YXRlLmFwcHJvdmFsUHJvZ3JhbToKICAgIGludGNibG9jayAwIDEKICAgIGJ5dGVjYmxvY2sgIm9uZUdsb2JhbCIKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBibnogbWFpbl9hZnRlcl9pZl9lbHNlQDIKICAgIGNhbGxzdWIgY29uc3RydWN0b3IKCm1haW5fYWZ0ZXJfaWZfZWxzZUAyOgogICAgY2FsbHN1YiBfX3B1eWFfYXJjNF9yb3V0ZXJfXwogICAg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CiAgICBhcHBfZ2xvYmFsX3B1dAogICAgcmV0c3ViCgoKLy8gdGVzdHMvYXBwcm92YWxzL3N0YXRlLXRvdGFscy5hbGdvLnRzOjpTdWJDbGFzc1dpdGhTdGF0ZS5fX2FsZ290c19fLmRlZmF1bHRDcmVhdGUoKSAtPiB2b2lkOgpfX2FsZ290c19fLmRlZmF1bHRDcmVhdGU6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6MTUKICAgIC8vIGV4cG9ydCBjbGFzcyBTdWJDbGFzc1dpdGhTdGF0ZSBleHRlbmRzIEJhc2VXaXRoU3RhdGUgewogICAgcHJvdG8gMCAwCiAgICByZXRzdWIK", + "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!,