SkinnyOptimisticOracleInterface
SkinnyOptimisticOracleInterface
#
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
andcustomLiveness
can be reset after a request is already made viarequestPrice
. In the SkinnyOptimisticOracle, these parameters can only be set inrequestPrice
, 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 theSettle
event or the return value ofsettle
. - 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.
#
FunctionsrequestPrice(bytes32 identifier, uint32 timestamp, bytes ancillaryData, contract IERC20 currency, uint256 reward, uint256 bond, uint256 customLiveness) โ 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.
- bond: custom proposal bond to set for request. If set to 0, defaults to the final fee.
- customLiveness: custom proposal liveness to set for request.
proposePriceFor(address requester, bytes32 identifier, uint32 timestamp, bytes ancillaryData, struct SkinnyOptimisticOracleInterface.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 SkinnyOptimisticOracleInterface.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, uint256 bond, uint256 customLiveness, 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.
- bond: custom proposal bond to set for request. If set to 0, defaults to the final fee.
- customLiveness: custom proposal liveness to set for request.
- proposer: address to set as the proposer.
- proposedPrice: price being proposed.
disputePriceFor(bytes32 identifier, uint32 timestamp, bytes ancillaryData, struct SkinnyOptimisticOracleInterface.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 SkinnyOptimisticOracleInterface.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 SkinnyOptimisticOracleInterface.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 SkinnyOptimisticOracleInterface.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 SkinnyOptimisticOracleInterface.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.