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/oracle
Clone the repo:
git clone https://github.com/reservoir-labs/oracle.git && cd oracle
Install forge dependencies:
forge install
[Optional] Install Node.js dependencies:
npm install
Compile the contracts:
forge build
The repo contains 3 types of tests: unit, large, and integration.
To run all tests:
npm run test:all
To run lint on solidity, json, and markdown, run:
npm run lint
Separate .solhint.json
files exist for src/
and test/
.
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 TBD and TBD auditing firm.
The Euler Price Oracles code is licensed under the GPL-3.0-or-later license.