Optimistic Oracle V2
Get off Chain data Optimistically on-chain using UMA's oracle
The OO is an oracle for arbitrary off-chain data which leverages an interactive escalation game between requesters, proposers and disputers and is secured by economic incentives.
There are multiple type of identifiers available like Prices , YES_OR_NO queries , Price Indexes, Insurance Claims , etc. More Approved identifiers can be found here :-
You will be working through a simple smart contract that asks the oracle the question: Q:Did the temperature on the 25th of July 2022 in Manhattan NY exceed 35c? A:1 for yes. 0 for no. After submitting the request, you will propose a solution using the UMA Optimistic Oracle UI.
Using OO v2
Start by importing the datum-contracts package
Create the contracts instance with the OOv2 Oracle Contract address
Add the
identifieras what type of oracle Data you are requesting , more info on identifier is available here
Now ancillaryData needs to be added , it depends on type of identifier , details can be found on UMA docs
Next , we need to create a Request to the Optimistic Oracle V2 , with bondCurrency , rewards and the liveness time using
requestData.
Currently rewards are not supported via DATUM oracles, so bondCurrenct and reward needs to be default
Later , Proposer will propose the answer , and disputor might dispute too under liveness time. You can also propose the answer yourself here
After the voting ends ,
settleRequestneeds to be called from Oracle , to complete and get the result
Get request result using
getRequestResultfrom Oracle
Full Example Contract
In this way , you can use Optimistic Oracle V2 in simple steps , extra info is available on the UMA docs
Last updated