Skip to main content

OptimisticOracleInterface

OptimisticOracleInterface#

Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.

Functions#

defaultLiveness() โ†’ uint256 (external)
finder() โ†’ contract FinderInterface (external)
getCurrentTime() โ†’ uint256 (external)
requestPrice(bytes32 identifier, uint256 timestamp, bytes ancillaryData, contract IERC20 currency, uint256 reward) โ†’ uint256 totalBond (external)

Requests a new price.

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.
setBond(bytes32 identifier, uint256 timestamp, bytes ancillaryData, uint256 bond) โ†’ uint256 totalBond (external)

Set 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.
setRefundOnDispute(bytes32 identifier, uint256 timestamp, bytes ancillaryData) (external)

Sets the request to refund the reward if the proposal is disputed. This can help to "hedge" the caller in the event of a dispute-caused delay. Note: in the event of a dispute, the winner still receives the other's bond, so there is still profit to be made even if the reward is refunded.

Parameters:#

  • identifier: price identifier to identify the existing request.
  • timestamp: timestamp to identify the existing request.
  • ancillaryData: ancillary data of the price being requested.
setCustomLiveness(bytes32 identifier, uint256 timestamp, bytes ancillaryData, uint256 customLiveness) (external)

Sets a custom liveness value for the request. Liveness is the amount of time a proposal must wait before being auto-resolved.

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.
proposePriceFor(address proposer, address requester, bytes32 identifier, uint256 timestamp, bytes ancillaryData, int256 proposedPrice) โ†’ uint256 totalBond (public)

Proposes a price value on another address' behalf. Note: this address will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.

Parameters:#

  • proposer: address to set as the proposer.
  • 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.
proposePrice(address requester, bytes32 identifier, uint256 timestamp, bytes ancillaryData, int256 proposedPrice) โ†’ uint256 totalBond (external)

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.
disputePriceFor(address disputer, address requester, bytes32 identifier, uint256 timestamp, bytes ancillaryData) โ†’ uint256 totalBond (public)

Disputes a price request with an active proposal on another address' behalf. Note: this address will receive any rewards that come from this dispute. However, any bonds are pulled from the caller.

Parameters:#

  • disputer: address to set as the disputer.
  • 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.
disputePrice(address requester, bytes32 identifier, uint256 timestamp, bytes ancillaryData) โ†’ uint256 totalBond (external)

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.
settleAndGetPrice(bytes32 identifier, uint256 timestamp, bytes ancillaryData) โ†’ int256 (external)

Retrieves a price that was previously requested by a caller. Reverts if the request is not settled or settleable. Note: this method is not view so that this call may actually settle the price request if it hasn't been settled.

Parameters:#

  • identifier: price identifier to identify the existing request.
  • timestamp: timestamp to identify the existing request.
  • ancillaryData: ancillary data of the price being requested.
settle(address requester, bytes32 identifier, uint256 timestamp, bytes ancillaryData) โ†’ uint256 payout (external)

Attempts to settle an outstanding price request. Will revert if it isn't settleable.

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.
getRequest(address requester, bytes32 identifier, uint256 timestamp, bytes ancillaryData) โ†’ struct OptimisticOracleInterface.Request (public)

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.
getState(address requester, bytes32 identifier, uint256 timestamp, bytes ancillaryData) โ†’ enum OptimisticOracleInterface.State (public)

Returns the state of 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.
hasPrice(address requester, bytes32 identifier, uint256 timestamp, bytes ancillaryData) โ†’ bool (public)

Checks if a given request has resolved or been settled (i.e the optimistic oracle has a price).

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.
stampAncillaryData(bytes ancillaryData, address requester) โ†’ bytes (public)

Events#

RequestPrice(address requester, bytes32 identifier, uint256 timestamp, bytes ancillaryData, address currency, uint256 reward, uint256 finalFee)
ProposePrice(address requester, address proposer, bytes32 identifier, uint256 timestamp, bytes ancillaryData, int256 proposedPrice, uint256 expirationTimestamp, address currency)
DisputePrice(address requester, address proposer, address disputer, bytes32 identifier, uint256 timestamp, bytes ancillaryData, int256 proposedPrice)
Settle(address requester, address proposer, address disputer, bytes32 identifier, uint256 timestamp, bytes ancillaryData, int256 price, uint256 payout)