Skip to content

Commit

Permalink
feat(scripts): Add new protocol stable currency
Browse files Browse the repository at this point in the history
  • Loading branch information
desislavva committed Apr 10, 2024
1 parent 70d96b4 commit 59c69d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ On a live network, a new DEX can be deployed using the following steps.
### Аutomated step

```sh
./scripts/add-new-dex.sh --dex-admin-key <dex_admin_key> --store-code-privileged-user-key <store_code_privileged_user_key> --wasm-artifacts-path <wasm_artifacts_dir_path> --dex-name <dex_name> --dex-chain-id <new_dex_chain_id> --dex-ip-addr-rpc-host <new_dex_ip_addr_rpc_host_part> --dex-ip-addr-grpc-host <new_dex_ip_addr_grpc_host_part> --dex-account-prefix <new_dex_account_prefix> --dex-price-denom <new_dex_price_denom> --dex-trusting-period-secs <new_dex_trusting_period_in_seconds> --dex-if-interchain-security <if_interchain_security_true/false> --protocol-currency <new_protocol_currency> --protocol-swap-tree <new_protocol_swap_tree>
./scripts/add-new-dex.sh --dex-admin-key <dex_admin_key> --store-code-privileged-user-key <store_code_privileged_user_key> --wasm-artifacts-path <wasm_artifacts_dir_path> --dex-name <dex_name> --dex-chain-id <new_dex_chain_id> --dex-ip-addr-rpc-host <new_dex_ip_addr_rpc_host_part> --dex-ip-addr-grpc-host <new_dex_ip_addr_grpc_host_part> --dex-account-prefix <new_dex_account_prefix> --dex-price-denom <new_dex_price_denom> --dex-trusting-period-secs <new_dex_trusting_period_in_seconds> --dex-if-interchain-security <if_interchain_security_true/false> --protocol-currency <new_protocol_currency> --stable-currency <new_protocol_stable_currency> --protocol-swap-tree <new_protocol_swap_tree>
```

The script takes care of setting up Hermes to work with the new DEX and, for now, deploying DEX-specific contracts (More about deploying contracts on a live network can be found [here](https://github.com/nolus-protocol/nolus-money-market)).
Expand Down
13 changes: 11 additions & 2 deletions scripts/add-new-dex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ CHAIN_TRUSTING_PERIOD=""
IF_INTERCHAIN_SECURITY="true"

PROTOCOL_CURRENCY=""
STABLE_CURRENCY=""
ADMIN_CONTRACT_ADDRESS="nolus1ghd753shjuwexxywmgs4xz7x2q732vcnkm6h2pyv9s6ah3hylvrq8welhp"
TREASURY_CONTRACT_ADDRESS="nolus14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s0k0puz"
TIMEALARMS_CONTRACT_ADDRESS="nolus1nc5tatafv6eyq7llkr2gv50ff9e22mnf70qgjlv737ktmt4eswrqrr2r7y"
Expand Down Expand Up @@ -60,6 +61,7 @@ while [[ $# -gt 0 ]]; do
[--dex-trusting-period-secs <new_dex_trusting_period_in_seconds>]
[--dex-if-interchain-security <new_dex_if_interchain_security_true/false>]
[--protocol-currency <new_protocol_currency>]
[--stable-currency <new_protocol_stable_currency>]
[--admin-contract-address <admin_contract_address>]
[--treasury-contract-address <treasury_contract_address>]
[--timealarms-contract-address <timealarms_contract_address>]
Expand Down Expand Up @@ -176,6 +178,12 @@ while [[ $# -gt 0 ]]; do
shift
;;

--stable-currency)
STABLE_CURRENCY="$2"
shift
shift
;;

--admin-contract-address)
ADMIN_CONTRACT_ADDRESS="$2"
shift
Expand Down Expand Up @@ -224,7 +232,8 @@ 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 "$PROTOCOL_CURRENCY" "new protocol currency"
verify_mandatory "$PROTOCOL_CURRENCY" "new protocol lpn"
verify_mandatory "$STABLE_CURRENCY" "new protocol stable currency"
verify_mandatory "$SWAP_TREE" "new protocol swap_tree"

verify_file_exist "$DEPLOY_CONTRACTS_SCRIPT" "The script does not exist"
Expand Down Expand Up @@ -258,4 +267,4 @@ DEX_CHANNEL_REMOTE=$(echo "$CONNECTION_INFO" | jq -r '.channels[0].counterparty.
# Deploy contracts
_=$(deploy_contracts "$NOLUS_NET" "$NOLUS_CHAIN_ID" "$NOLUS_HOME_DIR" "$DEX_ADMIN_KEY" "$STORE_CODE_PRIVILEGED_USER_KEY" \
"$ADMIN_CONTRACT_ADDRESS" "$WASM_ARTIFACTS_PATH/$DEX_NAME" "$DEX_NETWORK" "$DEX_NAME" "$DEX_CONNECTION_ID" "$DEX_CHANNEL_LOCAL" "$DEX_CHANNEL_REMOTE" "$PROTOCOL_CURRENCY" \
"$TREASURY_CONTRACT_ADDRESS" "$TIMEALARMS_CONTRACT_ADDRESS" "$SWAP_TREE")
"$STABLE_CURRENCY" "$TREASURY_CONTRACT_ADDRESS" "$TIMEALARMS_CONTRACT_ADDRESS" "$SWAP_TREE")

0 comments on commit 59c69d6

Please sign in to comment.