-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow stateTotals to be specified statically in contract options
- Loading branch information
1 parent
a11c599
commit d9e3bfe
Showing
29 changed files
with
6,671 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
tests/approvals/out/state-totals/BaseWithState.approval.teal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<uint64>() | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"hints": { | ||
"setState(uint64)void": { | ||
"call_config": { | ||
"no_op": "CALL" | ||
} | ||
} | ||
}, | ||
"source": { | ||
"approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkJhc2VXaXRoU3RhdGUuYXBwcm92YWxQcm9ncmFtOgogICAgaW50Y2Jsb2NrIDAgMQogICAgYnl0ZWNibG9jayAib25lR2xvYmFsIgogICAgdHhuIEFwcGxpY2F0aW9uSUQKICAgIGJueiBtYWluX2FmdGVyX2lmX2Vsc2VAMgogICAgY2FsbHN1YiBjb25zdHJ1Y3RvcgoKbWFpbl9hZnRlcl9pZl9lbHNlQDI6CiAgIC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ogICAgcHJvdG8gMCAwCiAgICByZXRzdWIK", | ||
"clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvc3RhdGUtdG90YWxzLmFsZ28udHM6OkJhc2VXaXRoU3RhdGUuY2xlYXJTdGF0ZVByb2dyYW06CiAgICBwdXNoaW50IDEgLy8gMQogICAgcmV0dXJuCg==" | ||
}, | ||
"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" | ||
} | ||
} |
Oops, something went wrong.