Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration flags #139

Merged
merged 4 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 85 additions & 8 deletions scripts/add-new-dex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,20 @@ CHAIN_ID=""
CHAIN_IP_ADDR_RPC=""
CHAIN_IP_ADDR_GRPC=""
CHAIN_ACCOUNT_PREFIX=""
CHAIN_PRICE_DENOM=""
CHAIN_TRUSTING_PERIOD=""
CHAIN_GAS_PRICE_DENOM=""
CHAIN_TRUSTING_PERIOD_SECS=""

CHAIN_RPC_TIMEOUT_SECS="10"
CHAIN_DEFAULT_GAS="5000000"
CHAIN_MAX_GAS="15000000"
CHAIN_GAS_PRICE_PRICE="0.056"
CHAIN_GAS_MULTIPLIER="1.3"
CHAIN_MAX_MSG_NUM="20"
CHAIN_MAX_TX_SIZE="209715"
CHAIN_CLOCK_DRIFT_SECS="20"
CHAIN_MAX_BLOCK_TIME_SECS="10"
CHAIN_TRUST_THRESHOLD_NUMERATOR="2"
CHAIN_TRUST_THRESHOLD_DENOMINATOR="3"
IF_INTERCHAIN_SECURITY="true"

source "$NOLUS_MONEY_MARKET_DIR/scripts/deploy-platform.sh"
Expand Down Expand Up @@ -67,6 +79,18 @@ while [[ $# -gt 0 ]]; do
[--dex-price-denom <new_dex_price_denom>]
[--dex-trusting-period-secs <new_dex_trusting_period_in_seconds>]
[--dex-if-interchain-security <new_dex_if_interchain_security_true/false>]
[--dex-rpc-timeout-secs <dex_rpc_timeout_in_seconds>]
[--dex-default-gas <dex_default_gas>]
[--dex-max-gas <dex_max_gas>]
[--dex-gas-price-price <dex_gas_price_price>]
[--dex-gas-multiplier <dex_gas_multiplier>]
[--dex-max-msg-num <dex_max_msg_num>]
[--dex-max-tx-size <dex_max_tx_size>]
[--dex-clock-drift-secs <dex_clock_drift_in_seconds>]
[--dex-max-block-time-secs <dex_max_block_time_in_seconds>]
[--dex-trusting-period-secs <dex_trusting_period_in_seconds>]
[--dex-trust-threshold-numerator <dex_trust_threshold_numerator>]
[--dex-trust-threshold-denominator <dex_trust_threshold_denominator>]
[--protocol-currency <new_protocol_currency>]
[--stable-currency <new_protocol_stable_currency>]
[--admin-contract-address <admin_contract_address>]
Expand Down Expand Up @@ -162,13 +186,63 @@ while [[ $# -gt 0 ]]; do
shift 2
;;

--dex-price-denom)
CHAIN_PRICE_DENOM="$2"
--dex-gas-price-denom)
CHAIN_GAS_PRICE_DENOM="$2"
shift 2
;;

--dex-trusting-period-secs)
CHAIN_TRUSTING_PERIOD="$2"
CHAIN_TRUSTING_PERIOD_SECS="$2"
shift 2
;;

--dex-rpc-timeout-secs)
CHAIN_RPC_TIMEOUT_SECS="$2"
shift 2
;;

--dex-default-gas)
CHAIN_DEFAULT_GAS="$2"
shift 2
;;

--dex-max-gas)
CHAIN_MAX_GAS="$2"
shift 2
;;

--dex-gas-multiplier)
CHAIN_GAS_MULTIPLIER="$2"
shift 2
;;

--dex-max-msg-num)
CHAIN_MAX_MSG_NUM="$2"
shift 2
;;

--dex-max-tx-size)
CHAIN_MAX_TX_SIZE="$2"
shift 2
;;

--dex-clock-drift-secs)
CHAIN_CLOCK_DRIFT_SECS="$2"
shift 2
;;

--dex-max-block-time-secs)
CHAIN_MAX_BLOCK_TIME_SECS="$2"
shift 2
;;

--dex-trust-threshold-numerator)
CHAIN_TRUST_THRESHOLD_NUMERATOR="$2"
shift 2
;;

--dex-trust-threshold-denominator)
CHAIN_TRUST_THRESHOLD_DENOMINATOR="$2"
shift 2
;;

Expand Down Expand Up @@ -230,8 +304,8 @@ verify_mandatory "$CHAIN_ID" "new DEX chain_id"
verify_mandatory "$CHAIN_IP_ADDR_RPC" "new DEX RPC addr - fully host part"
verify_mandatory "$CHAIN_IP_ADDR_GRPC" "new DEX gRPC addr - fully host part"
verify_mandatory "$CHAIN_ACCOUNT_PREFIX" "new DEX account prefix"
verify_mandatory "$CHAIN_PRICE_DENOM" "new DEX price denom"
verify_mandatory "$CHAIN_TRUSTING_PERIOD" "new DEX trusting period"
verify_mandatory "$CHAIN_GAS_PRICE_DENOM" "new DEX gas price denom"
verify_mandatory "$CHAIN_TRUSTING_PERIOD_SECS" "new DEX trusting period"
verify_mandatory "$PROTOCOL_CURRENCY" "new protocol lpn"
verify_mandatory "$STABLE_CURRENCY" "new protocol stable currency"
verify_mandatory "$SWAP_TREE" "new protocol swap_tree"
Expand All @@ -246,7 +320,10 @@ source "$DEPLOY_CONTRACTS_SCRIPT"

# Extend the existing Hermes configuration
add_new_chain_hermes "$HERMES_CONFIG_DIR_PATH" "$CHAIN_ID" "$CHAIN_IP_ADDR_RPC" "$CHAIN_IP_ADDR_GRPC" \
"$CHAIN_ACCOUNT_PREFIX" "$CHAIN_PRICE_DENOM" "$CHAIN_TRUSTING_PERIOD" "$IF_INTERCHAIN_SECURITY"
"$CHAIN_RPC_TIMEOUT_SECS" "$CHAIN_ACCOUNT_PREFIX" "$CHAIN_DEFAULT_GAS" "$CHAIN_MAX_GAS" "$CHAIN_GAS_PRICE_PRICE" \
"$CHAIN_GAS_PRICE_DENOM" "$CHAIN_GAS_MULTIPLIER" "$CHAIN_MAX_MSG_NUM" "$CHAIN_MAX_TX_SIZE" \
"$CHAIN_CLOCK_DRIFT_SECS" "$CHAIN_MAX_BLOCK_TIME_SECS" "$CHAIN_TRUSTING_PERIOD_SECS" \
"$CHAIN_TRUST_THRESHOLD_NUMERATOR" "$CHAIN_TRUST_THRESHOLD_DENOMINATOR" "$IF_INTERCHAIN_SECURITY"

# Link the Hermes account to the DEX
dex_account_setup "$HERMES_BINARY_DIR_PATH" "$CHAIN_ID" "$HERMES_CONFIG_DIR_PATH"/hermes.seed
Expand Down
17 changes: 17 additions & 0 deletions scripts/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ __print_usage() {
[--validator-tokens <validators_initial_tokens>]
[--validator-stake <tokens_validator_stakes>]
[--gov-voting-period <voting_period>]
[--gov-max-deposit-period <max_deposit_period - XXs>]
[--staking-max-validators <staking_max_validators>]
[--feerefunder-ack-fee-min <feerefunder_ack_fee_min_amount>]
[--feerefunder-timeout-fee-min <feerefunder_timeout_fee_min_amount>]
[--dex-admin-mnemonic <dex_admin_account_mnemonic>]
Expand All @@ -47,6 +49,8 @@ VAL_TOKENS="1000000000""$NATIVE_CURRENCY"
VAL_STAKE="1000000""$NATIVE_CURRENCY"
OUTPUT_FILE=""
GOV_VOTING_PERIOD="43200s"
GOV_MAX_DEPOSIT_PERIOD="43200s"
STAKING_MAX_VALIDATORS="40"
FEEREFUNDER_ACK_FEE_MIN="1"
FEEREFUNDER_TIMEOUT_FEE_MIN="1"
DEX_ADMIN_MNEMONIC=""
Expand Down Expand Up @@ -137,6 +141,18 @@ while [[ $# -gt 0 ]]; do
shift
;;

--gov-max-deposit-period)
GOV_MAX_DEPOSIT_PERIOD="$2"
shift
shift
;;

--staking-max-validators)
STAKING_MAX_VALIDATORS="$2"
shift
shift
;;

--feerefunder-ack-fee-min)
FEEREFUNDER_ACK_FEE_MIN="$2"
shift
Expand Down Expand Up @@ -190,6 +206,7 @@ if [[ "$COMMAND" == "$COMMAND_FULL_GEN" ]]; then
"$VAL_ACCOUNTS_DIR" "$ACCOUNTS_SPEC" "$WASM_SCRIPT_PATH" \
"$WASM_CODE_PATH" "$TREASURY_INIT_TOKENS_U128" \
"$VAL_NODE_URLS_AND_VAL_PUBKEYS" "$GOV_VOTING_PERIOD" \
"$GOV_MAX_DEPOSIT_PERIOD" "$STAKING_MAX_VALIDATORS" \
"$FEEREFUNDER_ACK_FEE_MIN" "$FEEREFUNDER_TIMEOUT_FEE_MIN" \
"$DEX_ADMIN_MNEMONIC" "$STORE_CODE_PRIVILEGED_ACCOUNT_MNEMONIC" \
"$ADMINS_TOKENS")
Expand Down
Loading
Loading