Optimistic Oracle V3
Assert Statements by making a truth claim on-chain
The OOV3 works by making a truth claim about the world, stating that something has happened or is true. Once asserted, the assertion enters a challenge period wherein someone can disagree with the assertion, by disputing it. If no one disputes it during the challenge window the statement is taken as true. If disputed, the outcome is arbitrated using the UMA DVM (more info on how this works here).
It differs from the Optimistic Oracle V2 (getting started can be found here) by being easier to reason about and simpler in integration points.
In this tutorial you will be working through a simple smart contract that asserts the following truth: Statement: Argentina won the 2022 Fifa world cup in Qatar.
Using OO v3
Start by importing the datum-contracts package
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;
import "datum-contracts/interfaces/OptimisticOracleV3Interface.sol";Create the contracts instance with the OOv3 Oracle Contract address
// For Sepolia
oracleAddress = 0xa197690c527C4015e557185E42997d65348fD377
OptimisticOracleV3 oa =
OptimisticOracleV3(oracleAddress);
This is the main step where we define the assertedClaim , could be any truth statement from the realWorld.
Next , we need to just assert the Claim from Oracle using
assertTruthWithDefaultswith the assertedClaim
Currently DATUM only supports the default method
Later ,it will under challenge period for 120 seconds and the final result will be added to the contract
After the voting ends ,
settleAssertionneeds to be called from Oracle , to complete and get the result
Get assertion result using
getAssertionResultfrom Oracle
Full Contract Code
In this way , you can use Optimistic Oracle V3 in simple steps , extra info is available on the UMA docs
Last updated