diff --git a/justfile b/justfile index 8f01569f..4eafd2bf 100644 --- a/justfile +++ b/justfile @@ -1,3 +1,8 @@ +# Prints the list of recipes. +default: + @just --list + +# Builds the whole project with the a feature flag if provided. build FEATURE='': #!/usr/bin/env sh echo "-- Building {{FEATURE}} -- \n" @@ -7,9 +12,11 @@ build FEATURE='': cargo build --features {{FEATURE}} fi +# Build all schemas schemas: scripts/build_schemas.sh +# Tests the whole project with the a feature flag if provided. test FEATURE='': #!/usr/bin/env sh if [ -z "{{FEATURE}}" ]; then @@ -18,14 +25,17 @@ test FEATURE='': cargo test --features {{FEATURE}} fi +# Alias to the format recipe. fmt: @just format +# Formats the rust, toml and sh files in the project. format: cargo fmt --all find . -type f -iname "*.toml" -print0 | xargs -0 taplo format find . -type f -name '*.sh' -exec shfmt -w {} \; +# Runs clippy with the a feature flag if provided. lint FEATURE='': #!/usr/bin/env sh if [ -z "{{FEATURE}}" ]; then @@ -34,22 +44,28 @@ lint FEATURE='': cargo clippy --features {{FEATURE}} --all -- -D warnings fi +# Tries to fix clippy issues automatically. lintfix: cargo clippy --fix --allow-staged --allow-dirty --all-features just format +# Checks the whole project with all the feature flags. check-all: cargo check --all-features +# Cargo check. check: cargo check +# Cargo clean and update. refresh: cargo clean && cargo update +# Cargo watch. watch: cargo watch -x lcheck +# Watches tests with the a feature flag if provided. watch-test FEATURE='': #!/usr/bin/env sh if [ -z "{{FEATURE}}" ]; then @@ -58,14 +74,22 @@ watch-test FEATURE='': cargo watch -x "nextest run --features {{FEATURE}}" fi +# Compiles and optimizes the contracts for the specified chain. optimize CHAIN: scripts/build_release.sh -c {{CHAIN}} +# Prints the artifacts versions on the current commit. get-artifacts-versions: scripts/get_artifacts_versions.sh +# Prints the artifacts size. Optimize should be called before. get-artifacts-size: scripts/check_artifacts_size.sh +# Extracts the pools from the given chain. get-pools CHAIN: scripts/deployment/extract_pools.sh -c {{CHAIN}} + +# Installs the env loader locally. +install-env-loader: + scripts/deployment/deploy_env/add_load_chain_env_alias.sh diff --git a/scripts/deployment/deploy_env/add_load_chain_env_alias.sh b/scripts/deployment/deploy_env/add_load_chain_env_alias.sh new file mode 100755 index 00000000..2d336bc0 --- /dev/null +++ b/scripts/deployment/deploy_env/add_load_chain_env_alias.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +project_root_path=$(realpath "$0" | sed 's|\(.*\)/.*|\1|' | cd ../ | pwd) + +# Function definition to append, including the load alias +loadenv_function=" +#cosmos chains env loader +alias load='load_chain_env' +load_chain_env() { + if [ -z \"\$1\" ]; then + echo \"Please specify the chain to load (e.g., migaloo, terra...)\" + else + source "${project_root_path}"/scripts/deployment/deploy_env/chain_env.sh + init_chain_env \"\$1\" + fi +} +" + +# Potential shell configuration files +bashrc="$HOME/.bashrc" +zshrc="$HOME/.zshrc" +profile="$HOME/.profile" + +# Append the function to Bash and Zsh configuration files if they exist +[[ -f "$bashrc" ]] && echo "$loadenv_function" >>"$bashrc" && echo "Added to $bashrc" +[[ -f "$zshrc" ]] && echo "$loadenv_function" >>"$zshrc" && echo "Added to $zshrc" +[[ -f "$profile" ]] && echo "$loadenv_function" >>"$profile" && echo "Added to $profile" + +echo "Now you can load chains env variables by doing 'load ' in your terminal." +echo "To see a list of compatible chains look into chain_env.sh" diff --git a/scripts/deployment/deploy_env/chain_env.sh b/scripts/deployment/deploy_env/chain_env.sh index d076e6d5..cf4edcf8 100755 --- a/scripts/deployment/deploy_env/chain_env.sh +++ b/scripts/deployment/deploy_env/chain_env.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +#set -e project_root_path=$(realpath "$0" | sed 's|\(.*\)/.*|\1|' | cd ../ | pwd) @@ -93,7 +93,7 @@ function init_chain_env() { *) echo "Network $chain not defined" - exit 1 + return 1 ;; esac diff --git a/scripts/deployment/deploy_env/mainnets/terra.env b/scripts/deployment/deploy_env/mainnets/terra.env index b0b68e0f..4cad7b0a 100644 --- a/scripts/deployment/deploy_env/mainnets/terra.env +++ b/scripts/deployment/deploy_env/mainnets/terra.env @@ -2,4 +2,3 @@ export CHAIN_ID="phoenix-1" export DENOM="uluna" export BINARY="terrad" export RPC="https://ww-terra-rpc.polkachu.com:443" -export TXFLAG="--node $RPC --chain-id $CHAIN_ID --gas-prices 0.15$DENOM --gas auto --gas-adjustment 1.3 -y -b block --output json" \ No newline at end of file