-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18c9e0e
commit 63bed2b
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
KEYRING_PASSWORD=your_password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,5 @@ | |
|
||
# optimization artifacts | ||
artifacts/ | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|