Skip to content

Commit

Permalink
Add scripts for deploying to testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
tasiov committed Aug 24, 2023
1 parent 7abd640 commit 19ed71a
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
52 changes: 52 additions & 0 deletions scripts/testnet/instantiate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
MSG=$(cat <<EOF
{
"fair_burn": "stars177jd3r8aul2dgt9pj77x8zem3au46ee2cj4srxwqdw4lkpd7tsqquz2r2d",
"royalty_registry": "stars1crgx0f70fzksa57hq87wtl8f04h0qyk5la0hk0fu8dyhl67ju80qaxzr5z",
"marketplace": "stars18cszlvm6pze0x9sz32qnjq4vtd45xehqs8dq7cwy8yhq35wfnn3qgzs5gu",
"pair_creation_fee": {
"denom": "ustars",
"amount": "1000000"
},
"fair_burn_fee_percent": "0.01",
"max_royalty_fee_percent": "0.05",
"max_swap_fee_percent": "0.1",
"code_ids": {
"infinity_factory": 2894,
"infinity_global": 2895,
"infinity_index": 2896,
"infinity_pair": 2897,
"infinity_router": 2898
},
"min_prices":[
{
"denom": "ustars",
"amount": "1000000"
}
]
}
EOF
)

CODE_ID=2893

LABEL="Infinity Builder"

ADMIN="stars19mmkdpvem2xvrddt8nukf5kfpjwfslrsu7ugt5"
FROM="hot-wallet"

CHAIN_ID="elgafar-1"
NODE="https://rpc.elgafar-1.stargaze-apis.com:443"

starsd tx wasm instantiate $CODE_ID "$MSG" \
--label "$LABEL" \
--admin "$ADMIN" \
--from "$FROM" \
--keyring-backend test \
--chain-id "$CHAIN_ID" \
--node "$NODE" \
--gas-prices 0.1ustars \
--gas-adjustment 1.7 \
--gas auto \
-b block \
-o json | jq .
55 changes: 55 additions & 0 deletions scripts/testnet/wasm-store.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

# This script is used to download infinity wasm files from github
# and store them on Stargaze testnet.

VERSION=v0.1.0

CONTRACTS=(
"infinity_builder"
"infinity_factory"
"infinity_global"
"infinity_index"
"infinity_pair"
"infinity_router"
)

FROM="hot-wallet"
CHAIN_ID="elgafar-1"
NODE="https://rpc.elgafar-1.stargaze-apis.com:443"

for contract in "${CONTRACTS[@]}"; do
contract_tmp=$(echo $contract | tr '_' '-')

# If file exists then skip
if [ -f "./artifacts/${contract}.wasm" ]; then
echo "Skipping ${contract}.wasm"
continue
fi

url=https://github.com/tasiov/infinity-swap/releases/download/${VERSION}/${contract}.wasm
echo "Downloading $url"
response_code=$(curl -L --output "./artifacts/${contract}.wasm" --write-out "%{http_code}" "${url}")

# Check if the download was successful
if [ "$response_code" -ne 200 ]; then
echo "Error downloading ${contract}.wasm. HTTP status code: ${response_code}"
rm "./artifacts/${contract}.wasm"
exit 1
fi
done

echo "Uploading wasm files to Stargaze testnet"

for contract in "${CONTRACTS[@]}"; do
starsd tx wasm store artifacts/${contract}.wasm \
--from $FROM \
--chain-id "$CHAIN_ID" \
--node "$NODE" \
--keyring-backend test \
--gas-prices 0.1ustars \
--gas-adjustment 1.7 \
--gas auto \
-b block \
-y
done

0 comments on commit 19ed71a

Please sign in to comment.