Mento Protocol
  • Mento Protocol
    • Home
    • What, why, who Mento?
    • Quick Links
  • HOW TO SOURCE MENTO STABLES
    • Overview
    • CEXs, DEXs, Pools
    • From other Chains
    • On-ramp Providers
    • Automation via MATE
  • Protocol Concepts
    • Stability
    • Reserve
    • Asset exchanges
      • Broker
      • Trading Limits
      • Exchange Providers
      • BiPoolManager
    • Oracles
    • On-Chain Circuit Breaker
    • Governance
      • Verification
  • Developers
    • Repository Overview
    • Integrate Mento Stables
    • Smart Contracts
      • Broker
      • TradingLimits
      • BiPoolManager
      • Pricing Modules
      • SortedOracles
      • BreakerBox
      • Reserve
      • StableToken
      • Audits
    • Deployments
      • Addresses
      • Verification
      • Parameters
    • Mento SDK
      • Installation
      • Guides
        • Getting Exchange Pairs
        • Getting a Quote
        • Initiating a Swap
    • Oracles
      • Oracle Client
        • Price Sources
      • Becoming an Oracle Provider
  • Economics
    • Stability
    • Risks
    • Research
  • Governance & Token
    • Overview
    • Governance Components
    • Governance Scope
    • MENTO Token
      • Listing information
    • Airdrop
    • Governance Watchdogs
Powered by GitBook
On this page
Edit on GitHub
  1. Developers

Oracles

PreviousInitiating a SwapNextOracle Client

Last updated 1 year ago

These pages describe the technical details of Oracles on Mento. For an introduction to Oracles and how they work on Mento, please see Oracles in the Protocol Concepts section.

Mento Oracles consist of two technical parts: An on-chain smart contract and off-chain clients. In the following pages, you will learn about these two components as well as about the research behind choosing price sources for the oracles to report.

Unique Rate Feed Identifiers

Each oracle rate, internally called rate feed, is uniquely identified by a rateFeedID. It is used when adding oracle rates to the SortedOracle smart contract by calling the addOracle function in a Celo governance proposal:

addOracle(address token, address oracleAddress)

For CELO/cStable rate feeds, the unique identifier is the address of the stable token. Since this doesn't work for more than one pair including the same stable token, which was not initially planned, a new formula is used to create unique rate feed identifiers for rate feeds other than CELO/cStable.

These identifiers can be derived using the following formula:

address(uint160(uint256(keccak256(${asset0asset1}))))

For example, USDCUSD inserted gives the following formula:

address(uint160(uint256(keccak256("USDCUSD"))))
// == 0xA1A8003936862E7a15092A91898D69fa8bCE290c

An example can be found in this Celo Governance Proposal.