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 Mainnet Price Oracle
copy icon
UMA
• version 1.0.0
Oracle
Finance
Utility
Cross-Chain
Audited

UMA Mainnet Price Oracle

Audited

Extension of BeaconOracle that is intended to be deployed on Mainnet to give financial contracts on non-Mainnet networks the ability to trigger cross-chain price requests to the Mainnet DVM. This contract is responsible for triggering price requests originating from non-Mainnet, and broadcasting resolved price data back to those networks. Technically, this contract is more of a Proxy than an Oracle, because it does not implement the full Oracle interface including the getPrice and requestPrice methods. It's goal is to shuttle price request functionality between L2 and L1.

*Visit desktop site to download or deploy

Version

1.0.0

Creator

UMA

Recent Use

🍞 0xDA40 downloaded

Last Publish

11/5/2022
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
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)

Get Cookin'
share iconShare

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

Recent Use

🍞 0xDA40 downloaded

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.