openOracle
openOracle is a price oracle, meaning it can answer the question "what is the price of ETH?" Price oracles are used all across DeFi for various applications like lending, perpetuals, and AMMs. The way openOracle works is with token commitments. If you wanted the price of ETH/USDC, you would pay a reporter to post some amount of ETH and some amount of USDC. For example, let's say Bob the reporter locks up 1 ETH and 3000 USDC, and in doing so earns 0.01 ETH as a reward. Bob's tokens are locked in the openOracle contract for a period of time, say 10 minutes. Over this entire 10 minute period, anyone has the option to swap 3000 USDC for Bob's 1 ETH, or 1 ETH for Bob's 3000 USDC. If Bob didn't put up the correct amount of ETH and USDC, he would lose money to swappers. Let's say the true price of 1 ETH is 4000 USDC, and Alice comes along and chooses to swap 3000 USDC for 1 of Bob's ETH. Alice has made $1000 from Bob! But, in openOracle, in order for Alice to swap against Bob's tokens, she must herself become the next reporter at the same time. Alice must now put up 50% more tokens: 1.5 ETH and her choice of USDC. Since the price of ETH is $4000, Alice puts up 6000 USDC, since she doesn't want to lose money to swaps like Bob did. The 10 minute timer restarts and over this period, anyone can swap 1.5 ETH for 6000 of Alice's USDC, or swap 6000 USDC for 1.5 of Alice's ETH. If nobody swaps against Alice's tokens for 10 minutes, the price is considered finalized and applications can use it. The final price comes from the ratio of token balances of the last reporter: 6000 USDC and 1.5 ETH implies 1 ETH is worth 4000 USDC. If someone wants to come swap against Alice, they must themselves put up 50% more ETH and USDC and the game repeats. We call this the oracle game. The rest of this documentation goes into how you can use the UI to play the game on Optimism mainnet today. If you would like a more technical breakdown on the smart contract and statistical level, or want to run an openOracle reporting bot instead of interact through the UI, the main docs are helpful. DISCLAIMER
The contract, protocol and UI are still in the research stage but are on production ("on-chain") networks so we can test the economic incentives since these are critical to the design.
We have worked on the contract for several months; however, it has not yet been audited. Users should be prepared to lose all funds when interacting with unaudited contracts. Another thing that has not been audited is the game theory and statistics. Users should be aware that even in the case of perfect solidity it is highly likely there are math and game theory errors that not only render this endeavor moot but also put user funds at risk. Even if it works, user misconfiguration of either oracle parameters or trading bots can lead to the loss of funds. If all of the aforementioned is done perfectly, the underlying blockchain can still fail and users can lose funds. Proceed with care.
Last updated