Skip to content

Commit

Permalink
[CLOB-947] Split TEST-USD liquidity tier with differing base_position…
Browse files Browse the repository at this point in the history
…_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
  • Loading branch information
jonfung-dydx authored Oct 17, 2023
1 parent 53a4981 commit 5deb9f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type VolatileExchangeParams struct {
var (
TestVolatileExchangeParams = VolatileExchangeParams{
AveragePrice: 100,
Amplitude: 0.5,
Amplitude: 0.95,
Frequency: 1,
}
TestVolatileExchangeDetails = types.ExchangeQueryDetails{
Expand Down
14 changes: 12 additions & 2 deletions protocol/testing/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5deb9f6

Please sign in to comment.