Oracles

How the protocol uses oracles to accurately price assets

Introduction

The protocol uses Price Oracles in order to gather price data for the protocol. The Comptroller ingests price data from the PriceOracleProxy contract and uses it as a source of truth for all prices. Prices are updated by verified, secure Chainlink price feeds.

PriceOracleProxyETH

getUnderlyingPrice

Returns the price of the underlying asset for a given lToken via the respective ChainLink aggregator contract.

plvGLP Pricing

The price for plvGLP is derived from market parameters obtained from the GLP, GLPManager and plvGLP contracts.

GLP & GLPManager

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,

GLPPrice=GLPValue/GLPSupplyGLPPrice = GLPValue/GLPSupply

plvGLP

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 totalAssets and totalSupply . Written formulaically,

plvGLPExchangeRate=TotalAssets/TotalSupplyplvGLPExchangeRate=TotalAssets/TotalSupply

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.

Last updated