Skip to main content

Introduction of PT Oracle

In Pendle system, PTPT can be freely traded from and to SYSY ultilizing our AMM. With the built-in TWAP oracle library, the geometric mean price of PTPT in terms of SY or asset can be derived from our PendleMarket contracts fully on-chain. Please refer to the StandardizedYield doc for more details of SY & asset

Oracle design

Pendle's oracle implementation is inspired from the idea of UniswapV3 Oracle (see here) with a slight difference in how we define the cumulative rate. In short, our oracle stores the cumulative logarithm of implied APY (the interest rate implied by PT/assetPT/asset pricing). From the cumulative logarithm of Implied APY, we can calculate the geometric mean of Implied APY, which will used to derive the mean PTPT price.

In a way, the Pendle AMM contract has a built-in oracle of interest rate, which can used to derive PTPT prices.

Formulas

Our oracle storage is in the following form:

struct Observation {
// the block timestamp of the observation
uint32 blockTimestamp;
// the tick logarithm accumulator, i.e., ln(impliedRate) * time elapsed since the pool was first initialized
uint216 lnImpliedRateCumulative;
// whether or not the observation is initialized
bool initialized;
}

The geometric mean price of PTPT for the time interval of [t0,t1][t_0, t_1] is:

lnImpliedRate=lnImpliedRateCumulative1lnImpliedRateCumulative0t1t0lnImpliedRate = \frac{lnImpliedRateCumulative_1 - lnImpliedRateCumulative_0}{t_1 - t_0}
impliedRate=elnImpliedRateimpliedRate = e^{lnImpliedRate}
assetToPtPrice=impliedRatetimeToMaturityoneYearassetToPtPrice = impliedRate^{\frac{timeToMaturity}{oneYear}}
ptToAssetPrice=1/assetToPtPriceptToAssetPrice = 1 / assetToPtPrice