publishPrice(uint8,bytes32,uint256) :
This function is used to publish a price to a sink chain. It first checks that the price has been resolved by the DVM, then it publishes the price to the sink chain and deposits the metadata associated with the price to the bridge. The function takes in the sink chain ID, an identifier, a timestamp, and ancillary data as parameters. The function then calls the _getOracle() and _getBridge() functions to retrieve the Oracle and Bridge contracts, respectively. It then calls the hasPrice() and getPrice() functions on the Oracle contract to check if the price has been resolved and to retrieve the price, respectively. Finally, it calls the _publishPrice() and deposit() functions on the Bridge contract to publish (autogenerated documentation)
validateDeposit(uint8,bytes32,uint256,int256) :
This function validates a deposit made to the contract. It takes in the sink chain ID, an identifier, a timestamp, ancillary data, and the price of the deposit as parameters. It then uses the _encodePriceRequest() function to generate a price request ID from the parameters. It then looks up the price in the prices mapping using the price request ID. If the price matches the price passed in as a parameter, the _finalizePublish() function is called to finalize the deposit. (autogenerated documentation)
executeRequestPrice(uint8,bytes32,uint256) :
This function is used to request a price from an oracle. It first calls the _requestPrice() function, which is used to store the request data in the contract. It then calls the _finalizeRequest() function, which is used to finalize the request and ensure that the data is stored correctly. Finally, it calls the _getOracle() function, which is used to retrieve the oracle address and then calls the requestPrice() function on the oracle, passing in the identifier, time, and ancillary data. This allows the oracle to provide the requested price. (autogenerated documentation)
getResourceId() :
This function returns a bytes32 value that is the keccak256 hash of the string "Oracle" concatenated with the currentChainID. This is used to uniquely identify the Oracle resource on the blockchain. (autogenerated documentation)
_getOracle() :
This function is an internal view function that returns an OracleAncillaryInterface. It does this by using the finder contract to get the address of the Oracle contract, and then using that address to create an instance of the OracleAncillaryInterface. This allows the contract to interact with the Oracle contract in order to access data or perform other operations. (autogenerated documentation)
formatMetadata(uint8,bytes32,uint256,int256) :
This function is used to format metadata into a byte array. It takes in five parameters: chainID (uint8), identifier (bytes32), time (uint256), ancillaryData (bytes), and price (int256). It then encodes these parameters into a byte array and returns the encoded data. The encoded data includes the length of the metadata and the metadata itself. (autogenerated documentation)