Oracles

oneToken price feeds

Oracles are price feed modules that report the value of assets in the oneToken Vault through a normalized interface. In the ICHI and oneToken system, Oracles are used for providing price feeds for project tokens, Collateral Tokens, and oneTokens. Price Oracles are vital to the correct operation of the system and are chosen based on preference for price feed source, interpretation (e.g. smoothing), and volatility-detection logic.

oneToken Oracles are structured in a reusable fashion. As Replaceable Modules, we expect Oracles to evolve and be customized towards the oneTokens they will be used for so the system assumes nothing about the operation of the Oracle itself. Instead, we define a normalized interface so that new implementations can be wrapped and used to report back the results of inspecting external sources. The figure below shows how the Oracle inheritance is structured. This enables flexibility and customization yet keeps to certain boundaries to ensure security.

Oracle Inheritance Map

The contracts in RED are each examples of different oracle implementations that can be used/implemented for certain oneTokens. Each implements separate logic and can be used as a price feed for certain assets.

  1. UniswapOracleSimple.sol: Averages observations over configurable (but unchangeable) time periods. Returns a price in a configurable (but unchangeable) token. Multiple instances can support multiple time-periods or different index tokens. A single instance can be shared and has the ability to observe multiple quotes for multiple tokens using the same (unchangeable) time-period and index currency. Only Oracles that return quotes in registered Collateral tokens can be registered in the OneTokenFactory where it is assumed that all registered Oracles return a USD quote.

  2. ICHIPeggedOracle.sol: Returns 1:1 without consulting external sources. Useful for gas optimization if the peg is assumed to be very strong.

  3. ICHICompositeOracle.sol: Composes quotes from 2 or more other Oracles. For example, token:ETH feeding into ETH:USD would return a token:USD by executing both steps in series.

oneToken Governance determines which Oracle to use for each token in the oneToken Vault and sets the values of parameters the Oracle needs. Multiple different oneToken Vaults can share the same Oracle.