Skip to content

Commit

Permalink
feat: Local/GlobalState custom keys & descriptions
Browse files Browse the repository at this point in the history
also:
- solve issue of requiring forward declaration of constants & types
- improve code generation for state access in some cases
- `scratch_slots` reservation fixes/improvements  
- address usage of non-utf8 file encodings
- various bug fixes, refactoring, and minor optimisation improvements
  • Loading branch information
achidlow authored Mar 5, 2024
1 parent 44b5e7f commit e9d5084
Show file tree
Hide file tree
Showing 351 changed files with 15,996 additions and 14,588 deletions.
2,268 changes: 1,134 additions & 1,134 deletions examples/amm/out/ConstantProductAMM.approval.mir

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions examples/amm/out/ConstantProductAMM.approval.teal
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ _check_is_governor:
int 0
byte "governor"
app_global_get_ex
assert // check value exists
assert // check governor exists
==
// amm/contract.py:266-268
// assert (
Expand All @@ -275,7 +275,7 @@ bootstrap:
int 0
byte "pool_token"
app_global_get_ex
assert // check value exists
assert // check pool_token exists
!
assert // application has already been bootstrapped
// amm/contract.py:69
Expand Down Expand Up @@ -328,21 +328,21 @@ bootstrap:
int 0
byte "asset_a"
app_global_get_ex
assert // check value exists
assert // check asset_a exists
callsub _do_opt_in
// amm/contract.py:80
// self._do_opt_in(self.asset_b)
int 0
byte "asset_b"
app_global_get_ex
assert // check value exists
assert // check asset_b exists
callsub _do_opt_in
// amm/contract.py:81
// return arc4.UInt64(self.pool_token.asset_id)
int 0
byte "pool_token"
app_global_get_ex
assert // check value exists
assert // check pool_token exists
itob
retsub

Expand Down Expand Up @@ -370,7 +370,7 @@ _create_pool_token:
int 0
byte "asset_a"
app_global_get_ex
assert // check value exists
assert // check asset_a exists
asset_params_get AssetUnitName
assert // asset exists
byte "DPT-"
Expand All @@ -381,7 +381,7 @@ _create_pool_token:
int 0
byte "asset_b"
app_global_get_ex
assert // check value exists
assert // check asset_b exists
asset_params_get AssetUnitName
assert // asset exists
concat
Expand Down Expand Up @@ -540,7 +540,7 @@ mint:
int 0
byte "pool_token"
app_global_get_ex
assert // check value exists
assert // check pool_token exists
frame_dig -3
==
assert // asset pool incorrect
Expand All @@ -549,7 +549,7 @@ mint:
int 0
byte "asset_a"
app_global_get_ex
assert // check value exists
assert // check asset_a exists
frame_dig -2
==
assert // asset a incorrect
Expand All @@ -558,7 +558,7 @@ mint:
int 0
byte "asset_b"
app_global_get_ex
assert // check value exists
assert // check asset_b exists
frame_dig -1
==
assert // asset b incorrect
Expand Down Expand Up @@ -595,7 +595,7 @@ mint:
int 0
byte "asset_a"
app_global_get_ex
assert // check value exists
assert // check asset_a exists
==
assert // asset a incorrect
// amm/contract.py:127
Expand Down Expand Up @@ -625,7 +625,7 @@ mint:
int 0
byte "asset_b"
app_global_get_ex
assert // check value exists
assert // check asset_b exists
==
assert // asset b incorrect
// amm/contract.py:134
Expand Down Expand Up @@ -669,7 +669,7 @@ mint:
int 0
byte "pool_token"
app_global_get_ex
assert // check value exists
assert // check pool_token exists
uncover 2
callsub do_asset_transfer
// amm/contract.py:147
Expand All @@ -689,7 +689,7 @@ _check_bootstrapped:
int 0
byte "pool_token"
app_global_get_ex
assert // check value exists
assert // check pool_token exists
assert // bootstrap method needs to be called first
retsub

Expand All @@ -706,7 +706,7 @@ _current_pool_balance:
int 0
byte "pool_token"
app_global_get_ex
assert // check value exists
assert // check pool_token exists
asset_holding_get AssetBalance
assert // account opted into asset
retsub
Expand All @@ -724,7 +724,7 @@ _current_a_balance:
int 0
byte "asset_a"
app_global_get_ex
assert // check value exists
assert // check asset_a exists
asset_holding_get AssetBalance
assert // account opted into asset
retsub
Expand All @@ -742,7 +742,7 @@ _current_b_balance:
int 0
byte "asset_b"
app_global_get_ex
assert // check value exists
assert // check asset_b exists
asset_holding_get AssetBalance
assert // account opted into asset
retsub
Expand Down Expand Up @@ -897,7 +897,7 @@ burn:
int 0
byte "pool_token"
app_global_get_ex
assert // check value exists
assert // check pool_token exists
frame_dig -3
==
assert // asset pool incorrect
Expand All @@ -906,7 +906,7 @@ burn:
int 0
byte "asset_a"
app_global_get_ex
assert // check value exists
assert // check asset_a exists
frame_dig -2
==
assert // asset a incorrect
Expand All @@ -915,7 +915,7 @@ burn:
int 0
byte "asset_b"
app_global_get_ex
assert // check value exists
assert // check asset_b exists
frame_dig -1
==
assert // asset b incorrect
Expand Down Expand Up @@ -945,7 +945,7 @@ burn:
int 0
byte "pool_token"
app_global_get_ex
assert // check value exists
assert // check pool_token exists
==
assert // asset pool incorrect
// amm/contract.py:183
Expand Down Expand Up @@ -993,7 +993,7 @@ burn:
int 0
byte "asset_a"
app_global_get_ex
assert // check value exists
assert // check asset_a exists
uncover 2
callsub do_asset_transfer
// amm/contract.py:202-203
Expand All @@ -1003,7 +1003,7 @@ burn:
int 0
byte "asset_b"
app_global_get_ex
assert // check value exists
assert // check asset_b exists
uncover 2
callsub do_asset_transfer
// amm/contract.py:204
Expand Down Expand Up @@ -1061,7 +1061,7 @@ swap:
int 0
byte "asset_a"
app_global_get_ex
assert // check value exists
assert // check asset_a exists
frame_dig -2
==
assert // asset a incorrect
Expand All @@ -1070,7 +1070,7 @@ swap:
int 0
byte "asset_b"
app_global_get_ex
assert // check value exists
assert // check asset_b exists
frame_dig -1
==
assert // asset b incorrect
Expand All @@ -1094,13 +1094,13 @@ swap:
int 0
byte "asset_a"
app_global_get_ex
assert // check value exists
assert // check asset_a exists
// amm/contract.py:238
// case self.asset_b:
int 0
byte "asset_b"
app_global_get_ex
assert // check value exists
assert // check asset_b exists
// amm/contract.py:233
// match swap_xfer.xfer_asset:
frame_dig -3
Expand Down Expand Up @@ -1137,7 +1137,7 @@ swap_switch_case_0@1:
app_global_get_ex
swap
frame_bury 1
assert // check value exists
assert // check asset_a exists
b swap_switch_case_next@4

swap_switch_case_1@2:
Expand All @@ -1155,7 +1155,7 @@ swap_switch_case_1@2:
app_global_get_ex
swap
frame_bury 1
assert // check value exists
assert // check asset_b exists

swap_switch_case_next@4:
// amm/contract.py:245-247
Expand Down
2 changes: 1 addition & 1 deletion examples/amm/out/ConstantProductAMM.arc32.json

Large diffs are not rendered by default.

Loading

0 comments on commit e9d5084

Please sign in to comment.