Skip to content

Commit

Permalink
Update price tick examples in DEX spec. (#1051)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitryhil authored Dec 16, 2024
1 parent f842002 commit caea1e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 1 addition & 3 deletions x/dex/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,6 @@ func TestKeeper_ComputePriceTick(t *testing.T) {
base: 3.0,
quote: 27.123,
},

{
name: "10000.0/10000.0",
base: 10000.0,
Expand Down Expand Up @@ -820,7 +819,6 @@ func TestKeeper_ComputePriceTick(t *testing.T) {
base: 3.0,
quote: 1.0,
},

{
name: "3100000.0/8.0",
base: 3100000.0,
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 6 additions & 8 deletions x/dex/spec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit caea1e5

Please sign in to comment.