Skip to content

Latest commit

 

History

History
90 lines (66 loc) · 3.72 KB

README.md

File metadata and controls

90 lines (66 loc) · 3.72 KB

Quickstart for Integrating with UMA Optimistic Oracle V3

OO

This repository contains example contracts and tests for integrating with the UMA Optimistic Oracle V3.

Documentation 📚

Full documentation on how to build, test, deploy and interact with the example contracts in this repository are documented here.

This project uses Foundry. See the book for instructions on how to install and use Foundry.

Getting Started 👩‍💻

Install dependencies 👷‍♂️

On Linux and macOS Foundry toolchain can be installed with:

curl -L https://foundry.paradigm.xyz | bash
foundryup

In case there was a prior version of Foundry installed, it is advised to update it with foundryup command.

Other installation methods are documented here.

Forge manages dependencies using git submodules by default, which is also the method used in this repository. To install dependencies, run:

forge install

Compile the contracts 🏗

Compile the contracts with:

forge build

Run the tests 🧪

Test the example contracts with:

forge test

Sandboxed Optimistic Oracle environment 🚀

In order to experiment with the dispute flow on deployed example contracts, it might be useful to deploy a sandboxed Optimistic Oracle environment where dispute resolution is handled by a mock Oracle. This requires exporting following environment variables:

  • ETH_RPC_URL: URL of the RPC node to use for broadcasting deployment transactions.
  • MNEMONIC: Mnemonic of the account to use for deployment.
  • ETHERSCAN_API_KEY: API key for Etherscan, used for verifying deployed contracts.
  • DEFAULT_IDENTIFIER: Default identifier used by Optimistic Oracle V3 when resolving disputes. If not provided, this defaults to ASSERT_TRUTH identifier.
  • DEFAULT_LIVENESS: Default liveness in seconds used by Optimistic Oracle V3 when settling assertions. If not provided, this defaults to 7200 seconds.
  • DEFAULT_CURRENCY: Default currency used by Optimistic Oracle V3 when bonding assertions and disputes. If not provided, the script would also deploy a mintable ERC20 token and use it as the default currency based on following parameters:
    • DEFAULT_CURRENCY_NAME: Name of the new token. If not provided, this defaults to Default Bond Token.
    • DEFAULT_CURRENCY_SYMBOL: Symbol of the new token. If not provided, this defaults to DBT.
    • DEFAULT_CURRENCY_DECIMALS: Number of decimals of the new token. If not provided, this defaults to 18.
  • MINIMUM_BOND: Minimum bond amount in Wei of default currency required by Optimistic Oracle V3 when accepting new assertions. If not provided, this defaults to 100e18 Wei.

The sandboxed environment can be deployed and verified with:

forge script \
--broadcast \
--fork-url $ETH_RPC_URL \
--mnemonics "$MNEMONIC" \
--sender $(cast wallet address --mnemonic "$MNEMONIC") \
--verify \
script/OracleSandbox.s.sol

On other networks than Ethereum the verification might require additional --verifier-url parameter with URL of the verification API endpoint.

At the top of the script output the addresses of the deployed contracts should be logged. These will be required when deploying example contracts. Please see the documentation for more details on how to use this sandboxed environment.