Price Aggregator
Contains the Library and the Facet required to pull information on token prices in Chainlink.
  • ChainLinkAggFacet
  • ChainLinkAggLib contains functions that help:
    • isTokenSupported checks if a token is supported and has a pair aggregator
    • aggregatorFor grabs the ChainLink Aggregator address to check if a token pair is supported

PriceAggFacet

Contains helper functions that:
  • getValueFor calculates the value of a source token amount into a destination token
  • priceFor calculates a price from Compound. If price isn't found from compound, then it tries to retrieve it from ChainLink
  • isCToken checks if a token is a cToken and returns the address of the token if true
  • compoundPriceFor retrieves the price of a source token in destination token from Compound
  • chainlinkPriceFor retrieves the price of a source token in destination token from ChainLink

PriceAggLib

Implements both the valueFor and priceFor functions to retrieve both values and prices of a source token to a destination token.
Copy link
Contents