Skip to main content

OracleRootTunnel

OracleRootTunnel#

This contract must be a registered financial contract in order to make DVM price requests.

Functions#

constructor(address _checkpointManager, address _fxRoot, address _finderAddress) (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)
receiveMessage(bytes inputData) (public)

receive message from L2 to L1, validated by proof

This function verifies if the transaction actually happened on child chain

Parameters:#

  • inputData: RLP encoded data of the reference tx containing following list of fields 0 - headerNumber - Checkpoint header block number containing the reference tx 1 - blockProof - Proof that the block header (in the child chain) is a leaf in the submitted merkle root 2 - blockNumber - Block number containing the reference tx on child chain 3 - blockTime - Reference tx block time 4 - txRoot - Transactions root of block 5 - receiptRoot - Receipts root of block 6 - receipt - Receipt of the reference transaction 7 - receiptProof - Merkle proof of the reference receipt 8 - branchMask - 32 bits denoting the path of receipt in merkle tree 9 - receiptLogIndex - Log Index to read from the receipt
_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#

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.