How the protocol uses oracles to accurately price assets
Returns the price of the underlying asset for a given lToken via the respective ChainLink aggregator contract.
The price for plvGLP is derived from market parameters obtained from the GLP, GLPManager and plvGLP contracts.
In order to calculate the price of plvGLP, the price of the underlying GLP must first be obtained. In order to accomplish this, the price of GLP is calculated as the sum total of all underlying assets that comprise GLP divided by the total supply of GLP. The sell price of GLP is used to calculate the price of GLP. Written formulaically,
After calculating the price of GLP, the price of plvGLP is calculated by first calculating the exchange ratio between GLP and plvGLP. The exchange ratio is calculated by dividing the contract parameters
totalSupply. Written formulaically,
Once the exchange ratio between GLP and plvGLP is calculated, the price of plvGLP is simply the price of GLP multiplied by the exchange rate.
Every hour the exchange rate is measured and a moving average is calculated to smooth out sudden spikes in the exchange rate from attempted manipulation.