Skip to main content

SkinnyOptimisticOracleV2Interface

SkinnyOptimisticOracleV2Interface#

Differences from normal OptimisticOracle:

  • refundOnDispute: flag is removed, by default there are no refunds on disputes.
  • customizing request parameters: In the OptimisticOracle, parameters like bond and customLiveness can be reset after a request is already made via requestPrice. In the SkinnyOptimisticOracle, these parameters can only be set in requestPrice, which has an expanded input set.
  • settleAndGetPrice: Replaced by settle, which can only be called once per settleable request. The resolved price can be fetched via the Settle event or the return value of settle.
  • general changes to interface: Functions that interact with existing requests all require the parameters of the request to modify to be passed as input. These parameters must match with the existing request parameters or the function will revert. This change reflects the internal refactor to store hashed request parameters instead of the full request struct.

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

Functions#

requestPrice(bytes32 identifier, uint32 timestamp, bytes ancillaryData, contract IERC20 currency, uint256 reward, struct SkinnyOptimisticOracleV2Interface.RequestSettings requestSettings) โ†’ 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.
  • requestSettings: settings for the request.
proposePriceFor(address requester, bytes32 identifier, uint32 timestamp, bytes ancillaryData, struct SkinnyOptimisticOracleV2Interface.Request request, address proposer, 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:#

  • 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.
  • request: price request parameters whose hash must match the request that the caller wants to propose a price for.
  • proposer: address to set as the proposer.
  • proposedPrice: price being proposed.
proposePrice(address requester, bytes32 identifier, uint32 timestamp, bytes ancillaryData, struct SkinnyOptimisticOracleV2Interface.Request request, int256 proposedPrice) โ†’ uint256 totalBond (external)

Proposes a price value where caller is the proposer.

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.
  • request: price request parameters whose hash must match the request that the caller wants to propose a price for.
  • proposedPrice: price being proposed.
requestAndProposePriceFor(bytes32 identifier, uint32 timestamp, bytes ancillaryData, contract IERC20 currency, uint256 reward, struct SkinnyOptimisticOracleV2Interface.RequestSettings requestSettings, address proposer, int256 proposedPrice) โ†’ uint256 totalBond (external)

Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.

The caller is the requester, but the proposer can be customized.

Parameters:#

  • identifier: price identifier to identify the existing request.
  • timestamp: timestamp to identify the existing request.
  • ancillaryData: ancillary data of the price being requested.
  • 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.
  • requestSettings: settings for the request.
  • proposer: address to set as the proposer.
  • proposedPrice: price being proposed.
disputePriceFor(bytes32 identifier, uint32 timestamp, bytes ancillaryData, struct SkinnyOptimisticOracleV2Interface.Request request, address disputer, address requester) โ†’ 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:#

  • identifier: price identifier to identify the existing request.
  • timestamp: timestamp to identify the existing request.
  • ancillaryData: ancillary data of the price being requested.
  • request: price request parameters whose hash must match the request that the caller wants to dispute.
  • disputer: address to set as the disputer.
  • requester: sender of the initial price request.
disputePrice(address requester, bytes32 identifier, uint32 timestamp, bytes ancillaryData, struct SkinnyOptimisticOracleV2Interface.Request request) โ†’ uint256 totalBond (external)

Disputes a price request with an active proposal where caller is the disputer.

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.
  • request: price request parameters whose hash must match the request that the caller wants to dispute.
settle(address requester, bytes32 identifier, uint32 timestamp, bytes ancillaryData, struct SkinnyOptimisticOracleV2Interface.Request request) โ†’ uint256 payout, int256 resolvedPrice (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.
  • request: price request parameters whose hash must match the request that the caller wants to settle.
getState(address requester, bytes32 identifier, uint32 timestamp, bytes ancillaryData, struct SkinnyOptimisticOracleV2Interface.Request request) โ†’ enum OptimisticOracleInterface.State (external)

Computes the current state of a price request. See the State enum for more details.

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.
  • request: price request parameters.
hasPrice(address requester, bytes32 identifier, uint32 timestamp, bytes ancillaryData, struct SkinnyOptimisticOracleV2Interface.Request request) โ†’ bool (public)

Checks if a given request has resolved, expired 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.
  • request: price request parameters. The hash of these parameters must match with the request hash that is associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method will revert.
stampAncillaryData(bytes ancillaryData, address requester) โ†’ bytes (public)

Generates stamped ancillary data in the format that it would be used in the case of a price dispute.

Parameters:#

  • ancillaryData: ancillary data of the price being requested.
  • requester: sender of the initial price request.