TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Polymarket/uma-ctf-adapter/llms.txt
Use this file to discover all available pages before exploring further.
IOptimisticOracleV2 interface defines the functionality for interacting with UMA’s Optimistic Oracle V2, which allows for optimistic price resolution with a dispute mechanism.
Overview
The Optimistic Oracle V2 operates on an optimistic assertion model:- A requester submits a price request with associated parameters
- A proposer can propose a price by posting a bond
- During a liveness period, anyone can dispute the proposed price
- If no dispute occurs, the proposed price is accepted
- If disputed, the matter is escalated to UMA’s Data Verification Mechanism (DVM)
Structs
RequestSettings
Configuration settings for a price request.Fields
eventBased- True if the request is set to be event-based.refundOnDispute- True if the requester should be refunded their reward on dispute.callbackOnPriceProposed- True if callbackOnPriceProposed callback is required.callbackOnPriceDisputed- True if callbackOnPriceDisputed callback is required.callbackOnPriceSettled- True if callbackOnPriceSettled callback is required.bond- Bond that the proposer and disputer must pay on top of the final fee.customLiveness- Custom liveness value set by the requester.
Request
Represents a price request.Fields
proposer- Address of the proposer.disputer- Address of the disputer.currency- ERC20 token used to pay rewards and fees.settled- True if the request is settled.requestSettings- Custom settings associated with the request.proposedPrice- Price that the proposer submitted.resolvedPrice- Price resolved once the request is settled.expirationTime- Time at which the request auto-settles without a dispute.reward- Amount of the currency to pay to the proposer on settlement.finalFee- Final fee to pay to the Store upon request to the DVM.
Core Functions
requestPrice
Requests a new price from the oracle.Parameters
identifier- Price identifier being requested.timestamp- Timestamp of the price being requested.ancillaryData- Ancillary data representing additional args being passed with the price request.currency- ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.reward- Reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0, which could make sense if the contract requests and proposes the value in the same call or provides its own reward system.
Returns
totalBond- Default bond (final fee) + final fee that the proposer and disputer will be required to pay. This can be changed with a subsequent call tosetBond().
proposePrice
Proposes a price value for an existing price request.Parameters
requester- Sender of the initial price request.identifier- Price identifier to identify the existing request.timestamp- Timestamp to identify the existing request.ancillaryData- Ancillary data of the price being requested.proposedPrice- Price being proposed.
Returns
totalBond- The amount pulled from the proposer’s wallet as a bond. The bond will be returned to the proposer once settled if the proposal is correct.
disputePrice
Disputes a price value for an existing price request with an active proposal.Parameters
requester- Sender of the initial price request.identifier- Price identifier to identify the existing request.timestamp- Timestamp to identify the existing request.ancillaryData- Ancillary data of the price being requested.
Returns
totalBond- The amount pulled from the disputer’s wallet as a bond. The bond will be returned to the disputer once settled if the dispute was valid (the proposal was incorrect).
Configuration Functions
setBond
Sets the proposal bond associated with a price request.Parameters
identifier- Price identifier to identify the existing request.timestamp- Timestamp to identify the existing request.ancillaryData- Ancillary data of the price being requested.bond- Custom bond amount to set.
Returns
totalBond- New bond + final fee that the proposer and disputer will be required to pay. This can be changed again with a subsequent call tosetBond().
setEventBased
Sets the request to be an “event-based” request.- The timestamp at which the request is evaluated is the time of the proposal, not the timestamp associated with the request.
- The proposer cannot propose the “too early” value (TOO_EARLY_RESPONSE). This ensures that a proposer who prematurely proposes a response loses their bond.
- RefundOnDispute is automatically set, meaning disputes trigger the reward to be automatically refunded to the requesting contract.
Parameters
identifier- Price identifier to identify the existing request.timestamp- Timestamp to identify the existing request.ancillaryData- Ancillary data of the price being requested.
setCallbacks
Sets which callbacks should be enabled for the request.Parameters
identifier- Price identifier to identify the existing request.timestamp- Timestamp to identify the existing request.ancillaryData- Ancillary data of the price being requested.callbackOnPriceProposed- Whether to enable the callback onPriceProposed.callbackOnPriceDisputed- Whether to enable the callback onPriceDisputed.callbackOnPriceSettled- Whether to enable the callback onPriceSettled.
setCustomLiveness
Sets a custom liveness value for the request.Parameters
identifier- Price identifier to identify the existing request.timestamp- Timestamp to identify the existing request.ancillaryData- Ancillary data of the price being requested.customLiveness- New custom liveness.
Settlement Functions
settle
Attempts to settle an outstanding price request.Parameters
requester- Sender of the initial price request.identifier- Price identifier to identify the existing request.timestamp- Timestamp to identify the existing request.ancillaryData- Ancillary data of the price being requested.
Returns
payout- The amount that the “winner” (proposer or disputer) receives on settlement. This amount includes the returned bonds as well as additional rewards.
settleAndGetPrice
Retrieves a price that was previously requested by a caller.Parameters
identifier- Price identifier to identify the existing request.timestamp- Timestamp to identify the existing request.ancillaryData- Ancillary data of the price being requested.
Returns
int256- The resolved price.
View Functions
getRequest
Gets the current data structure containing all information about a price request.Parameters
requester- Sender of the initial price request.identifier- Price identifier to identify the existing request.timestamp- Timestamp to identify the existing request.ancillaryData- Ancillary data of the price being requested.
Returns
Request- The Request data structure.
hasPrice
Checks if a given request has resolved or been settled.Parameters
requester- Sender of the initial price request.identifier- Price identifier to identify the existing request.timestamp- Timestamp to identify the existing request.ancillaryData- Ancillary data of the price being requested.
Returns
bool- True if price has resolved or settled, false otherwise.
defaultLiveness
Returns the default liveness period.Returns
uint256- The default liveness period in seconds.