|
167 | 167 | P_{v_u} = \frac{r_f b}{p_u (1 + r_f) - r_f p_a} ,
|
168 | 168 | $$
|
169 | 169 |
|
170 |
| -where $r_f$ is the `short` factor for the upper range and the `long` factor for the lower range, `b` is the current total balance of the vAMM across all accounts, $P_{v_l}$ is the theoretical volume and the bottom of the lower bound and $P_{v_u}$ is the (absolute value of the) theoretical volume at the top of the upper bound. The final $L$ scores can then be reached with the equation |
| 170 | +where $r_f$ is the `short` factor for the upper range and the `long` factor for the lower range, `b` is the commitment amount, $P_{v_l}$ is the theoretical volume and the bottom of the lower bound and $P_{v_u}$ is the (absolute value of the) theoretical volume at the top of the upper bound. The final $L$ scores can then be reached with the equation |
171 | 171 |
|
172 | 172 | $$
|
173 | 173 | L = P_v \cdot \frac{\sqrt{p_u} \sqrt{p_l}}{\sqrt{p_u} - \sqrt{p_l}} = P_v L_u,
|
|
235 | 235 |
|
236 | 236 | Then simply return the absolute difference between these two prices.
|
237 | 237 |
|
| 238 | +## Best bid / best ask |
| 239 | + |
| 240 | +As the volume provided between two ticks can theoretically be less than the smallest unit of volume supported by the market's position decimals, the best-bid and ask will not always simply be one tick greater or less than the AMMs current fair price. |
| 241 | + |
| 242 | +Instead the best-bid and best-ask of an AMM curve is defined as the price levels at which the AMM will quote at least one unit of volume between those prices and the current fair price. Re-arranging the formulas defined in the prior [section](#volume-between-two-prices) yields the following: |
| 243 | + |
| 244 | +$$ |
| 245 | +p_{bb} = \frac{L\cdot\sqrt{p_f}}{L + V\cdot \sqrt{p_f}} |
| 246 | +$$ |
| 247 | + |
| 248 | +$$ |
| 249 | +p_{bb} = \frac{L\cdot\sqrt{p_f}}{L - V\cdot \sqrt{p_f}} |
| 250 | +$$ |
| 251 | + |
| 252 | +Where: |
| 253 | + |
| 254 | +- $P_{bb}$ is the calculated best bid |
| 255 | +- $P_{ba}$ is the calculated best ask |
| 256 | +- $p_{f}$ is the current fair price as calculated [here](#fair-price) |
| 257 | +- $L$ is the liquidity score as calculated [here](#determining-volumes-and-prices) |
| 258 | + |
| 259 | +## Curve validity |
| 260 | + |
| 261 | +To prevent the protocol evaluating AMMs providing little liquidity to the network, the network will reject AMM submissions or amendments which cause an AMMs liquidity to be spread too thinly across it's entire range. |
| 262 | + |
| 263 | +If the number of ticks in the largest price range in which the AMM quotes zero volume is more than the parameter $allowedEmptyAmmLevels$, then the submission or amendment will be rejected. Note this parameter is defined on each market to allow different markets with varying volatility to be configured appropriately. |
| 264 | + |
| 265 | +- for the lower curve, this range is between the fair price at which the AMMs long position is $P=1$ and the base price. |
| 266 | +- for the upper curve, this range is between the fair price at which the AMMs short position is $(P_v-1)$ and the upper price bound. |
| 267 | + |
| 268 | +The above definitions yield the following inequality which must be satisfied for both the upper and lower curve for the AMM to be valid. |
| 269 | + |
| 270 | +$$ |
| 271 | +n\cdot\Delta{p} \geq \frac{L\cdot\sqrt{p_u}}{L + \Delta{P}\cdot \sqrt{p_u}} |
| 272 | +$$ |
| 273 | + |
| 274 | +Where: |
| 275 | + |
| 276 | +- $\Delta{p}$ is the smallest price movement supported by the market's price decimals and tick size |
| 277 | +- $\Delta{P}$ is the smallest position size supported by the market's position decimals |
| 278 | +- $n$ is the market parameter $allowedEmptyAmmLevels$ |
| 279 | +- $L$ is the liquidity score for the relevant curve |
| 280 | +- $p_u$ is the upper price (the base price for the lower curve and the upper bound for the upper curve) |
| 281 | + |
| 282 | +Note, if the market parameter $allowedEmptyAmmLevels$ is updated via governance all existing pools that would no longer satisfy the inequality **must not** be cancelled. Amends to these pools should be evaluated and rejected if necessary and any cancellations should be accepted. |
| 283 | + |
238 | 284 | ## Determining Liquidity Contribution
|
239 | 285 |
|
240 | 286 | The provided liquidity from an AMM commitment must be determined for two reasons. Firstly to decide instantaneous distribution of liquidity fees between the various liquidity types and secondly to calculate a virtual liquidity commitment amount for assigning AMM users with an ELS value. This will be used for determining the distribution of ELS-eligible fees on a market along with voting weight in market change proposals.
|
@@ -341,3 +387,16 @@ At market settlement, an AMM's position will be settled alongside all others as
|
341 | 387 | - With an existing book consisting solely of vAMM orders, pegged orders referencing best bid/best ask remain deployed, pegged to their pegs, where the best buy/sell vAMM order price acts as the best bid, or best ask peg respectively. (<a name="0090-VAMM-036" href="#0090-VAMM-036">0090-VAMM-036</a>)
|
342 | 388 |
|
343 | 389 | - With an existing book consisting solely of vAMM orders on one side, pegged orders referencing best bid/best ask remain deployed on the side with the vAMM orders. Pegged orders referencing the empty side of the book are parked. (<a name="0090-VAMM-037" href="#0090-VAMM-037">0090-VAMM-037</a>)
|
| 390 | + |
| 391 | +## Curve validity |
| 392 | + |
| 393 | +### Governance |
| 394 | + |
| 395 | +- A market creation proposal specifying a market parameter $allowedEmptyAmmLevels$ less than zero should be rejected. (<a name="0090-VAMM-xxx" href="#0090-VAMM-xxx">0090-VAMM-xxx</a>) |
| 396 | +- A market update proposal specifying a market parameter $allowedEmptyAmmLevels$ less than zero should be rejected. (<a name="0090-VAMM-xxx" href="#0090-VAMM-xxx">0090-VAMM-xxx</a>) |
| 397 | +- A market specifying $allowedEmptyAmmLevels=0$ will enforce the requirement that an AMM provides at least one unit of volume at every price level within in it's range. (<a name="0090-VAMM-xxx" href="#0090-VAMM-xxx">0090-VAMM-xxx</a>) |
| 398 | + |
| 399 | +- If the market parameter $allowedEmptyAmmLevels$ is updated such that a valid AMM is no longer valid, that AMM is not cancelled. (<a name="0090-VAMM-xxx" href="#0090-VAMM-xxx">0090-VAMM-xxx</a>) |
| 400 | +- If the market parameter $allowedEmptyAmmLevels$ is updated such that a valid AMM is no longer valid, any amendments to that AMM that are also not valid should be rejected but the AMM should remain active. (<a name="0090-VAMM-xxx" href="#0090-VAMM-xxx">0090-VAMM-xxx</a>) |
| 401 | +- If the market parameter $allowedEmptyAmmLevels$ is updated such that a valid AMM is no longer valid, any amendments to that AMM that are valid should be accepted and the AMM should be updated. (<a name="0090-VAMM-xxx" href="#0090-VAMM-xxx">0090-VAMM-xxx</a>) |
| 402 | +- If the market parameter $allowedEmptyAmmLevels$ is updated such that a valid AMM is no longer valid, any cancellations of that AMM should be accepted and the AMM should be cancelled. (<a name="0090-VAMM-xxx" href="#0090-VAMM-xxx">0090-VAMM-xxx</a>) |
0 commit comments