Request form
Cookbook may introduce a token in the future. Share and contribute to be eligible for future airdrops.
close icon
relevant tag icon
UMA Cross-Chain Price Oracle
copy icon
UMA
• version 1.0.0
Oracle
Finance
Utility
Cross-Chain
Audited

UMA Cross-Chain Price Oracle

Audited

Extension of BeaconOracle that is intended to be deployed on non-Mainnet networks to give financial contracts on those networks the ability to trigger cross-chain price requests to the Mainnet DVM. Also has the ability to receive published prices from Mainnet. This contract can be treated as the "DVM" for a non-Mainnet network, because a calling contract can request and access a resolved price request from this contract.

*Visit desktop site to download or deploy

Version

1.0.0

Creator

UMA

Last Publish

11/5/2022
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
requestPrice(bytes32,uint256) :
This function is used to request a price from the contract. It takes in three parameters: an identifier, a time, and ancillary data. It first encodes the parameters into a price request ID, and then checks if the request has already been made. If it has, the function returns. Otherwise, it calls the _requestPrice() function to make the request, and then calls the _getBridge() function to deposit the resource ID, along with the encoded parameters, onto the destination chain. (autogenerated documentation)
validateDeposit(uint8,bytes32,uint256) :
This function is used to validate a deposit on the Ethereum blockchain. It takes in four parameters: the sink chain ID, an identifier, a time, and ancillary data. It then calls the _finalizeRequest() function, which is used to finalize the deposit request and ensure that the deposit is valid. This function is used to ensure that the deposit is valid and that the data provided is correct. (autogenerated documentation)
executePublishPrice(uint8,bytes32,uint256,int256) :
This function is used to publish a price to the blockchain. It takes in a sinkChainID, an identifier, a time, ancillaryData, and a price as parameters. It then calls the _publishPrice function to publish the price to the blockchain, and then calls the _finalizePublish function to finalize the publishing process. (autogenerated documentation)
hasPrice(bytes32,uint256) :
This function checks if a price has been set for a given identifier, time, and ancillary data. It does this by first encoding the given parameters into a unique price request ID, and then checking if the corresponding entry in the 'prices' mapping has a state of 'Resolved'. If so, the function returns true, indicating that a price has been set. (autogenerated documentation)
getPrice(bytes32,uint256) :
This function is used to retrieve the price of a given asset, identified by its identifier, at a given time. It takes in the identifier, time, and ancillary data as parameters and returns an int256 representing the price. It first encodes the price request using the currentChainID, identifier, time, and ancillary data, and then looks up the price in the prices mapping. It requires that the price has been resolved before returning the price. (autogenerated documentation)
getResourceId() :
This function returns a bytes32 resource ID that is generated by hashing the parameters "Oracle" and the destinationChainID. This resource ID is used to identify the Oracle contract on the destination chain. (autogenerated documentation)
formatMetadata(uint8,bytes32,uint256) :
This function is used to format metadata into a byte array. It takes four parameters: chainID (uint8), identifier (bytes32), time (uint256), and ancillaryData (bytes). It then encodes these parameters into a byte array and returns the encoded data. The function also encodes the length of the byte array before returning it. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i uma-sink-oracle
copy icon

Last Publish

11/5/2022

Version

1.0.0

Creator

UMA

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.