Skip to content

Commit

Permalink
add deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
TropicalDog17 committed Nov 25, 2023
1 parent 18c9e0e commit 63bed2b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
KEYRING_PASSWORD=your_password
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@

# optimization artifacts
artifacts/

.env
28 changes: 28 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
source .env

NODE="https://testnet.sentry.tm.injective.network:443"
USER="tuan_inj"
echo "Deploying LQ Express Smart Contract to Injective Chain"
TXID=$(yes $KEYRING_PASSWORD | injectived tx wasm store artifacts/lq_express_sm.wasm --from=$USER --chain-id="injective-888" --yes --gas-prices=500000000inj --gas=20000000 --node=$(echo $NODE) --output json | jq -r '.txhash')
echo "Transaction ID: $TXID"
# Wait for the transaction to be included in a block
echo "Waiting for the transaction to be included in a block"
sleep 10
RES=$(injectived q tx $TXID --node=$(echo $NODE) --output json)
echo "Response: $RES"
# The following is an easier way to get the Code Id from the response:
CODE_ID=$(injectived q tx $TXID --node=$(echo $NODE) --output json \
| jq -r '.logs[0].events[-1].attributes[-2].value' | tr -d '"' )
# Instantiate the contract
echo "Code ID: $CODE_ID"
echo "Instantiating LQ Express Smart Contract"
# Prepare the instantiation message
INIT='{}'
yes $KEYRING_PASSWORD | injectived tx wasm instantiate $CODE_ID $INIT --from=$USER --chain-id="injective-888" --label="lq_express" --yes --gas-prices=500000000inj --gas=20000000 --node=$(echo $NODE) --admin $(yes $KEYRING_PASSWORD | injectived keys show $USER -a)
# Get the contract address
echo "Getting the contract address"
injectived query wasm list-contract-by-code $CODE_ID --node $NODE --output json
CONTRACT=$(injectived query wasm list-contract-by-code $CODE_ID --node $NODE --output json | jq -r '.contracts[-1]')
echo "Contract address: $CONTRACT"

0 comments on commit 63bed2b

Please sign in to comment.