diff --git a/README.md b/README.md index 972079c3..b721ecff 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ The deployment scripts are found under `scripts/deployment/`. The following is t ```bash . ├── deploy_env -│   ├── base.env +│   ├── base_env.sh │   ├── chain_env.sh │   ├── mainnets │   │   ├── chihuahua.env diff --git a/scripts/deployment/deploy_env/base.env b/scripts/deployment/deploy_env/base.env deleted file mode 100644 index 1d27ba9e..00000000 --- a/scripts/deployment/deploy_env/base.env +++ /dev/null @@ -1,9 +0,0 @@ -if [ -n "$ZSH_VERSION" ]; then - # Using an array for TXFLAG - TXFLAG=(--node $RPC --chain-id $CHAIN_ID --gas-prices 0.15$DENOM --gas auto --gas-adjustment 1.2 -y -b sync --output json) -else - # Using a string for TXFLAG - TXFLAG="--node $RPC --chain-id $CHAIN_ID --gas-prices 0.15$DENOM --gas auto --gas-adjustment 1.2 -y -b sync --output json" -fi - -export TXFLAG diff --git a/scripts/deployment/deploy_env/base_chihuahua.env b/scripts/deployment/deploy_env/base_chihuahua.env deleted file mode 100644 index 597a7585..00000000 --- a/scripts/deployment/deploy_env/base_chihuahua.env +++ /dev/null @@ -1,9 +0,0 @@ -if [ -n "$ZSH_VERSION" ]; then - # Using an array for TXFLAG - TXFLAG=(--node $RPC --chain-id $CHAIN_ID --gas-prices 1$DENOM --gas auto --gas-adjustment 1.3 -y -b block --output json) -else - # Using a string for TXFLAG - TXFLAG="--node $RPC --chain-id $CHAIN_ID --gas-prices 1$DENOM --gas auto --gas-adjustment 1.3 -y -b block --output json" -fi - -export TXFLAG diff --git a/scripts/deployment/deploy_env/base_env.sh b/scripts/deployment/deploy_env/base_env.sh new file mode 100755 index 00000000..9da944e7 --- /dev/null +++ b/scripts/deployment/deploy_env/base_env.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +## Loads the base env for a given chain. i.e. the TXFLAG variable. + +b_flag=sync +output_flag=json + +case $chain in + +local | juno | juno-testnet | terra | terra-testnet | archway-testnet | comdex | comdex-testnet | sei | sei-testnet | stargaze-testnet | osmosis | osmosis-testnet | orai) + if [ -n "$ZSH_VERSION" ]; then + # Using an array for TXFLAG + TXFLAG=(--node $RPC --chain-id $CHAIN_ID --gas-prices 0.15$DENOM --gas auto --gas-adjustment 1.2 -y -b $b_flag --output $output_flag) + else + # Using a string for TXFLAG + TXFLAG="--node $RPC --chain-id $CHAIN_ID --gas-prices 0.15$DENOM --gas auto --gas-adjustment 1.2 -y -b $b_flag --output $output_flag" + fi + ;; + +chihuahua | migaloo | migaloo-testnet) + if [ -n "$ZSH_VERSION" ]; then + # Using an array for TXFLAG + TXFLAG=(--node $RPC --chain-id $CHAIN_ID --gas-prices 1$DENOM --gas auto --gas-adjustment 1.2 -y -b $b_flag --output $output_flag) + else + # Using a string for TXFLAG + TXFLAG="--node $RPC --chain-id $CHAIN_ID --gas-prices 1$DENOM --gas auto --gas-adjustment 1.2 -y -b $b_flag --output $output_flag" + fi + ;; + +injective | injective-testnet) + if [ -n "$ZSH_VERSION" ]; then + # Using an array for TXFLAG + TXFLAG=(--node $RPC --chain-id $CHAIN_ID --gas-prices=500000000inj --gas 10000000 -y -b $b_flag --output $output_flag) + else + # Using a string for TXFLAG + TXFLAG="--node $RPC --chain-id $CHAIN_ID --gas-prices=500000000inj --gas 10000000 -y -b $b_flag --output $output_flag" + fi + ;; + +*) + echo "Network $chain not defined" + return 1 + ;; +esac + +export TXFLAG diff --git a/scripts/deployment/deploy_env/base_injective.env b/scripts/deployment/deploy_env/base_injective.env deleted file mode 100644 index a0d02355..00000000 --- a/scripts/deployment/deploy_env/base_injective.env +++ /dev/null @@ -1,9 +0,0 @@ -if [ -n "$ZSH_VERSION" ]; then - # Using an array for TXFLAG - TXFLAG=(--node $RPC --chain-id $CHAIN_ID --gas-prices=500000000inj --gas 10000000 -y -b sync --output json) -else - # Using a string for TXFLAG - TXFLAG="--node $RPC --chain-id $CHAIN_ID --gas-prices=500000000inj --gas 10000000 -y -b sync --output json" -fi - -export TXFLAG diff --git a/scripts/deployment/deploy_env/base_migaloo.env b/scripts/deployment/deploy_env/base_migaloo.env deleted file mode 100644 index d06863a5..00000000 --- a/scripts/deployment/deploy_env/base_migaloo.env +++ /dev/null @@ -1,9 +0,0 @@ -if [ -n "$ZSH_VERSION" ]; then - # Using an array for TXFLAG - TXFLAG=(--node $RPC --chain-id $CHAIN_ID --gas-prices 1$DENOM --gas auto --gas-adjustment 1.3 -y -b sync --output json) -else - # Using a string for TXFLAG - TXFLAG="--node $RPC --chain-id $CHAIN_ID --gas-prices 1$DENOM --gas auto --gas-adjustment 1.3 -y -b sync --output json" -fi - -export TXFLAG diff --git a/scripts/deployment/deploy_env/chain_env.sh b/scripts/deployment/deploy_env/chain_env.sh index cf4edcf8..c75f7c12 100755 --- a/scripts/deployment/deploy_env/chain_env.sh +++ b/scripts/deployment/deploy_env/chain_env.sh @@ -12,92 +12,13 @@ function init_chain_env() { exit 1 fi - case $chain in - - local) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/testnets/local.env) - ;; - - juno) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/mainnets/juno.env) - ;; - - juno-testnet) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/testnets/juno.env) - ;; - - terra) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/mainnets/terra.env) - ;; - - terra-testnet) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/testnets/terra.env) - ;; - - archway-testnet) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/testnets/archway.env) - ;; - - chihuahua) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/mainnets/chihuahua.env) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/base_chihuahua.env) - ;; - - injective) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/mainnets/injective.env) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/base_injective.env) - ;; - - injective-testnet) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/testnets/injective.env) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/base_injective.env) - ;; - - comdex) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/mainnets/comdex.env) - ;; - - comdex-testnet) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/testnets/comdex.env) - ;; - - sei-testnet) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/testnets/sei.env) - ;; - - stargaze-testnet) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/testnets/stargaze.env) - ;; - - migaloo) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/mainnets/migaloo.env) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/base_migaloo.env) - ;; - - migaloo-testnet) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/testnets/migaloo.env) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/base_migaloo.env) - ;; - - osmosis) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/mainnets/osmosis.env) - ;; - - osmosis-testnet) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/testnets/osmosis.env) - ;; - - orai) - source <(cat "$project_root_path"/scripts/deployment/deploy_env/mainnets/orai.env) - ;; - - *) - echo "Network $chain not defined" - return 1 - ;; - esac - - if [[ $chain != "chihuahua" && $chain != "injective" && $chain != "injective-testnet" && $chain != "migaloo" && $chain != "migaloo-testnet" ]]; then - source <(cat "$project_root_path"/scripts/deployment/deploy_env/base.env) + if [[ "$(echo ${chain##*-})" = "testnet" ]] || [[ "$chain" = "local" ]]; then + chain="${chain%-testnet}" + source <(cat "$project_root_path"/scripts/deployment/deploy_env/testnets/"$chain".env) + else + source <(cat "$project_root_path"/scripts/deployment/deploy_env/mainnets/"$chain".env) fi + + # load the base env, i.e. the TXFLAG + source "$project_root_path"/scripts/deployment/deploy_env/base_env.sh $chain } diff --git a/scripts/deployment/deploy_env/mainnets/sei.env b/scripts/deployment/deploy_env/mainnets/sei.env new file mode 100644 index 00000000..51006677 --- /dev/null +++ b/scripts/deployment/deploy_env/mainnets/sei.env @@ -0,0 +1,4 @@ +export CHAIN_ID="sei" +export DENOM="usei" +export BINARY="seid" +export RPC="https://sei-rpc.polkachu.com:443"