PoolReserves
or LimitOrderTranche
s is stored at a specific tick. Price for liquidity held at a tick is stored in the form of MakerPrice
— the price at which the MakerDenom
is being sold denominated in terms of the TakerDenom
. The MakerPrice
of liquidity being stored at tick i
is determined by the function:
Some examples:
MakerPrice
can also be seen as the rate for converting MakerDenom
to TakerDenom
:
.
Conversely, we can convert TakerDenom
to MakerDenom
as follows:
.
Given an intent to deposit ATOM
and USDC
into a pool (assuming no fee) with the Price of ATOM
set at 10 USDC
perATOM
and implying a reciprocal USDC
price of 0.1 ATOM
perUSDC
, the best tick index to deposit to will be +/-23027
given that the target price is 10. (we are selling 1 ATOM
for 10 USDC
)
USDC
liquidity will be placed at tick -23027
, which implies a price of = 0.1ATOM
ATOM
liquidity will be placed at tick +23027
, which implies a price of = 10USDC
A good way to think about price in this context is how much of TakerDenom
Alice would receive if she sold a single MakerDenom
and vice versa. In this case, she would receive 10 USDC
given an input of 1 ATOM
, and 0.1 ATOM
given an input of 1 USDC
.
From this, the simple price heuristic is How much output given unit input.
swapping 100 USDC for Atom:
swapping 100 Atom for USDC: