Rate Adjusted StableSwap pools
Last updated
Last updated
In the following, we consider an Interest Bearing Token integrated in Spectra. We assume all instruments start at and expire at .
StableSwap pools, developed by Curve Finance, are an AMM (Automated Market Maker) designed for trading pegged assets. They elaborate on the constant sum invariant to support an infinite price range by interpolating it with the constant sum invariant, while maintaining price impact minimal on almost all of the pool's range. For further information, we refer to the .
Using a raw StableSwap pool for exchanging Interest Bearing Tokens for Principal Tokens will not be efficient, since they are not necessarily pegged.
Indeed, we make take as an example Interest Bearing assets with external cash flows, such as rewards or points. The implied rate will take the external cash flows into account, while the value of the Interest Bearing token in underlying asset will not grow as quickly.
The oracle adjusts the internal prices of the AMM with rate oracles by converting the balances into underlying asset, both for the Principal Token and the Interest Bearing token, so that the pair behaves as a pegged pair inside of the AMM. This is achieved through the , as described below.
The AMM's bonding Curve is exclusively used to incorporate implied interest rate volatility, delegating the predictable market drift's accounting to the rate oracles. This drastically improves liquidity usage for trading such a pair, compared to a classical AMM.
Interest Bearing Tokens are ERC4626
compliant vaults. These vaults consist of an underlying asset reserve and a rate at which this reserve evolves. One can convert between shares of the vault and the underlying asset using the convertToAssets()
method.
In mathematical terms, if denotes the instantaneous rate process, then the price of an Interest Bearing Token since deployment is given by
Hence, to virtualise the Interest Bearing Token balance of the pool to its underlying value, we have to multiply that balance by the above rate.
This is achieved in practice by flagging the token at index 0 as an asset of type 3, i.e as an ERC4626
token, so that the StableSwap AMM knows it has to adjust the balances with the vault's rate.
Principal Tokens are time bound instruments corresponding to a unit of underlying discounted by the implied interest rate over the term it is deployed on. They are the equivalent of zero-coupon bonds. They are redeemable for a unit of underlying at maturity when no negative interest rate has been registered in the underlying Interest Bearing Token, or else for a unit of underlying adjusted by the cumulative loss incurred by the negative interest. In Spectra, the redemption value of the Principal Token is referred to as the ptRate
. In mathematical terms, the ptRate
can be expressed as
Given an implied APY , the fair value of the Principal Token in underlying asset is given by
Let be the expected implied APY. The Principal Token oracle will report . If denotes the internal price of the pool at time , we have that
Rearranging, we get
or
Therefore, with such choice of oracle for the Principal Token, the AMM prices the deviation of the implied rate from the expected rate over the given term.
In practice, this is achieved by flagging the token at index 1 as asset of type 1, i.e an asset whose price with respect to an underlying asset depends on an oracle. The oracle contract is RateAdjustmentOracle.sol
and its value is fetched by the StableSwap algorithm before every state change.
Holding constant, if , then is strictly decreasing and if , then is strictly increasing. That means that assuming a constant maximal deviation of the implied rate from the expected implied rate, the price range in which liquidity is concentrated should get smaller the closer we get to maturity, to achieve a constant liquidity concentration profile in the implied interest rate space.
Let be the time-dependent amplification factor and be the StableSwap invariant, where represent the rate adjusted balances of Interest Bearing Token and Principal Token, respectively. Assume we want to support a maximal deviation of a factor of the implied APY, that is
achievable at IBT/PT ratio of . Assume that (the other case is analogue). Then is defined implicitly by
where is the trading function implicitly defined by the invariant and is chosen such that
The fees are adjusted such that the base fee , taken on the implied APY, stays constant over the term.