Overview
OracleSubmitter is a thin wrapper that sits between offchain reporters and a vault’s Oracle. Reports pass through it to the oracle, and it adds two things:
- An onchain history of every report submitted through it, per asset.
- A Chainlink-style price feed of the vault share price, denominated in the vault’s base asset.
latestRoundData() interface instead of integrating the Oracle directly.
Setup
- Reads the vault from
oracle.vault()and the base asset fromfeeManager.baseAsset(vault). Reverts withZeroBaseAssetif the vault has no base asset. - Sets
decimalsto the base asset’s decimals, or 18 for native ETH. - Grants
DEFAULT_ADMIN_ROLEtoadmin_. - Grants the oracle’s
SUBMIT_REPORTS_ROLEtosubmitter_andACCEPT_REPORT_ROLEtoaccepter_. These roles are held in theOracleSubmitter, using the same role IDs as theOracle.
OracleSubmitter contract itself must hold SUBMIT_REPORTS_ROLE and ACCEPT_REPORT_ROLE on the vault. The Oracle checks roles against the vault, and the wrapper is the account that calls it. Mellow’s deployment scripts grant both roles to the submitter contract at vault creation.
Functions
submitReports(IOracle.Report[] reports)
Callable by holders of SUBMIT_REPORTS_ROLE in the OracleSubmitter.
- Reverts with
InvalidOrderunless the first report is for the base asset. - Forwards the batch to
oracle.submitReports(reports). All oracle checks apply, including timeout, deviation limits and suspicious flags. - For each asset, reads back the stored
DetailedReportand appends it to that asset’s history. - If the base asset report is not suspicious, updates the share price feed.
acceptReports(address[] assets, uint224[] pricesD18, uint32[] timestamps)
Callable by holders of ACCEPT_REPORT_ROLE in the OracleSubmitter.
- Calls
oracle.acceptReport(asset, priceD18, timestamp)for each entry. - If an entry is for the base asset, it must be the first entry, or the call reverts with
InvalidOrder. Accepting the base asset report updates the share price feed. - Records the acceptance time in
acceptedAt[asset][index]for the asset’s latest stored report.
Share price feed
The feed stores the inverse of the oracle price:priceD18 is the number of shares per unit of base asset. latestAnswer is therefore the value of one full share (1e18 share units) in base asset units, using the base asset’s decimals.
Suspicious base asset reports do not update the feed until they are accepted. Consumers should check
updatedAt for staleness, as with any Chainlink feed.
Report history
Only reports submitted through this contract are recorded. Reports sent directly to the
Oracle do not appear in the history.
Errors
Deployments
OracleSubmitter addresses for live vaults are listed on the deployment pages, for example Lido Earn.