Docs
  • ⛵Lodestar Finance
  • Getting Started
    • 👨‍🌾User Guide
    • ❓FAQ
    • 🏗️Deployed Contracts
  • Documentation
    • 👩‍🔬Technical Overview
      • Supply
      • Collateral
        • Collateral Factors
      • Borrow
      • Interest
        • Interest Rate Model 1
        • Interest Rate Model 2
        • Interest Rate Model 3
        • Interest Rate Model 4
        • Interest Rate Model 5
      • Reserves
        • Reserve Factors
        • Rake
      • Liquidation
      • Staking
        • Emission Gauge Voting
      • Looping
    • 🤖Contracts
      • Lens
      • Comptroller
        • LODE Emissions
        • Events
        • Error Reporting
      • Oracles
      • Interest Rate Models
        • Constructor Arguments
      • lTokens
        • Market and Account State
        • Events
        • Error Reporting
    • ⚙️API
    • 🔐Security
    • 🗺️Roadmap
    • 🥚Inception
  • Tokenomics
    • 🧭LODE
  • Links
    • Twitter
    • Discord
    • Medium
    • Github
    • Lodestar Website
    • Lodestar dApp
    • Lodestar Liquidity Mining
    • LODE Token Claim for Aelin Supporters
Powered by GitBook
On this page
  • Introduction
  • PriceOracleProxyETH
  • getUnderlyingPrice
  • plvGLP Pricing
  • GLP & GLPManager
  • plvGLP
  1. Documentation
  2. Contracts

Oracles

How the protocol uses oracles to accurately price assets

PreviousError ReportingNextInterest Rate Models

Last updated 2 years ago

Introduction

The protocol uses Price Oracles in order to gather price data for the protocol. The ingests price data from the PriceOracleProxy contract and uses it as a source of truth for all prices. Prices are updated by verified, secure 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/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/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.

🤖
Comptroller
Chainlink