DataFeed
An overview of the core Warlock Oracle DataFeed contract.
DataFeed.sol serves as a central contract that facilitates all primary oracle related functionality:
Price updates
Price requests
Recent
Historic
Submitted data verification
With a single entry point for all activity Warlock is able to offer the scalable addition of assets, and a predictable request structure for consumers.
Unlike competitors/contemporaries which require unique deployments for every market pair, a consumer can request a price for any given market asset
and base
currency:
For example:
Alongside this streamlined Oracle design, our batched liquidation system allows us to provide pricing for niche assets that may not be economically feasible in other contexts.
If you would like us to support a niche market for you, please reach out through our discord or telegram.
Technical Documentation
DataFeed
State Variables
dataFeedSigner
The address of the Sauron dataFeedSigner Multisig / EOA which is authorized to sign price data.
dataFeedExecutor
The address of the Sauron executor Multisig / EOA which is authorized to execute price data updates.
maximumDelay
The maximum delay in seconds that is allowed between the calculatedTimestamp and the submittedTimestamp.
updateThreshold
The threshold in seconds that is used to determine if the price data is stale.
admin
The address of the admin which is authorized to change the dataFeedSigner & maximumDelay.
prices
A mapping of asset -> base that returns priceData.
historicPrices
A mapping of asset -> base -> timestamp that returns historic priceData.
lastUpdated
A mapping of asset -> base that returns the lastUpdated timestamp.
nonces
We use a separate mapping for nonces to reduce gas costs on push
.
NAME
The EIP-712 domain name.
domain
The EIP-712 domain separator, computed on construction.
Functions
constructor
setAdmin
Sets Admin.
Parameters
setSigner
Sets Signer.
Parameters
setMaximumDelay
Sets maximum delay.
Parameters
getRecentPrice
Returns the most recent price data for a given asset/base pair.
Parameters
getHistoricPrice
Returns the historic price data for a given asset/base pair and nonce.
Parameters
push
Allows any party to push a price update provided the data is valid and the updateThreshold has been exceeded.
Parameters
authPush
Allows only the authorized executor to push a price update without validating the updateThreshold.
Parameters
validate
Checks the validity of submitted price data and it's signature.
Parameters
authorized
Allows only the authorized contract to execute the method.
Parameters
Events
PriceUpdate
Errors
Exception
A single custom error capable of indicating a wide range of detected errors by providing an error code value whose string representation is documented, and any possible other values that are pertinent to the error.
Structs
PriceData
A struct that contains the price data for a given asset/base pair round.
calculatedTimestamp
The timestamp that the price data was calculated at
submittedTimestamp
The block.timestamp that the price data was submitted at
submittedBlock
The block number that the price data was submitted at
price
The price of the asset/base pair
asset
The asset which a user is requesting the price of
base
The base currency that the asset
is priced against
Last updated