Skip to content

Commit

Permalink
Fix: Broken local scripts (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitys7 authored Mar 14, 2024
1 parent 9829d4a commit e452396
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 24 deletions.
11 changes: 1 addition & 10 deletions scripts/ibc/setup_ibc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,12 @@ echo "From within the rollapp node: \"$EXECUTABLE tx bank send $KEY_NAME_ROLLAPP
echo '# -------------------------------- creating IBC link ------------------------------- #'

rly paths new "$ROLLAPP_CHAIN_ID" "$SETTLEMENT_CHAIN_ID" "$RELAYER_PATH" --src-port "$IBC_PORT" --dst-port "$IBC_PORT" --version "$IBC_VERSION"
rly tx client "$SETTLEMENT_CHAIN_ID" "$ROLLAPP_CHAIN_ID" "$RELAYER_PATH"
rly tx client "$ROLLAPP_CHAIN_ID" "$SETTLEMENT_CHAIN_ID" "$RELAYER_PATH"
while true; do
rly tx update-clients "$RELAYER_PATH" | tee /dev/stdout
sleep 5
done &
UPDATE_CLIENTS_PID=$!


rly tx link "$RELAYER_PATH" --src-port "$IBC_PORT" --dst-port "$IBC_PORT" --version "$IBC_VERSION"
# Channel is currently not created in the tx link since we changed the relayer to support on demand blocks
# Which messed up with channel creation as part of tx link.

kill $UPDATE_CLIENTS_PID > /dev/null 2>&1

sleep 5

echo '# -------------------------------- IBC channel established ------------------------------- #'
echo "ROLLAPP_CHANNEL: $(rly q channels "$ROLLAPP_CHAIN_ID")"
Expand Down
17 changes: 8 additions & 9 deletions scripts/wasm/deploy_contract.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,18 @@ INIT_CW20=$(cat <<EOF
}
EOF
)
rollappd tx wasm instantiate $CW20_CODE_ID $INIT_CW20 --label test --no-admin --from $ROLLAPP_KEY_NAME_GENESIS --yes

rollappd tx wasm instantiate $CW20_CODE_ID "$INIT_CW20" --label test --no-admin --from $ROLLAPP_KEY_NAME_GENESIS --yes
sleep 2
CW20_ADDR=$(rollappd q wasm list-contract-by-code $CW20_CODE_ID --output json | jq -r '.contracts[0]' )

echo "Token contract deployed at: $contract"
echo "Token contract deployed at: $CW20_ADDR"

# Query rol-user balances
QUERY_MSG=$(cat <<EOF
{"balance":{"address":"$ROLLAPP_GENESIS_ADDR"}}
EOF
)
balance=$(rollappd q wasm contract-state smart $contract $QUERY_MSG | grep "balance:" | cut -d' ' -f4 | tr -d '"')

echo "User $ROLLAPP_GENESIS_ADDR has balance $balance for contract $contract"
balance=$(rollappd q wasm contract-state smart $CW20_ADDR "$QUERY_MSG" | grep "balance:" | cut -d' ' -f4 | tr -d '"')
echo "User $ROLLAPP_GENESIS_ADDR has balance $balance for contract $CW20_ADDR"


# Store code for ics20 contract
Expand All @@ -54,10 +52,11 @@ INIT_ICS20=$(cat <<EOF
}
EOF
)
rollappd tx wasm instantiate $ICS20_CODE_ID $INIT_ICS20 --label ics20 --no-admin --from rol-user --gas 50000000 --yes
rollappd tx wasm instantiate $ICS20_CODE_ID "$INIT_ICS20" --label ics20 --no-admin --from rol-user --gas 50000000 --yes
sleep 2
ICS20_ADDR=$(rollappd q wasm list-contract-by-code $ICS20_CODE_ID --output json | jq -r '.contracts[0]' )

echo "ICS20 contract deployed at: $contract"
echo "ICS20 contract deployed at: $ICS20_ADDR"

# Query rol-user balances
# rollappd q wasm contract-state smart $contract '{"balance":{"address":"rol1h9htcc6hntfh02x5jrtkya6f3vzcycu27zm3um"}}'
17 changes: 12 additions & 5 deletions scripts/wasm/ibc_transfer.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ SETTLEMENT_KEY_NAME_GENESIS="local-user"
SETTLEMENT_GENESIS_ADDR="$(dymd keys show $SETTLEMENT_KEY_NAME_GENESIS | grep "address:" | cut -d' ' -f3)"
SETTLEMENT_CHAIN_ID="dymension_100-1"

<<<<<<< HEAD
ICS20_CODE_ID="$(rollappd q wasm list-code | grep "code_id:" | tail -n 1 | cut -d' ' -f3 | tr -d '"')"
CW20_CODE_ID=$((ICS20_CODE_ID - 1))
CW20_ADDR=$(rollappd q wasm list-contract-by-code $CW20_CODE_ID --output json | jq -r '.contracts[0]' )
ICS20_ADDR=$(rollappd q wasm list-contract-by-code $ICS20_CODE_ID --output json | jq -r '.contracts[0]' )
=======
CW20_ADDR=$(rollappd q wasm list-contract-by-code 1 --output json | jq -r '.contracts[0]' )
ICS20_ADDR=$(rollappd q wasm list-contract-by-code 2 --output json | jq -r '.contracts[0]' )
>>>>>>> main

ICS20_PATH="ics20-hub"
version=ics20-1
Expand Down Expand Up @@ -44,22 +51,22 @@ SEND_MSG=$(cat <<EOF
EOF
)

rollappd tx wasm execute $CW20_ADDR $SEND_MSG --from rol-user --gas 50000000 --yes
rollappd tx wasm execute $CW20_ADDR "$SEND_MSG" --from rol-user --gas 50000000 --yes
sleep 5

#query balance
QUERY_MSG=$(cat <<EOF
{"balance":{"address":"$ROLLAPP_GENESIS_ADDR"}}
EOF
)
rollappd q wasm contract-state smart $contract $QUERY_MSG
rollappd q wasm contract-state smart $contract "$QUERY_MSG"

# balance of the hub will not change yet, we need to start relayer to make it work
dymd q bank balance $SETTLEMENT_GENESIS_ADDR
dymd q bank balances $SETTLEMENT_GENESIS_ADDR

# start relayer
rly start
sleep 20
sleep 10

# check the balance in hub again
dymd q bank balance $SETTLEMENT_GENESIS_ADDR
dymd q bank balances $SETTLEMENT_GENESIS_ADDR

0 comments on commit e452396

Please sign in to comment.