From 5deb9f60d69e023ec1946ca36e400e4d66771dbe Mon Sep 17 00:00:00 2001 From: Jonathan Fung <121899091+jonfung-dydx@users.noreply.github.com> Date: Tue, 17 Oct 2023 10:51:48 -0700 Subject: [PATCH] [CLOB-947] Split TEST-USD liquidity tier with differing base_position_notional (#634) * margin requirements * higher amplitude * update base_position_notional to 10k * remove print * 1M base position notional * pr comments * revert change for num liq tiers --- .../exchange_query_details.go | 2 +- protocol/testing/genesis.sh | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/protocol/daemons/pricefeed/client/price_function/test_volatile_exchange/exchange_query_details.go b/protocol/daemons/pricefeed/client/price_function/test_volatile_exchange/exchange_query_details.go index 76feb2259b..29b944f2f7 100644 --- a/protocol/daemons/pricefeed/client/price_function/test_volatile_exchange/exchange_query_details.go +++ b/protocol/daemons/pricefeed/client/price_function/test_volatile_exchange/exchange_query_details.go @@ -17,7 +17,7 @@ type VolatileExchangeParams struct { var ( TestVolatileExchangeParams = VolatileExchangeParams{ AveragePrice: 100, - Amplitude: 0.5, + Amplitude: 0.95, Frequency: 1, } TestVolatileExchangeDetails = types.ExchangeQueryDetails{ diff --git a/protocol/testing/genesis.sh b/protocol/testing/genesis.sh index cebd0194ab..815f6ac00d 100755 --- a/protocol/testing/genesis.sh +++ b/protocol/testing/genesis.sh @@ -1518,11 +1518,21 @@ function update_genesis_use_test_volatile_market() { test_exchange_config_json=$(cat "$EXCHANGE_CONFIG_JSON_DIR/test_exchange_config.json" | jq -c '.') dasel put -t string -f "$GENESIS" '.app_state.prices.market_params.last().exchange_config_json' -v "$test_exchange_config_json" - # Liquidity Tier: For TEST-USD + # Liquidity Tier: For TEST-USD. 1% leverage and regular 1m nonlinear margin thresholds. NUM_LIQUIDITY_TIERS=$(jq -c '.app_state.perpetuals.liquidity_tiers | length' < ${GENESIS}) dasel put -t json -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[]' -v "{}" dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.last().id' -v "${NUM_LIQUIDITY_TIERS}" - dasel put -t string -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.last().name' -v 'test-usd-100x-liq-tier' + dasel put -t string -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.last().name' -v 'test-usd-100x-liq-tier-linear' + dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.last().initial_margin_ppm' -v '10007' # 1% + a little prime (100x leverage) + dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.last().maintenance_fraction_ppm' -v '500009' # 50% of IM + a little prime + dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.last().base_position_notional' -v '1000000000039' # 1_000_000 USDC + a little prime + dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.last().impact_notional' -v '50000000000' # 50_000 USDC (500 USDC / 1%) + + # Liquidity Tier: For TEST-USD. 1% leverage and 100 nonlinear margin thresholds. + NUM_LIQUIDITY_TIERS_2=$(jq -c '.app_state.perpetuals.liquidity_tiers | length' < ${GENESIS}) + dasel put -t json -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[]' -v "{}" + dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.last().id' -v "${NUM_LIQUIDITY_TIERS_2}" + dasel put -t string -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.last().name' -v 'test-usd-100x-liq-tier-nonlinear' dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.last().initial_margin_ppm' -v '10007' # 1% + a little prime (100x leverage) dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.last().maintenance_fraction_ppm' -v '500009' # 50% of IM + a little prime dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.last().base_position_notional' -v '100000007' # 100 USDC + a little prime