From 77ad0d1ed56a57309bf2cc75f2016558f4ff4157 Mon Sep 17 00:00:00 2001 From: kienn6034 Date: Fri, 29 Dec 2023 18:04:48 +0700 Subject: [PATCH] test: adjust gas and fee doing tx token factory --- Makefile | 4 ++++ scripts/tests/tokenfactory/tokenfactory.sh | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 08b55898..c5899436 100644 --- a/Makefile +++ b/Makefile @@ -158,6 +158,10 @@ init-test-framework: clean-testing-data install ./scripts/tests/init-test-framework.sh ./scripts/tests/relayer/interchain-acc-config/rly-init.sh +test-tokenfactory: + @echo "Testing tokenfactory..." + ./scripts/tests/tokenfactory/tokenfactory.sh + clean-testing-data: @echo "Killing terrad and removing previous data" diff --git a/scripts/tests/tokenfactory/tokenfactory.sh b/scripts/tests/tokenfactory/tokenfactory.sh index cc7aa9b6..9e2dc6b8 100755 --- a/scripts/tests/tokenfactory/tokenfactory.sh +++ b/scripts/tests/tokenfactory/tokenfactory.sh @@ -11,12 +11,15 @@ CHAIN_DIR=$(pwd)/data TOKEN_DENOM=utoken$RANDOM MINT_AMOUNT=1000000 +GAS=2000000 +FEES=1000000uwhale + WALLET_1=$($BINARY keys show wallet1 -a --keyring-backend test --home $CHAIN_DIR/test-1) WALLET_2=$($BINARY keys show wallet2 -a --keyring-backend test --home $CHAIN_DIR/test-2) WALLET_3=$($BINARY keys show wallet3 -a --keyring-backend test --home $CHAIN_DIR/test-1) echo "Creating token denom $TOKEN_DENOM with $WALLET_1 on chain test-1" -TX_HASH=$($BINARY tx tokenfactory create-denom $TOKEN_DENOM --from $WALLET_1 --home $CHAIN_DIR/test-1 --chain-id test-1 --node tcp://localhost:16657 --gas 2000000 --keyring-backend test -o json -y | jq -r '.txhash') +TX_HASH=$($BINARY tx tokenfactory create-denom $TOKEN_DENOM --from $WALLET_1 --home $CHAIN_DIR/test-1 --chain-id test-1 --node tcp://localhost:16657 --gas "$GAS" --fees "$FEES" --keyring-backend test -o json -y | jq -r '.txhash') sleep 3 CREATED_RES_DENOM=$($BINARY query tx $TX_HASH -o josn --chain-id test-1 --home $CHAIN_DIR/test-1 --node tcp://localhost:16657 | jq -r '.logs[0].events[5].attributes[1].value') @@ -26,7 +29,7 @@ if [ "$CREATED_RES_DENOM" != "factory/$WALLET_1/$TOKEN_DENOM" ]; then fi echo "Minting $MINT_AMOUNT units of $TOKEN_DENOM with $WALLET_1 on chain test-1" -TX_HASH=$($BINARY tx tokenfactory mint $MINT_AMOUNT$CREATED_RES_DENOM --from $WALLET_1 --home $CHAIN_DIR/test-1 --chain-id test-1 --node tcp://localhost:16657 --keyring-backend test -o json -y | jq -r '.txhash') +TX_HASH=$($BINARY tx tokenfactory mint $MINT_AMOUNT$CREATED_RES_DENOM --from $WALLET_1 --home $CHAIN_DIR/test-1 --chain-id test-1 --node tcp://localhost:16657 --gas "$GAS" --fees "$FEES" --keyring-backend test -o json -y | jq -r '.txhash') sleep 3 MINT_RES=$($BINARY query tx $TX_HASH -o josn --chain-id test-1 --home $CHAIN_DIR/test-1 --node tcp://localhost:16657 | jq -r '.logs[0].events[2].type') if [ "$MINT_RES" != "coinbase" ]; then @@ -42,7 +45,7 @@ if [ "$BALANCE_RES_AMOUNT" != $MINT_AMOUNT ]; then fi echo "Burning 1 $TOKEN_DENOM from $WALLET_1 on chain test-1" -TX_HASH=$($BINARY tx tokenfactory burn 1$CREATED_RES_DENOM --from $WALLET_1 --home $CHAIN_DIR/test-1 --chain-id test-1 --node tcp://localhost:16657 --keyring-backend test -o json -y | jq -r '.txhash') +TX_HASH=$($BINARY tx tokenfactory burn 1$CREATED_RES_DENOM --from $WALLET_1 --home $CHAIN_DIR/test-1 --chain-id test-1 --node tcp://localhost:16657 --gas "$GAS" --fees "$FEES" --keyring-backend test -o json -y | jq -r '.txhash') sleep 3 BURN_RES=$($BINARY query tx $TX_HASH -o josn --chain-id test-1 --home $CHAIN_DIR/test-1 --node tcp://localhost:16657 | jq -r '.logs[0].events[7].type') if [ "$BURN_RES" != "tf_burn" ]; then @@ -58,7 +61,7 @@ if [ "$BALANCES_AFTER_BURNING" != 999999 ]; then fi echo "Sending 1 $TOKEN_DENOM from $WALLET_1 to $WALLET_3 on chain test-1" -TX_HASH=$($BINARY tx bank send $WALLET_1 $WALLET_3 1$CREATED_RES_DENOM --from $WALLET_1 --home $CHAIN_DIR/test-1 --chain-id test-1 --node tcp://localhost:16657 --keyring-backend test -o json -y | jq -r '.txhash') +TX_HASH=$($BINARY tx bank send $WALLET_1 $WALLET_3 1$CREATED_RES_DENOM --from $WALLET_1 --home $CHAIN_DIR/test-1 --chain-id test-1 --node tcp://localhost:16657 --gas "$GAS" --fees "$FEES" --keyring-backend test -o json -y | jq -r '.txhash') sleep 3 SEND_RES_MSG_TYPE=$($BINARY query tx $TX_HASH -o josn --chain-id test-1 --home $CHAIN_DIR/test-1 --node tcp://localhost:16657 | jq -r '.logs[0].events[0].attributes[0].value') if [ "$SEND_RES_MSG_TYPE" != "/cosmos.bank.v1beta1.MsgSend" ]; then @@ -75,7 +78,7 @@ fi echo "IBC'ing 1 $TOKEN_DENOM from $WALLET_1 chain test-1 to $WALLET_2 chain test-2" -TX_HASH=$($BINARY tx ibc-transfer transfer transfer channel-0 $WALLET_2 1$CREATED_RES_DENOM --chain-id test-1 --home $CHAIN_DIR/test-1 --node tcp://localhost:16657 --keyring-backend test --from $WALLET_1 -y -o json | jq -r '.txhash') +TX_HASH=$($BINARY tx ibc-transfer transfer transfer channel-0 $WALLET_2 1$CREATED_RES_DENOM --chain-id test-1 --home $CHAIN_DIR/test-1 --node tcp://localhost:16657 --keyring-backend test --gas "$GAS" --fees "$FEES" --from $WALLET_1 -y -o json | jq -r '.txhash') sleep 3 IBC_SEND_RES=$($BINARY query tx $TX_HASH -o josn --chain-id test-1 --home $CHAIN_DIR/test-1 --node tcp://localhost:16657 | jq -r '.logs[0].events[0].attributes[0].value') if [ "$IBC_SEND_RES" != "/ibc.applications.transfer.v1.MsgTransfer" ]; then