Skip to content

Commit

Permalink
ibc fee test
Browse files Browse the repository at this point in the history
  • Loading branch information
dasanchez committed Apr 22, 2024
1 parent 76eeff1 commit fa360ce
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/gaia-v16/test_ibc_fee.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
#!/bin/bash

ACK_FEE=456
balance_before=$($CHAIN_BINARY q bank balances $WALLET_RELAYER --home $HOME_1 -o json | jq -r --arg DENOM "$DENOM" '.balances[] | select(.denom == $DENOM).amount')


$RELAYER --json create channel --order unordered --a-chain $CHAIN_ID --a-port transfer --b-port transfer --a-connection connection-0 --channel-version "{\"fee_version\":\"ics29-1\",\"app_version\":\"ics20-1\"}"

txhash=$($CHAIN_BINARY tx ibc-transfer transfer transfer channel-0 $WALLET_1 1$DENOM --gas $GAS --gas-prices $GAS_PRICE$DENOM --gas-adjustment $GAS_ADJUSTMENT --from $WALLET_1 --output json -y --home $HOME_1 | jq -r '.txhash')
sleep $COMMIT_TIMEOUT
sequence=$($CHAIN_BINARY q tx $txhash --home $HOME_1 -o json | jq -r '.events[] | select(.type == "send_packet").attributes[] | select(.key == "packet_sequence").value')
$CHAIN_BINARY tx ibc-fee pay-packet-fee transfer channel-0 $sequence --recv-fee 123uatom --ack-fee 456uatom --timeout-fee 789uatom --from $WALLET_1 --gas $GAS --gas-prices $GAS_PRICE$DENOM --gas-adjustment $GAS_ADJUSTMENT --home $HOME_1 -y
$CHAIN_BINARY tx ibc-fee pay-packet-fee transfer channel-0 $sequence --recv-fee 123$DENOM --ack-fee ${ACK_FEE}$DENOM --timeout-fee 789$DENOM --from $WALLET_1 --gas $GAS --gas-prices $GAS_PRICE$DENOM --gas-adjustment $GAS_ADJUSTMENT --home $HOME_1 -y

sleep 30
balance_after=$($CHAIN_BINARY q bank balances $WALLET_RELAYER --home $HOME_1 -o json | jq -r --arg DENOM "$DENOM" '.balances[] | select(.denom == $DENOM).amount')

difference=$(echo "$balance_after - $balance_before" | bc)
echo "Difference: ${difference}$DENOM"
echo "Difference: ${difference}$DENOM"

if [ $difference == $ACK_FEE ]; then
echo "PASS: Relayer balance increased by the ACK FEE."
else
echo "FAIL: Relayer balance did not increase by the ACK FEE."
exit 1
fi

0 comments on commit fa360ce

Please sign in to comment.