Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
feat: disable force transfer & add cw bindings tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ducphamle2 committed Jul 6, 2024
1 parent 074638d commit 4342df9
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion orai/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ var (
EnableSpecificProposals = ""
EnabledCapabilities = []string{
tokenfactorytypes.EnableBurnFrom,
tokenfactorytypes.EnableForceTransfer,
// tokenfactorytypes.EnableForceTransfer,
tokenfactorytypes.EnableSetMetadata,
}
)
Expand Down
1 change: 1 addition & 0 deletions orai/scripts/e2e-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,6 @@ sh $PWD/scripts/test-erc20-deploy.sh
# test gasless
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.1/test-gasless.sh
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.1/test-tokenfactory.sh
NODE_HOME=$VALIDATOR_HOME USER=validator1 sh $PWD/scripts/tests-0.42.1/test-tokenfactory-bindings.sh

echo "Tests Passed!!"
3 changes: 2 additions & 1 deletion orai/scripts/tests-0.42.1/local-node-gasless-tokenfactory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ screen -S test-gasless -d -m oraid start --json-rpc.address="0.0.0.0:8545" --jso
sleep 2

sh $PWD/scripts/tests-0.42.1/test-gasless.sh
sh $PWD/scripts/tests-0.42.1/test-tokenfactory.sh
sh $PWD/scripts/tests-0.42.1/test-tokenfactory.sh
sh $PWD/scripts/tests-0.42.1/test-tokenfactory-bindings.sh
39 changes: 39 additions & 0 deletions orai/scripts/tests-0.42.1/test-tokenfactory-bindings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

set -eu

CHAIN_ID=${CHAIN_ID:-testing}
USER=${USER:-tupt}
NODE_HOME=${NODE_HOME:-"$PWD/.oraid"}
WASM_PATH=${WASM_PATH:-"$PWD/scripts/wasm_file/tokenfactory.wasm"}
ARGS="--from $USER --chain-id testing -y --keyring-backend test --fees 200orai --gas auto --gas-adjustment 1.5 -b block --home $NODE_HOME"
user_address=$(oraid keys show $USER --keyring-backend test --home $NODE_HOME -a)

# deploy cw-bindings contract
store_ret=$(oraid tx wasm store $WASM_PATH $ARGS --output json)
code_id=$(echo $store_ret | jq -r '.logs[0].events[1].attributes[] | select(.key | contains("code_id")).value')
oraid tx wasm instantiate $code_id '{}' --label 'tokenfactory cw bindings testing' --admin $user_address $ARGS
contract_address=$(oraid query wasm list-contract-by-code $code_id --output json | jq -r '.contracts[0]')
echo $contract_address

subdenom="usdc"
CREATE_DENOM_MSG='{"create_denom":{"subdenom":"'"$subdenom"'"}}'
QUERY_DENOM_MSG='{"get_denom":{"creator_address":"'"$user_address"'","subdenom":"'"$subdenom"'"}}'

echo "create denom msg: $CREATE_DENOM_MSG"
echo "query denom msg: $QUERY_DENOM_MSG"

# send to the contract some funds to create denom
oraid tx send $user_address $contract_address 100000000orai $ARGS

# create denom
oraid tx wasm execute $contract_address $CREATE_DENOM_MSG $ARGS --output json | jq '.gas_used | tonumber'

# query created denom
created_denom=$(oraid query wasm contract-state smart $contract_address $QUERY_DENOM_MSG --output json | jq '.data.denom' | tr -d '"')

if ! [[ $created_denom =~ "factory/$user_address/$subdenom" ]] ; then
echo "The created denom does not match with our expected denom"; exit 1
fi

echo "Tokenfactory cw binding tests passed!"
Binary file modified orai/scripts/wasm_file/tokenfactory.wasm
Binary file not shown.

0 comments on commit 4342df9

Please sign in to comment.