From ea4e7e31b6c48322440c2550153230759a093c02 Mon Sep 17 00:00:00 2001 From: "A.L." Date: Fri, 14 Jun 2024 13:07:22 +0200 Subject: [PATCH] wip: furnish README --- README.md | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++- package.json | 2 +- 2 files changed, 91 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b08234b..d86ed45 100644 --- a/README.md +++ b/README.md @@ -1 +1,90 @@ -# TODO: Add README +# Reservoir Price Oracle + +The Reservoir Price Oracle is designed to work with +[Euler Vault Kit](https://github.com/euler-xyz/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](https://github.com/reservoir-labs/amm-core). + +## Interfaces + +For more information on the `IPriceOracle` interface, refer to Euler's [documentation](https://github.com/euler-xyz/euler-price-oracle?tab=readme-ov-file#ipriceoracle). + +For direct usages of the oracle, refer to +[IReservoirPriceOracle.sol](src/interfaces/IReservoirPriceOracle.sol) for +methods to obtain raw data from the AMM pairs. + +## Usage + +### Install + +To install Price Oracles in a [Foundry](https://github.com/foundry-rs/foundry) project: + +```sh +forge install reservoir-labs/oracle +``` + +### Development + +Clone the repo: + +```sh +git clone https://github.com/reservoir-labs/oracle.git && cd oracle +``` + +Install forge dependencies: + +```sh +forge install +``` + +[Optional] Install Node.js dependencies: + +```sh +npm install +``` + +Compile the contracts: + +```sh +forge build +``` + +### Testing + +The repo contains 3 types of tests: unit, large, and integration. + +To run all tests: + +```sh +npm run test:all +``` + +### Linting + +To run lint on solidity, json, and markdown, run: + +```sh +npm run lint +``` + +Separate `.solhint.json` files exist for `src/` and `test/`. + +## Security vulnerability disclosure + +Please report suspected security vulnerabilities in private to +[security@reservoir.fi](security@reservoir.fi). Please do NOT create publicly +viewable issues for suspected security vulnerabilities. + +## Audits + +These contracts have been audited by TBD and TBD auditing firm. + +## License + +The Euler Price Oracles code is licensed under the [GPL-3.0-or-later](LICENSE) license. diff --git a/package.json b/package.json index baa1cc9..6f3fa5e 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "submodule:check": "cd lib && find . -mindepth 1 -maxdepth 1 -type d -exec bash -c 'cd \"{}\" && pwd && ../../scripts/git-master-diff.sh && echo' \\;", "submodule:reset": "git submodule update --recursive", "test": "npm run test:unit", - "test:all": "npm run test:unit && npm run test:integration", + "test:all": "npm run test:unit && npm run test:unit-large && npm run test:integration", "test:integration": "export FOUNDRY_PROFILE=integration && forge test", "test:unit": "forge test", "test:unit-large": "export FOUNDRY_PROFILE=large-test && forge test"