Skip to content

Commit

Permalink
ci: consolidate base.env files into base_env.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
kerber0x committed Feb 6, 2024
1 parent cc22650 commit a085ae3
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 124 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions scripts/deployment/deploy_env/base.env

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/deployment/deploy_env/base_chihuahua.env

This file was deleted.

46 changes: 46 additions & 0 deletions scripts/deployment/deploy_env/base_env.sh
Original file line number Diff line number Diff line change
@@ -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
9 changes: 0 additions & 9 deletions scripts/deployment/deploy_env/base_injective.env

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/deployment/deploy_env/base_migaloo.env

This file was deleted.

95 changes: 8 additions & 87 deletions scripts/deployment/deploy_env/chain_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 4 additions & 0 deletions scripts/deployment/deploy_env/mainnets/sei.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export CHAIN_ID="sei"
export DENOM="usei"
export BINARY="seid"
export RPC="https://sei-rpc.polkachu.com:443"

0 comments on commit a085ae3

Please sign in to comment.