title | author | date | header-includes | |
---|---|---|---|---|
Curve Cryptoswap: From Whitepaper to Vyper |
Curve Research\footnote{Curve Research is a community organization funded through the Curve DAO grants program and is not affiliated with Curve Finance (Swiss Stake GmbH). Neither Curve Research nor Curve DAO are responsible for any damages that result from use of the provided information or guarantee its accuracy.} |
info@curveresearch.org |
\today |
\usepackage{draftwatermark}
\SetWatermarkLightness{0.95}
|
This is a second paper in the "From Whitepaper to Vyper" series. The first covered the Stableswap invariant and this will cover the extension of it to handle volatile pairs.
As with the first paper, we endeavour to cover important details of implementation (both financial logic and code) underlying the array of live contracts already deployed across multiple chains, highlighting changes from the whitepaper, and emphasizing the ideas needed to understand the contract logic. Throughout, we seek to give concise but straightforward explanations of any background concepts needed, although this is intended more as an aid than for completeness.
Recall the stableswap equation:
In the original derivation of the equation in the stableswap whitepaper, an intermediate equation was produced:
(The equations are easily seen to be equivalent, to get from the first to second, multiply each side by
Setting
Note we haven't done anything new except reformulate the stableswap equation with the coefficient
As the pool's coin balances tend toward equal ("balanced"),
Readers already familiar with the stableswap will understand that
In order to provide concentrated liquidity as with stableswap but with a faster transition to a constant product AMM (
When
When
For a positive
So the cryptoswap equation is: