delphi

Permissionlessly create oracles that perform operations on data from ChainLink aggregators

GPL-3.0 License

Stars
13

Delphi 🔮🌜 Test Workflow License: GPL v3

Delphi is a set of contracts that allows anyone to permissionlessly create oracles which perform an arbitrary mathematical operation on data from ChainLink Aggregators.

Utilizes a modified version of Band Protocol's equation evaluation library that allows for multiple variables to be used.

Specification

  • DelphiFactoryV1
    • createOracle(string _name, address[] _aggregators, uint256[] _expressions)
      • Creates an oracle that uses the given aggregators and evaluates the equation defined in _expressions.
      • _expressions is an array of Opcodes and their children. (See src/math/Equation.sol for more info)
    • setAllowAggregator(address _aggregator, bool _allow)
      • ADMIN FUNCTION: Allows/disallows an aggregator for usage in creation of future oracles.
    • setEndorsed(address _oracle, bool _endorsed)
      • ADMIN FUNCTION: Endorses/Unendorses an oracle that was created by the factory.
    • transferOwnership(address _newOwner)
      • ADMIN FUNCTION: Transfers the ownership of the factory to _newOwner
  • DelphiOracleV1
    • init(address _factory, address[] _aggregators, uint256[] _expressions)
      • Called by the DelphiFactoryV1 contract upon creation of the oracle. Can only be called once.
    • getLatestValue() view returns (int256)
      • Returns the latest value of the oracle by executing the equation with the most recent data from ChainLink Aggregators.
    • latestRoundData() & latestAnswer()
      • Provided for use as an AggregatorV2V3Interface
    • getAggregators() view returns (AggregatorV2V3Interface[] memory)
      • Get the addresses of the aggregators that the oracle's equation utilizes.
    • getNodes() view returns (Equation.Node[] memory)
      • Get the oracle's equation nodes.

Deployments

See DEPLOYMENTS.md

Contribute

See CONTRIBUTE.md