Skip to content

Commit

Permalink
fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
none00y committed Aug 22, 2024
1 parent 0867f74 commit d7045a3
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ $L_c =$ current_liquidity\
$\Delta{L} =$ liquidity_delta

##### Formula:
const $a_{OneLP} = 2^{85-64} - $ scale of the LpToken based on $L_{max} $ for full range position ($<2^{85}$) and token precision ($2^{64} - 1 \approx 2^{64}$)
const $a_{OneLP} = 2^{85-64}$ - scale of the LpToken based on $L_{max}$ for full range position ($<2^{85}$) and token precision ($2^{64} - 1 \approx 2^{64}$)

$$ for \ L_c = 0, a_{LP} = \Delta{L}/a_{OneLP}$$
$$ for \ L_c \ne 0, a_{LP} = \frac {\Delta{L}*a_T} {L_c}$$
Expand Down Expand Up @@ -319,12 +319,13 @@ $t_u =$ upper_tick\
$\sqrt{p_c} =$ current_sqrt_price

##### Formula:
$$ for \ \Delta{L_x} > \Delta{L_y} \land \Delta{y} \le y, (\Delta{L_{max}}, \Delta{x_{max}}, \Delta{y_{max}}) = (\Delta{L_x}, x, \Delta{y}) $$
$$ for \ \Delta{L_x} > \Delta{L_y} \land \Delta{y} \le y, (\Delta{L_{max}}, \Delta{x_{max}}, \Delta{y_{max}}) = (\Delta{L_x}, x, \Delta{y})$$

$$ for \ \Delta{L_x} > \Delta{L_y} \land \Delta{y} > y, (\Delta{L_{max}}, \Delta{x_{max}}, \Delta{y_{max}}) = (\Delta{L_y}, \Delta{x}, y)$$

$$ for \ \Delta{L_x} > \Delta{L_y} \land \Delta{y} > y, (\Delta{L_{max}}, \Delta{x_{max}}, \Delta{y_{max}}) = (\Delta{L_y}, \Delta{x}, y) $$
$$ for \ \Delta{L_y} > \Delta{L_x} \land \Delta{x} \le x, (\Delta{L_{max}}, \Delta{x_{max}}, \Delta{y_{max}}) = (\Delta{L_y}, \Delta{x}, y)$$

$$ for \ \Delta{L_y} > \Delta{L_x} \land \Delta{x} \le x, (\Delta{L_{max}}, \Delta{x_{max}}, \Delta{y_{max}}) = (\Delta{L_y}, \Delta{x}, y) $$
$$ for \ \Delta{L_y} > \Delta{L_x} \land \Delta{x}> x, (\Delta{L_{max}}, \Delta{x_{max}}, \Delta{y_{max}}) = (\Delta{L_x}, x, \Delta{y}) $$
$$ for \ \Delta{L_y} > \Delta{L_x} \land \Delta{x}> x, (\Delta{L_{max}}, \Delta{x_{max}}, \Delta{y_{max}}) = (\Delta{L_x}, x, \Delta{y})$$

#### Compute LpShare change
Computation is performed as follows:
Expand Down Expand Up @@ -412,7 +413,7 @@ $x_{transfer} =$ amount of token x that will be transferred from the user to the
$y_{transfer} =$ amount of token y that will be transferred from the user to the contract
##### Formula:
$$ (x_{amount}, x_{fee}, x_{leftover}, y_{amount}, y_{fee}, y_{leftover}, a_T, L_c) $$
$$ \downarrow $$
$$ $$
$$ Mint(\Delta{L}, x_{total},y_{total},t_c,\sqrt{p_c}, s(t), a_T) $$
$$ \downarrow $$
$$ (x_{amount}', x_{fee}', x_{leftover}', y_{amount}', y_{fee}', y_{leftover}', a_T', L_c') $$
Expand All @@ -438,18 +439,22 @@ $x_{leftover} =$ lp pool leftovers in token x\
$y_{leftover} =$ lp pool leftovers in token y\
$\Delta{a} =$ liquidity token amount that will be burned\
$a_T=$ total liquidity token supply\
$ x_{total} $ =$x_{amount}$ + $x_{fee}$ + $x_{leftover}$\
$ y_{total} $ =$y_{amount}$ + $y_{fee}$ + $y_{leftover}$\
$ x_{total}$ =$x_{amount}$ + $x_{fee}$ + $x_{leftover}$\
$ y_{total}$ =$y_{amount}$ + $y_{fee}$ + $y_{leftover}$\
$t_{min} = get\_min\_tick(s(t))$\
$t_{max} = get\_max\_tick(s(t))$\
$x_{transfer} =$ amount of token x that will be transferred from the contract to the user\
$y_{transfer} =$ amount of token y that will be transferred from the contract to the user
##### Formula:
$$ (x_{amount}, x_{fee}, x_{leftover}, y_{amount}, y_{fee}, y_{leftover}, a_T, L_c) $$
$$ \downarrow $$
$$ Burn(\Delta{L}, x_{total},y_{total},t_c,\sqrt{p_c}, s(t), a_T) $$
$$ \downarrow $$
$$ (x_{amount}', x_{fee}', x_{leftover}', y_{amount}', y_{fee}', y_{leftover}', a_T', L_c') $$
$$(x_{amount}, x_{fee}, x_{leftover}, y_{amount}, y_{fee}, y_{leftover}, a_T, L_c)$$

$$\downarrow$$

$$Burn(\Delta{L}, x_{total},y_{total},t_c,\sqrt{p_c}, s(t), a_T)$$

$$\downarrow$$

$$ (x_{amount}', x_{fee}', x_{leftover}', y_{amount}', y_{fee}', y_{leftover}', a_T', L_c')$$
\
$ \Delta{LpShare} = compute\_lp\_share\_change(false, a_t, x_{total}, y_{total}, t_c, \sqrt{p_c}, s(t))$
$ (position, (x_{transfer}, y_{transfer}), \Delta{a}, (x_{leftover}', y_{leftover}')) = \Delta{LpShare}$\
Expand Down

0 comments on commit d7045a3

Please sign in to comment.