The Pendle AMM observes the formula
ɑ: the weight of x at time = i + 1 β: the weight of y at time = i + 1 x and y: the equilibrium point of x and y at time = i
At time = 0, ɑ and β are initiated at 0.5, the quantity of Token X and Token Y is initiated by the market creator which translates to x and y. The curve will resemble Uniswap’s constant product curve.
When a swap happens, the equilibrium point shifts along the curve.
At subsequent time step time = i, ɑ and β will change with the following formulas:
t: time to maturity from 1 to 0 T: UNIX timestamp T: contract start timestamp T: contract end timestamp
The changing weights of X and Y cause changes in the shape of the curve.
The pivot point for curve shifting is the equilibrium point of X and Y at the time of curve shift. Swapping between X and Y changes the equilibrium point, and the pivot point for curve shift will vary accordingly.
At time close to T, the slope of the curve will be near zero. And reaches zero at T.
The Pendle curve shifting algorithm closely resembles the concept of option pricing models, where price decays more drastically towards the end of the contract than at the beginning. The magnitude of price decay over time is represented by the p(t) formula outlined in the section above.
The motivation for the constants chosen for the above formula is the fact that the price loses about 1/3 of its original value (at the beginning of the contract period) when time to maturity reaches 50%.
There will be a default 1% fee for all trades against liquidity pools on Pendle's AMM (0.85% of which goes to the LPs and 0.15% to the treasury). This fee will be adjustable via governance proposals and voting once it goes live.
The Pendle AMM is designed to support a protocol-level exit fee to be used to support continual work on the Pendle platform. However, it is currently being set to 0% and will be changeable via governance proposals if deemed necessary.
The LP token issuance will be in proportion to the liquidity provided to the pool.
Taking inspiration from Balancer, for a generic
joinMarketByAll, the LP tokens received by the depositor is the ratio of deposited tokens to the current reserves of the token in the pool. In other words:
As mentioned, the swapFee variable will have to be introduced in the case of
joinMarketSingleToken. In other words, the formula for LP token calculation for single token pool join is then (adapting from Balancer):
B: inTokenReserve.balance W: inToken Reserve.weight
Without considering the swapFee, the liquidity withdrawal formula is the inverse of that provision (without swapFee considerations).
With swapFee, adapting from Balancer, the formula for outAmountToken given inAmountLp is:
B: outTokenReserve.balance W: outTokenReserve.weight