From caea1e57b1a3a6efd267b5d955346bebf5a88249 Mon Sep 17 00:00:00 2001 From: Dzmitry Hil Date: Mon, 16 Dec 2024 13:56:37 +0300 Subject: [PATCH] Update price tick examples in DEX spec. (#1051) --- x/dex/keeper/keeper_test.go | 4 +--- x/dex/spec/README.md | 14 ++++++-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/x/dex/keeper/keeper_test.go b/x/dex/keeper/keeper_test.go index 2bb8d55a5..b9c376320 100644 --- a/x/dex/keeper/keeper_test.go +++ b/x/dex/keeper/keeper_test.go @@ -789,7 +789,6 @@ func TestKeeper_ComputePriceTick(t *testing.T) { base: 3.0, quote: 27.123, }, - { name: "10000.0/10000.0", base: 10000.0, @@ -820,7 +819,6 @@ func TestKeeper_ComputePriceTick(t *testing.T) { base: 3.0, quote: 1.0, }, - { name: "3100000.0/8.0", base: 3100000.0, @@ -1247,7 +1245,7 @@ func getAccountDenomsOrdersCount( } func assertTickCalculations(t *testing.T, base, quote float64) { - tickExponent := -5 + tickExponent := -8 finalTickExp := math.Floor(math.Log10(quote/base)) + float64(tickExponent) finalTick := math.Pow(10, finalTickExp) diff --git a/x/dex/spec/README.md b/x/dex/spec/README.md index 47326c342..ab48a43c8 100644 --- a/x/dex/spec/README.md +++ b/x/dex/spec/README.md @@ -140,7 +140,7 @@ whether within the same trading pair or its inverse, optimizing the trading expe To provide a better trading experience we define the [price_tick](https://www.investopedia.com/terms/t/tick.asp) for each order book. The `price_tick` mostly depends on the price of the assets traded, that's why we can define the variable for a token used to define the order book `price_tick`. This variable is named `unified_ref_amount`. -`unified_ref_amount`for token represents the amount of the token subunit you need to pay to buy 1 USD dollar. If the +`unified_ref_amount` for token represents the amount of the token subunit you need to pay to buy 1 USD dollar. If the token is issued on the Coreum chain, that variable can be set/updated by the token admin. If the token is IBC token, or the token doesn't have and admin this variable can be set/updated by the chain governance. If the `unified_ref_amount` is not set for a token, the `unified_ref_amount` is equal to 10^6. @@ -159,10 +159,10 @@ Tick size example: | unified_ref_amount(AAA) | unified_ref_amount(BBB) | price_tick(AAA/BBB) | price_tick(BBB/AAA) | |-------------------------|-------------------------|---------------------|---------------------| | 10000.0 | 10000.0 | 10^-5 | 10^-5 | -| 3000.0 | 20.0 | 10^-8 | 10^-3 | -| 3100000.0 | 8.0 | 10^-11 | 1 | -| 0.00017 | 100.0 | 1 | 10^-11 | -| 0.000001 | 10000000 | 10^8 | 10^-18 | +| 3000.0 | 20.0 | 10^-11 | 10^-6 | +| 3100000.0 | 8.0 | 10^-14 | 10^-3 | +| 0.00017 | 100.0 | 10^-3 | 10^-14 | +| 0.000001 | 10000000 | 10^5 | 10^-21 | The update of the `unified_ref_amount` doesn't affect the created orders. @@ -228,7 +228,7 @@ The `good_til` setting specifies how long an order remains active based on certa This feature introduces an order reserve requirement for each order placed on the chain. The reserve acts as a security deposit that ensures users have a vested interest in their orders, helping to prevent spam and malicious activities. Once the order is executed that reserve is released. -The default reserve amount is `10 CORE` and can be updated by the governance. +The default reserve amount is `10 CORE` and can be updated by the governance. ### Max orders limit @@ -261,8 +261,6 @@ It grants specific administrative or governance roles the power to manage and ov safeguard against potential issues such as erroneous trades, malicious activity, or market manipulation. For the token admin to cancel the user's orders, the `dex_order_cancellation` feature must be enabled. -### Restricted trade - ### Block DEX The asset FT token admin at time of issues can set the `block_dex` feature, which will block the DEX completely for the