Skip to content

Instantly share code, notes, and snippets.

@robdmoore
Last active February 21, 2023 11:04
Show Gist options
  • Save robdmoore/ffa1cd7aced58f788ef68ac497249ea6 to your computer and use it in GitHub Desktop.
Save robdmoore/ffa1cd7aced58f788ef68ac497249ea6 to your computer and use it in GitHub Desktop.
Example output stability diff for Beaker 0.x -> 1.0
{
"hints": {
"set_governor(account)void": {
"call_config": {
"no_op": "CALL"
}
},
"bootstrap(pay,asset,asset)uint64": {
"call_config": {
"no_op": "CALL"
}
},
"mint(axfer,axfer,asset,asset,asset)void": {
"default_arguments": {
"pool_asset": {
"source": "global-state",
"data": "p"
},
"a_asset": {
"source": "global-state",
"data": "a"
},
"b_asset": {
"source": "global-state",
"data": "b"
}
},
"call_config": {
"no_op": "CALL"
}
},
"burn(axfer,asset,asset,asset)void": {
"default_arguments": {
"pool_asset": {
"source": "global-state",
"data": "p"
},
"a_asset": {
"source": "global-state",
"data": "a"
},
"b_asset": {
"source": "global-state",
"data": "b"
}
},
"call_config": {
"no_op": "CALL"
}
},
"swap(axfer,asset,asset)void": {
"default_arguments": {
"a_asset": {
"source": "global-state",
"data": "a"
},
"b_asset": {
"source": "global-state",
"data": "b"
}
},
"call_config": {
"no_op": "CALL"
}
}
},
"source": {
"approval": "I3ByYWdtYSB2ZXJzaW9uIDgKaW50Y2Jsb2NrIDAgMSAxMDAwIDQgMTAwMDAwMDAwMDAKYnl0ZWNibG9jayAweDYxIDB4NjIgMHg3MCAweDY3IDB4NzIKdHhuIE51bUFwcEFyZ3MKaW50Y18wIC8vIDAKPT0KYm56IG1haW5fbDEyCnR4bmEgQXBwbGljYXRpb25BcmdzIDAKcHVzaGJ5dGVzIDB4MDhhOTU2ZjcgLy8gInNldF9nb3Zlcm5vcihhY2NvdW50KXZvaWQiCj09CmJueiBtYWluX2wxMQp0eG5hIEFwcGxpY2F0aW9uQXJncyAwCnB1c2hieXRlcyAweDZiNTlkOTY1IC8vICJib290c3RyYXAocGF5LGFzc2V0LGFzc2V0KXVpb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WRkcmVzcwppdHhuX2ZpZWxkIENvbmZpZ0Fzc2V0UmVzZXJ2ZQppbnRjXzAgLy8gMAppdHhuX2ZpZWxkIEZlZQppdHhuX3N1Ym1pdAppdHhuIENyZWF0ZWRBc3NldElECnJldHN1YgoKLy8gY29tcHV0ZV9yYXRpbwpjb21wdXRlcmF0aW9fMTU6CnByb3RvIDAgMQpnbG9iYWwgQ3VycmVudEFwcGxpY2F0aW9uQWRkcmVzcwpieXRlY18wIC8vICJhIgphcHBfZ2xvYmFsX2dldAphc3NldF9ob2xkaW5nX2dldCBBc3NldEJhbGFuY2UKc3RvcmUgMjAKc3RvcmUgMTkKZ2xvYmFsIEN1cnJlbnRBcHBsaWNhdGlvbkFkZHJlc3MKYnl0ZWNfMSAvLyAiYiIKYXBwX2dsb2JhbF9nZXQKYXNzZXRfaG9sZGluZ19nZXQgQXNzZXRCYWxhbmNlCnN0b3JlIDIyCnN0b3JlIDIxCmxvYWQgMjAKYXNzZXJ0CmxvYWQgMjIKYXNzZXJ0CmxvYWQgMTkKaW50Y18yIC8vIDEwMDAKbXVsdwppbnRjXzAgLy8gMApsb2FkIDIxCmRpdm1vZHcKcG9wCnBvcApzd2FwCiEKYXNzZXJ0CnJldHN1Yg==",
"clear": "I3ByYWdtYSB2ZXJzaW9uIDgKcHVzaGludCAwIC8vIDAKcmV0dXJu"
},
"state": {
"global": {
"num_byte_slices": 1,
"num_uints": 4
},
"local": {
"num_byte_slices": 0,
"num_uints": 0
}
},
"schema": {
"global": {
"declared": {
"asset_a": {
"type": "uint64",
"key": "a",
"descr": "The asset id of asset A"
},
"asset_b": {
"type": "uint64",
"key": "b",
"descr": "The asset id of asset B"
},
"governor": {
"type": "bytes",
"key": "g",
"descr": "The current governor of this contract, allowed to do admin type actions"
},
"pool_token": {
"type": "uint64",
"key": "p",
"descr": "The asset id of the Pool Token, used to track share of pool the holder may recover"
},
"ratio": {
"type": "uint64",
"key": "r",
"descr": "The ratio between assets (A/B)*Scale"
}
},
"reserved": {}
},
"local": {
"declared": {},
"reserved": {}
}
},
"contract": {
"name": "ConstantProductAMM",
"methods": [
{
"name": "set_governor",
"args": [
{
"type": "account",
"name": "new_governor"
}
],
"returns": {
"type": "void"
},
"desc": "sets the governor of the contract, may only be called by the current governor"
},
{
"name": "bootstrap",
"args": [
{
"type": "pay",
"name": "seed",
"desc": "Initial Payment transaction to the app account so it can opt in to assets and create pool token."
},
{
"type": "asset",
"name": "a_asset",
"desc": "One of the two assets this pool should allow swapping between."
},
{
"type": "asset",
"name": "b_asset",
"desc": "The other of the two assets this pool should allow swapping between."
}
],
"returns": {
"type": "uint64",
"desc": "The asset id of the pool token created."
},
"desc": "bootstraps the contract by opting into the assets and creating the pool token.\nNote this method will fail if it is attempted more than once on the same contract since the assets and pool token application state values are marked as static and cannot be overridden."
},
{
"name": "mint",
"args": [
{
"type": "axfer",
"name": "a_xfer",
"desc": "Asset Transfer Transaction of asset A as a deposit to the pool in exchange for pool tokens."
},
{
"type": "axfer",
"name": "b_xfer",
"desc": "Asset Transfer Transaction of asset B as a deposit to the pool in exchange for pool tokens."
},
{
"type": "asset",
"name": "pool_asset",
"desc": "The asset ID of the pool token so that we may distribute it."
},
{
"type": "asset",
"name": "a_asset",
"desc": "The asset ID of the Asset A so that we may inspect our balance."
},
{
"type": "asset",
"name": "b_asset",
"desc": "The asset ID of the Asset B so that we may inspect our balance."
}
],
"returns": {
"type": "void"
},
"desc": "mint pool tokens given some amount of asset A and asset B.\nGiven some amount of Asset A and Asset B in the transfers, mint some number of pool tokens commensurate with the pools current balance and circulating supply of pool tokens."
},
{
"name": "burn",
"args": [
{
"type": "axfer",
"name": "pool_xfer",
"desc": "Asset Transfer Transaction of the pool token for the amount the sender wishes to redeem"
},
{
"type": "asset",
"name": "pool_asset",
"desc": "Asset ID of the pool token so we may inspect balance."
},
{
"type": "asset",
"name": "a_asset",
"desc": "Asset ID of Asset A so we may inspect balance and distribute it"
},
{
"type": "asset",
"name": "b_asset",
"desc": "Asset ID of Asset B so we may inspect balance and distribute it"
}
],
"returns": {
"type": "void"
},
"desc": "burn pool tokens to get back some amount of asset A and asset B"
},
{
"name": "swap",
"args": [
{
"type": "axfer",
"name": "swap_xfer",
"desc": "Asset Transfer Transaction of either Asset A or Asset B"
},
{
"type": "asset",
"name": "a_asset",
"desc": "Asset ID of asset A so we may inspect balance and possibly transfer it"
},
{
"type": "asset",
"name": "b_asset",
"desc": "Asset ID of asset B so we may inspect balance and possibly transfer it"
}
],
"returns": {
"type": "void"
},
"desc": "Swap some amount of either asset A or asset B for the other"
}
],
"networks": {}
},
"bare_call_config": {
"no_op": "CREATE"
}
}
#pragma version 8
intcblock 0 1 1000 4 10000000000
bytecblock 0x61 0x62 0x70 0x67 0x72
txn NumAppArgs
intc_0 // 0
==
bnz main_l12
txna ApplicationArgs 0
pushbytes 0x08a956f7 // "set_governor(account)void"
==
bnz main_l11
txna ApplicationArgs 0
pushbytes 0x6b59d965 // "bootstrap(pay,asset,asset)uint64"
==
bnz main_l10
txna ApplicationArgs 0
pushbytes 0x5cbf1e2d // "mint(axfer,axfer,asset,asset,asset)void"
==
bnz main_l9
txna ApplicationArgs 0
pushbytes 0x1436c2ac // "burn(axfer,asset,asset,asset)void"
==
bnz main_l8
txna ApplicationArgs 0
pushbytes 0x4a88e055 // "swap(axfer,asset,asset)void"
==
bnz main_l7
err
main_l7:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
txna ApplicationArgs 1
intc_0 // 0
getbyte
store 51
txna ApplicationArgs 2
intc_0 // 0
getbyte
store 52
txn GroupIndex
intc_1 // 1
-
store 50
load 50
gtxns TypeEnum
intc_3 // axfer
==
assert
load 50
load 51
load 52
callsub swap_7
intc_1 // 1
return
main_l8:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
txna ApplicationArgs 1
intc_0 // 0
getbyte
store 47
txna ApplicationArgs 2
intc_0 // 0
getbyte
store 48
txna ApplicationArgs 3
intc_0 // 0
getbyte
store 49
txn GroupIndex
intc_1 // 1
-
store 46
load 46
gtxns TypeEnum
intc_3 // axfer
==
assert
load 46
load 47
load 48
load 49
callsub burn_6
intc_1 // 1
return
main_l9:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
txna ApplicationArgs 1
intc_0 // 0
getbyte
store 43
txna ApplicationArgs 2
intc_0 // 0
getbyte
store 44
txna ApplicationArgs 3
intc_0 // 0
getbyte
store 45
txn GroupIndex
pushint 2 // 2
-
store 41
load 41
gtxns TypeEnum
intc_3 // axfer
==
assert
txn GroupIndex
intc_1 // 1
-
store 42
load 42
gtxns TypeEnum
intc_3 // axfer
==
assert
load 41
load 42
load 43
load 44
load 45
callsub mint_5
intc_1 // 1
return
main_l10:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
txna ApplicationArgs 1
intc_0 // 0
getbyte
store 38
txna ApplicationArgs 2
intc_0 // 0
getbyte
store 39
txn GroupIndex
intc_1 // 1
-
store 37
load 37
gtxns TypeEnum
intc_1 // pay
==
assert
load 37
load 38
load 39
callsub bootstrap_4
store 40
pushbytes 0x151f7c75 // 0x151f7c75
load 40
itob
concat
log
intc_1 // 1
return
main_l11:
txn OnCompletion
intc_0 // NoOp
==
txn ApplicationID
intc_0 // 0
!=
&&
assert
txna ApplicationArgs 1
intc_0 // 0
getbyte
callsub setgovernor_2
intc_1 // 1
return
main_l12:
txn OnCompletion
intc_0 // NoOp
==
bnz main_l14
err
main_l14:
txn ApplicationID
intc_0 // 0
==
assert
callsub create_0
intc_1 // 1
return
// create
create_0:
proto 0 0
bytec_3 // "g"
global CreatorAddress
app_global_put
bytec 4 // "r"
intc_0 // 0
app_global_put
retsub
// auth_only
authonly_1:
proto 1 1
frame_dig -1
bytec_3 // "g"
app_global_get
==
retsub
// set_governor
setgovernor_2:
proto 1 0
txn Sender
callsub authonly_1
// unauthorized
assert
bytec_3 // "g"
frame_dig -1
txnas Accounts
app_global_put
retsub
// auth_only
authonly_3:
proto 1 1
frame_dig -1
bytec_3 // "g"
app_global_get
==
retsub
// bootstrap
bootstrap_4:
proto 3 1
intc_0 // 0
txn Sender
callsub authonly_3
// unauthorized
assert
global GroupSize
pushint 2 // 2
==
// group size not 2
assert
frame_dig -3
gtxns Receiver
global CurrentApplicationAddress
==
// receiver not app address
assert
frame_dig -3
gtxns Amount
pushint 300000 // 300000
>=
// amount minimum not met
assert
frame_dig -2
txnas Assets
frame_dig -1
txnas Assets
<
// asset a or asset b incorrect
assert
intc_0 // 0
bytec_0 // "a"
app_global_get_ex
store 1
store 0
load 1
!
assert
bytec_0 // "a"
frame_dig -2
txnas Assets
app_global_put
intc_0 // 0
bytec_1 // "b"
app_global_get_ex
store 3
store 2
load 3
!
assert
bytec_1 // "b"
frame_dig -1
txnas Assets
app_global_put
intc_0 // 0
bytec_2 // "p"
app_global_get_ex
store 5
store 4
load 5
!
assert
bytec_2 // "p"
bytec_0 // "a"
app_global_get
bytec_1 // "b"
app_global_get
callsub docreatepooltoken_14
app_global_put
bytec_0 // "a"
app_global_get
callsub dooptin_13
bytec_1 // "b"
app_global_get
callsub dooptin_13
bytec_2 // "p"
app_global_get
frame_bury 0
retsub
// mint
mint_5:
proto 5 0
frame_dig -2
txnas Assets
bytec_0 // "a"
app_global_get
==
// asset a incorrect
assert
frame_dig -1
txnas Assets
bytec_1 // "b"
app_global_get
==
// asset b incorrect
assert
frame_dig -3
txnas Assets
bytec_2 // "p"
app_global_get
==
// asset pool incorrect
assert
frame_dig -5
gtxns Sender
txn Sender
==
frame_dig -4
gtxns Sender
txn Sender
==
&&
// invalid sender
assert
frame_dig -5
gtxns AssetReceiver
global CurrentApplicationAddress
==
// receiver not app address
assert
frame_dig -5
gtxns XferAsset
bytec_0 // "a"
app_global_get
==
// asset a incorrect
assert
frame_dig -5
gtxns AssetAmount
intc_0 // 0
>
// amount minimum not met
assert
frame_dig -4
gtxns AssetReceiver
global CurrentApplicationAddress
==
// receiver not app address
assert
frame_dig -4
gtxns XferAsset
bytec_1 // "b"
app_global_get
==
// asset b incorrect
assert
frame_dig -4
gtxns AssetAmount
intc_0 // 0
>
// amount minimum not met
assert
global CurrentApplicationAddress
frame_dig -3
asset_holding_get AssetBalance
store 11
store 10
global CurrentApplicationAddress
frame_dig -2
asset_holding_get AssetBalance
store 13
store 12
global CurrentApplicationAddress
frame_dig -1
asset_holding_get AssetBalance
store 15
store 14
load 11
assert
load 13
assert
load 15
assert
load 12
frame_dig -5
gtxns AssetAmount
==
load 14
frame_dig -4
gtxns AssetAmount
==
&&
bnz mint_5_l2
intc 4 // 10000000000
load 10
-
load 12
frame_dig -5
gtxns AssetAmount
-
load 14
frame_dig -4
gtxns AssetAmount
-
frame_dig -5
gtxns AssetAmount
frame_dig -4
gtxns AssetAmount
callsub tokenstomint_8
b mint_5_l3
mint_5_l2:
frame_dig -5
gtxns AssetAmount
frame_dig -4
gtxns AssetAmount
callsub tokenstomintinitial_9
mint_5_l3:
store 16
load 16
intc_0 // 0
>
// outgoing amount too low
assert
txn Sender
bytec_2 // "p"
app_global_get
load 16
callsub doaxfer_12
bytec 4 // "r"
callsub computeratio_15
app_global_put
retsub
// burn
burn_6:
proto 4 0
frame_dig -3
txnas Assets
bytec_2 // "p"
app_global_get
==
// asset pool incorrect
assert
frame_dig -2
txnas Assets
bytec_0 // "a"
app_global_get
==
// asset a incorrect
assert
frame_dig -1
txnas Assets
bytec_1 // "b"
app_global_get
==
// asset b incorrect
assert
frame_dig -4
gtxns AssetReceiver
global CurrentApplicationAddress
==
// receiver not app address
assert
frame_dig -4
gtxns AssetAmount
intc_0 // 0
>
// amount minimum not met
assert
frame_dig -4
gtxns XferAsset
bytec_2 // "p"
app_global_get
==
// asset pool incorrect
assert
frame_dig -4
gtxns Sender
txn Sender
==
// invalid sender
assert
global CurrentApplicationAddress
frame_dig -3
asset_holding_get AssetBalance
store 24
store 23
global CurrentApplicationAddress
frame_dig -2
asset_holding_get AssetBalance
store 26
store 25
global CurrentApplicationAddress
frame_dig -1
asset_holding_get AssetBalance
store 28
store 27
load 24
assert
load 26
assert
load 28
assert
intc 4 // 10000000000
load 23
frame_dig -4
gtxns AssetAmount
-
-
store 29
load 29
load 25
frame_dig -4
gtxns AssetAmount
callsub tokenstoburn_10
store 30
load 29
load 27
frame_dig -4
gtxns AssetAmount
callsub tokenstoburn_10
store 31
txn Sender
bytec_0 // "a"
app_global_get
load 30
callsub doaxfer_12
txn Sender
bytec_1 // "b"
app_global_get
load 31
callsub doaxfer_12
bytec 4 // "r"
callsub computeratio_15
app_global_put
retsub
// swap
swap_7:
proto 3 0
frame_dig -2
txnas Assets
bytec_0 // "a"
app_global_get
==
// asset a incorrect
assert
frame_dig -1
txnas Assets
bytec_1 // "b"
app_global_get
==
// asset b incorrect
assert
frame_dig -3
gtxns XferAsset
bytec_0 // "a"
app_global_get
==
frame_dig -3
gtxns XferAsset
bytec_1 // "b"
app_global_get
==
||
// asset a or asset b incorrect
assert
frame_dig -3
gtxns AssetAmount
intc_0 // 0
>
// amount minimum not met
assert
frame_dig -3
gtxns Sender
txn Sender
==
// invalid sender
assert
global CurrentApplicationAddress
frame_dig -3
gtxns XferAsset
asset_holding_get AssetBalance
store 33
store 32
global CurrentApplicationAddress
frame_dig -3
gtxns XferAsset
bytec_0 // "a"
app_global_get
==
bnz swap_7_l5
bytec_0 // "a"
app_global_get
swap_7_l2:
asset_holding_get AssetBalance
store 35
store 34
load 33
assert
load 35
assert
frame_dig -3
gtxns AssetAmount
load 32
frame_dig -3
gtxns AssetAmount
-
load 34
callsub tokenstoswap_11
store 36
load 36
intc_0 // 0
>
// outgoing amount too low
assert
txn Sender
frame_dig -3
gtxns XferAsset
bytec_0 // "a"
app_global_get
==
bnz swap_7_l4
bytec_0 // "a"
app_global_get
b swap_7_l6
swap_7_l4:
bytec_1 // "b"
app_global_get
b swap_7_l6
swap_7_l5:
bytec_1 // "b"
app_global_get
b swap_7_l2
swap_7_l6:
load 36
callsub doaxfer_12
bytec 4 // "r"
callsub computeratio_15
app_global_put
retsub
// tokens_to_mint
tokenstomint_8:
proto 5 1
frame_dig -2
intc_2 // 1000
mulw
intc_0 // 0
frame_dig -4
divmodw
pop
pop
swap
!
assert
store 17
frame_dig -1
intc_2 // 1000
mulw
intc_0 // 0
frame_dig -3
divmodw
pop
pop
swap
!
assert
store 18
load 17
load 18
<
bnz tokenstomint_8_l2
load 18
b tokenstomint_8_l3
tokenstomint_8_l2:
load 17
tokenstomint_8_l3:
frame_dig -5
mulw
intc_0 // 0
intc_2 // 1000
divmodw
pop
pop
swap
!
assert
retsub
// tokens_to_mint_initial
tokenstomintinitial_9:
proto 2 1
frame_dig -2
frame_dig -1
*
sqrt
intc_2 // 1000
-
retsub
// tokens_to_burn
tokenstoburn_10:
proto 3 1
frame_dig -2
frame_dig -1
mulw
intc_0 // 0
frame_dig -3
divmodw
pop
pop
swap
!
assert
retsub
// tokens_to_swap
tokenstoswap_11:
proto 3 1
frame_dig -3
intc_2 // 1000
pushint 5 // 5
-
mulw
frame_dig -1
uncover 2
dig 1
*
cover 2
mulw
cover 2
+
swap
intc_0 // 0
frame_dig -2
intc_2 // 1000
*
frame_dig -3
intc_2 // 1000
pushint 5 // 5
-
*
+
divmodw
pop
pop
swap
!
assert
retsub
// do_axfer
doaxfer_12:
proto 3 0
itxn_begin
intc_3 // axfer
itxn_field TypeEnum
frame_dig -2
itxn_field XferAsset
frame_dig -1
itxn_field AssetAmount
frame_dig -3
itxn_field AssetReceiver
intc_0 // 0
itxn_field Fee
itxn_submit
retsub
// do_opt_in
dooptin_13:
proto 1 0
global CurrentApplicationAddress
frame_dig -1
intc_0 // 0
callsub doaxfer_12
retsub
// do_create_pool_token
docreatepooltoken_14:
proto 2 1
frame_dig -2
asset_params_get AssetUnitName
store 7
store 6
frame_dig -1
asset_params_get AssetUnitName
store 9
store 8
load 7
assert
load 9
assert
itxn_begin
pushint 3 // acfg
itxn_field TypeEnum
pushbytes 0x4450542d // "DPT-"
load 6
concat
pushbytes 0x2d // "-"
concat
load 8
concat
itxn_field ConfigAssetName
pushbytes 0x647074 // "dpt"
itxn_field ConfigAssetUnitName
intc 4 // 10000000000
itxn_field ConfigAssetTotal
pushint 3 // 3
itxn_field ConfigAssetDecimals
global CurrentApplicationAddress
itxn_field ConfigAssetManager
global CurrentApplicationAddress
itxn_field ConfigAssetReserve
intc_0 // 0
itxn_field Fee
itxn_submit
itxn CreatedAssetID
retsub
// compute_ratio
computeratio_15:
proto 0 1
global CurrentApplicationAddress
bytec_0 // "a"
app_global_get
asset_holding_get AssetBalance
store 20
store 19
global CurrentApplicationAddress
bytec_1 // "b"
app_global_get
asset_holding_get AssetBalance
store 22
store 21
load 20
assert
load 22
assert
load 19
intc_2 // 1000
mulw
intc_0 // 0
load 21
divmodw
pop
pop
swap
!
assert
retsub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment