Skip to content

Commit

Permalink
feat: add store wasm code
Browse files Browse the repository at this point in the history
  • Loading branch information
kienn6034 committed Apr 27, 2024
1 parent 0c3cc5e commit 0572b2d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
35 changes: 35 additions & 0 deletions scripts/50/migrate-wasm-code.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
KEY=mykey
DENOM="ppica"
HOME_DIR="mytestnet"
CHAINID="centauri-dev"
BINARY=picad
WASM_CONTRACT_PATH="/Users/kien6034/notional/projects/composable-ibc/target/wasm32-unknown-unknown/release/ics10_grandpa_cw.wasm"

# Create a proposale to store wasm code
$BINARY tx ibc-wasm store-code $WASM_CONTRACT_PATH --title "migrate new contract" --summary "none" --from $KEY --keyring-backend test --home $HOME_DIR --deposit 10000000000${DENOM} --gas 20002152622 --fees 20020166${DENOM} -y

# Fetch proposal id
sleep 6
$BINARY query gov proposals -o json > tmp-proposals.json
PROPOSAL_ID=$(jq -r '.proposals[-1].id' tmp-proposals.json)
echo "Proposal ID is: $PROPOSAL_ID"
rm -rf tmp-proposals.json

# Validator vote yes
$BINARY tx gov vote $PROPOSAL_ID yes --from $KEY --fees 100000${DENOM} --keyring-backend test --home $HOME_DIR --chain-id $CHAINID -y

#Voting time is 20s, check in localnode.sh
sleep 20

# Check the status
$BINARY query gov proposal $PROPOSAL_ID -o json > tmp-proposal.json
STATUS=$(jq -r '.proposal.status' tmp-proposal.json)
echo "Proposal status is: $STATUS"

# Query newly wasm checksums
CHECKSUM=$($BINARY query ibc-wasm checksums -o json | jq -r '.checksums[-1]')



##### Migrate the contract
3 changes: 2 additions & 1 deletion scripts/50/store-wasm-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ $BINARY query gov proposal $PROPOSAL_ID -o json > tmp-proposal.json
STATUS=$(jq -r '.proposal.status' tmp-proposal.json)
echo "Proposal status is: $STATUS"


# Query wasm checksums
$BINARY query ibc-wasm checksums
8 changes: 4 additions & 4 deletions tmp-proposal.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
"no_count": "0",
"no_with_veto_count": "0"
},
"submit_time": "2024-04-26T12:22:31.890494Z",
"deposit_end_time": "2024-04-28T12:22:31.890494Z",
"submit_time": "2024-04-27T09:08:42.330512Z",
"deposit_end_time": "2024-04-29T09:08:42.330512Z",
"total_deposit": [
{
"denom": "ppica",
"amount": "10000000000"
}
],
"voting_start_time": "2024-04-26T12:22:31.890494Z",
"voting_end_time": "2024-04-26T12:22:51.890494Z",
"voting_start_time": "2024-04-27T09:08:42.330512Z",
"voting_end_time": "2024-04-27T09:09:02.330512Z",
"title": "test",
"summary": "none",
"proposer": "pica1hj5fveer5cjtn4wd6wstzugjfdxzl0xpas3hgy"
Expand Down

0 comments on commit 0572b2d

Please sign in to comment.