Skip to main content

OracleRootTunnelMock

OracleRootTunnelMock#

Functions#

constructor(address _checkpointManager, address _fxRoot, address _finderAddress) (public)
processMessageFromChild(bytes message) (public)
receiveMessage(bytes inputData) (public)
setRevertReceiveMessage(bool _revertReceiveMessage) (public)
setRevertErrorMessage(string _errorMessage) (public)
publishPrice(bytes32 identifier, uint256 time, bytes ancillaryData) (public)

This is the first method that should be called in order to publish a price request to the sidechain.

Publishes the DVM resolved price for the price request, or reverts if not resolved yet. This contract must be registered with the DVM to query price requests.

Parameters:#

  • identifier: Identifier of price request to resolve.
  • time: Timestamp of price request to resolve.
  • ancillaryData: extra data of price request to resolve.
_processMessageFromChild(bytes data) (internal)

Submits a price request.

This internal method will be called inside receiveMessage(bytes memory inputData). The inputData is a proof of transaction that is derived from the transaction hash of the transaction on the child chain that originated the cross-chain price request via _sendMessageToRoot. This contract must be registered with the DVM to submit price requests.

Parameters:#

  • data: ABI encoded params with which to call requestPrice.
_getOracle() → contract OracleAncillaryInterface (internal)

Return DVM for this network.

_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (internal)
setFxChildTunnel(address _fxChildTunnel) (public)
_sendMessageToChild(bytes message) (internal)

Send bytes message to Child Tunnel

Parameters:#

  • message: bytes message that will be sent to Child Tunnel some message examples - abi.encode(tokenId); abi.encode(tokenId, tokenMetadata); abi.encode(messageType, messageData);
_validateAndExtractMessage(bytes inputData) → bytes (internal)
_requestPrice(bytes32 identifier, uint256 time, bytes ancillaryData) (internal)

Enqueues a request (if a request isn't already present) for the given (identifier, time, ancillary data) combination. Will only emit an event if the request has never been requested.

_publishPrice(bytes32 identifier, uint256 time, bytes ancillaryData, int256 price) (internal)

Publishes price for a requested query. Will only emit an event if the request has never been resolved.

_encodePriceRequest(bytes32 identifier, uint256 time, bytes ancillaryData) → bytes32 (internal)

Returns the convenient way to store price requests, uniquely identified by {identifier, time, ancillaryData }.

Events#

ReceivedMessage(bytes inputData)
PriceRequestAdded(bytes32 identifier, uint256 time, bytes ancillaryData, bytes32 requestHash)
PushedPrice(bytes32 identifier, uint256 time, bytes ancillaryData, int256 price, bytes32 requestHash)

Modifiers#

nonReentrant()

Prevents a contract from calling itself, directly or indirectly. Calling a nonReentrant function from another nonReentrant function is not supported. It is possible to prevent this from happening by making the nonReentrant function external, and making it call a private function that does the actual state modification.

nonReentrantView()

Designed to prevent a view-only method from being re-entered during a call to a nonReentrant() state-changing method.