@@ -26,15 +26,15 @@ ACCOUNT=$(${gcmd} account list|awk '{ print $3 }')
2626# Create a smaller account so rewards won't change balances.
2727SMALL=$( ${gcmd} account new | awk ' { print $6 }' )
2828# Under one algo receives no rewards
29- ${gcmd} clerk send -a 1000000 -f " $ACCOUNT " -t " $SMALL "
29+ ${gcmd} clerk send -a 999000 -f " $ACCOUNT " -t " $SMALL "
3030
3131function balance {
3232 acct=$1 ; shift
3333 goal account balance -a " $acct " | awk ' {print $1}'
3434}
3535
36- [ " $( balance " $ACCOUNT " ) " = 999998999000 ]
37- [ " $( balance " $SMALL " ) " = 1000000 ]
36+ [ " $( balance " $ACCOUNT " ) " = 999999000000 ]
37+ [ " $( balance " $SMALL " ) " = 999000 ]
3838
3939function created_assets {
4040 acct=$1 ;
@@ -62,7 +62,7 @@ function assets {
6262}
6363
6464APPID=$( ${gcmd} app create --creator " ${SMALL} " --approval-prog=${TEAL} /assets-escrow.teal --global-byteslices 4 --global-ints 0 --local-byteslices 0 --local-ints 1 --clear-prog=${TEAL} /approve-all.teal | grep Created | awk ' { print $6 }' )
65- [ " $( balance " $SMALL " ) " = 999000 ] # 1000 fee
65+ [ " $( balance " $SMALL " ) " = 998000 ] # 1000 fee
6666
6767function appl {
6868 method=$1 ; shift
@@ -81,7 +81,6 @@ function asset-id {
8181}
8282
8383APPACCT=$( python -c " import algosdk.encoding as e; print(e.encode_address(e.checksum(b'appID'+($APPID ).to_bytes(8, 'big'))))" )
84- [ " $( balance " $SMALL " ) " = 999000 ] # 1000 fee
8584
8685function asset-create {
8786 amount=$1 ; shift
@@ -116,15 +115,15 @@ function sign {
116115TXID=$( ${gcmd} app optin --app-id " $APPID " --from " ${SMALL} " | app-txid)
117116# Rest succeeds, no stray inner-txn array
118117[ " $( rest " /v2/transactions/pending/$TXID " | jq ' .["inner-txn"]' ) " == null ]
119- [ " $( balance " $SMALL " ) " = 998000 ] # 1000 fee
118+ [ " $( balance " $SMALL " ) " = 997000 ] # 1000 fee
120119
121120ASSETID=$( asset-create 1000000 --name " e2e" --unitname " e" | asset-id)
122- [ " $( balance " $SMALL " ) " = 997000 ] # 1000 fee
121+ [ " $( balance " $SMALL " ) " = 996000 ] # 1000 fee
123122
124123${gcmd} clerk send -a 1000000 -f " $ACCOUNT " -t " $APPACCT "
125124appl " optin():void" --foreign-asset=" $ASSETID " --from=" $SMALL "
126125[ " $( balance " $APPACCT " ) " = 999000 ] # 1000 fee
127- [ " $( balance " $SMALL " ) " = 996000 ]
126+ [ " $( balance " $SMALL " ) " = 995000 ]
128127
129128appl " deposit():void" -o " $T /deposit.tx" --from=" $SMALL "
130129asset-deposit 1000 $ASSETID -o " $T /axfer1.tx"
@@ -136,7 +135,7 @@ ${gcmd} clerk rawsend -f "$T/group.stx"
136135[ " $( asset_bal " $SMALL " ) " = 999000 ] # asset balance
137136[ " $( asset_ids " $APPACCT " ) " = $ASSETID ]
138137[ " $( asset_bal " $APPACCT " ) " = 1000 ]
139- [ " $( balance " $SMALL " ) " = 994000 ] # 2 fees
138+ [ " $( balance " $SMALL " ) " = 993000 ] # 2 fees
140139[ " $( balance " $APPACCT " ) " = 999000 ]
141140
142141# Withdraw 100 in app. Confirm that inner txn is visible to transaction API.
@@ -151,31 +150,31 @@ rest "/v2/blocks/$ROUND" | jq .block.txns[0].dt.itx
151150
152151[ " $( asset_bal " $SMALL " ) " = 999100 ] # 100 asset withdrawn
153152[ " $( asset_bal " $APPACCT " ) " = 900 ] # 100 asset withdrawn
154- [ " $( balance " $SMALL " ) " = 993000 ] # 1 fee
153+ [ " $( balance " $SMALL " ) " = 992000 ] # 1 fee
155154[ " $( balance " $APPACCT " ) " = 998000 ] # fee paid by app
156155
157156appl " withdraw(uint64):void" --app-arg=" int:100" --foreign-asset=" $ASSETID " --fee 2000 --from=" $SMALL "
158157[ " $( asset_bal " $SMALL " ) " = 999200 ] # 100 asset withdrawn
159- [ " $( balance " $SMALL " ) " = 991000 ] # 2000 fee
158+ [ " $( balance " $SMALL " ) " = 990000 ] # 2000 fee
160159[ " $( asset_bal " $APPACCT " ) " = 800 ] # 100 asset withdrawn
161160[ " $( balance " $APPACCT " ) " = 998000 ] # fee credit used
162161
163162# Try to withdraw too much
164163appl " withdraw(uint64):void" --app-arg=" int:1000" --foreign-asset=" $ASSETID " --from=" $SMALL " && exit 1
165164[ " $( asset_bal " $SMALL " ) " = 999200 ] # no change
166165[ " $( asset_bal " $APPACCT " ) " = 800 ] # no change
167- [ " $( balance " $SMALL " ) " = 991000 ]
166+ [ " $( balance " $SMALL " ) " = 990000 ]
168167[ " $( balance " $APPACCT " ) " = 998000 ]
169168
170169# Show that it works AT exact asset balance
171170appl " withdraw(uint64):void" --app-arg=" int:800" --foreign-asset=" $ASSETID " --from=" $SMALL "
172171[ " $( asset_bal " $SMALL " ) " = 1000000 ]
173172[ " $( asset_bal " $APPACCT " ) " = 0 ]
174- [ " $( balance " $SMALL " ) " = 990000 ]
173+ [ " $( balance " $SMALL " ) " = 989000 ]
175174[ " $( balance " $APPACCT " ) " = 997000 ]
176175
177176USER=$( ${gcmd} account new | awk ' { print $6 }' ) # new account
178- ${gcmd} clerk send -a 1000000 -f " $ACCOUNT " -t " $USER " # fund account
177+ ${gcmd} clerk send -a 999000 -f " $ACCOUNT " -t " $USER " # fund account
179178asset-optin -f " $USER " -t " $USER " --assetid " $ASSETID " # opt in to asset
180179# SET $USER as clawback address
181180${gcmd} asset config --manager $SMALL --assetid $ASSETID --new-clawback $USER
@@ -190,7 +189,7 @@ ${gcmd} clerk send --from "$USER" --to "$USER" -a 0 --rekey-to "$APPACCT"
190189${gcmd} asset send -f " $SMALL " -t " $USER " -a " 1000" --assetid " $ASSETID " --clawback " $USER " && exit 1
191190
192191USER2=$( ${gcmd} account new | awk ' { print $6 }' ) # new account
193- ${gcmd} clerk send -a 1000000 -f " $ACCOUNT " -t " $USER2 " # fund account
192+ ${gcmd} clerk send -a 999000 -f " $ACCOUNT " -t " $USER2 " # fund account
194193asset-optin -f " $USER2 " -t " $USER2 " --assetid " $ASSETID " # opt in to asset
195194# set $APPACCT as clawback address on asset
196195${gcmd} asset config --manager $SMALL --assetid $ASSETID --new-clawback $APPACCT
0 commit comments