Skip to content

Commit

Permalink
chore(scripts): Add easy to use deploy script for WASM contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
FranklinWaller committed Jul 10, 2023
1 parent 6a5f938 commit 6454dd6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
DEPLOYER_ADDRESS=cosmos1njge6f3h8huhvnd72whzgyckgdp64q5xnus7k9
CONTRACT_PATH=./scripts/seda_chain_contracts-aarch64.wasm
INITIAL_STATE="{}"
SHOULD_POST_DR=true

CONTRACT_DEPLOY_OUTPUT=$(seda-chaind tx wasm store $CONTRACT_PATH --from $DEPLOYER_ADDRESS --gas-prices 0.1seda --gas auto --gas-adjustment 1.3 -y --output json)
CONTRACT_DEPLOY_TX_HASH=$(echo $CONTRACT_DEPLOY_OUTPUT | jq -r .txhash)

sleep 2;

CONTRACT_DEPLOY_TX_OUTPUT=$(seda-chaind query tx $CONTRACT_DEPLOY_TX_HASH --output json)
CONTRACT_DEPLOY_CODE_ID=$(echo $CONTRACT_DEPLOY_TX_OUTPUT | jq -r '.events[] | select(.type | contains("store_code")).attributes[] | select(.key | contains("code_id")).value')

INSTANTIATE_OUTPUT=$(seda-chaind tx wasm instantiate $CONTRACT_DEPLOY_CODE_ID $INITIAL_STATE --admin="$(seda-chaind keys show $DEPLOYER_ADDRESS -a)" --from $DEPLOYER_ADDRESS --label "local0.1.0" -y --output json)
INSTANTIATE_TX_HASH=$(echo $INSTANTIATE_OUTPUT | jq -r .txhash)

sleep 2;

INSTANTIATE_TX_OUTPUT=$(seda-chaind query tx $INSTANTIATE_TX_HASH --output json)
CONTRACT_ADDRESS=$(echo $INSTANTIATE_TX_OUTPUT | jq -r '.events[] | select(.type | contains("instantiate")).attributes[] | select(.key | contains("_contract_address")).value')

echo $CONTRACT_ADDRESS;

0 comments on commit 6454dd6

Please sign in to comment.