The Reservoir Price Oracle is designed to work with
Euler Vault Kit by implementing
the IPriceOracle interface.
This oracle provides a geometric mean price between two assets, averaged across a period. The geometric mean has a useful property whereby we can get the inverse price by simply taking the reciprocal. Something that arithmetic mean prices do not provide.
Powered the built-in on-chain price oracle of Reservoir's AMM.
For more information on the IPriceOracle interface, refer to Euler's documentation.
For direct usages of the oracle, refer to IReservoirPriceOracle.sol for methods to obtain raw data from the AMM pairs.
Currently the ReservoirPriceOracle contract makes use of the transient storage
supported since the Cancun fork via OZ's ReentrancyGuardTransient lib.
At the time of writing only ETH mainnet is supported.
If deployment to other chains where transient storage is not yet supported,
we can revert to using solady's ReentrancyGuard for the most gas efficient
implementation.
To install Price Oracles in a Foundry project:
forge install reservoir-labs/oracleClone the repo:
git clone https://github.com/reservoir-labs/oracle.git && cd oracleInstall forge dependencies:
forge install[Optional] Install Node.js dependencies:
npm installCompile the contracts:
forge buildThe repo contains 3 types of tests: unit, large, and integration.
To run all tests:
npm run test:allTo run lint on solidity, json, and markdown, run:
npm run lintSeparate .solhint.json files exist for src/ and test/.
via-iris not enabled this repo, as somehow it increases the gas usage for most cases.
Please report suspected security vulnerabilities in private to security@reservoir.fi. Please do NOT create publicly viewable issues for suspected security vulnerabilities.
These contracts have been audited by Cantina in December 2024.
The Euler Price Oracles code is licensed under the GPL-3.0-or-later license.