Skip to main content

ReportOracle

Receives two reports of the same moment, compares them, checks the limits and passes one report to the vault. Slot 0 is any active operator of the vault, slot 1 is the second reporter.

Inherits Upgradeable base.

Anyone​

executeExceptional​

function executeExceptional(Report calldata report) external;

Applies an approved report after the waiting time, makes the books equal to it, and starts the funding windows again. Anyone can call it.

ParameterType
reportReport

Reporter​

submit​

function submit(Report calldata report) external;

Sends or replaces the report of the caller. The second matching report within the limits is applied in the same transaction.

Reporter only. Not stopped by any status except WindDown.

ParameterType
reportReport

Admin​

approveExceptional​

function approveExceptional(bytes32 reportHash, uint64 fundingUntil) external;

Starts the 24 hours for a held report. Both reporters must have sent it exactly the same. A new report from either of them cancels the approval.

Admin only. Admin cannot give numbers.

ParameterTypeDescription
reportHashbytes32
fundingUntiluint64After the report is accepted, reports up to this time are not held for the day and month limits. At most 7 days after the 24 hours. Zero lifts nothing.

24-hour time delay​

setSecondReporter​

function setSecondReporter(address reporter) external;

Replaces the second reporter.

24 hour timelock only.

ParameterType
reporteraddress

Deployer​

initialize​

function initialize(address secondReporter) external;

Sets the second reporter once, through the proxy.

ParameterType
secondReporteraddress

Read​

secondReporter​

function secondReporter() external view returns (address);
ReturnsType
-address

fundingAllowanceUntil​

function fundingAllowanceUntil() external view returns (uint64);

Reports up to this time are not held for the day and month limits.

ReturnsType
-uint64

submitted​

function submitted(uint8 slot) external view returns (Report memory);

Report waiting in a slot for the next number.

ParameterType
slotuint8
ReturnsType
-Report

lastNumber​

function lastNumber() external view returns (uint64);
ReturnsType
-uint64

lastTime​

function lastTime() external view returns (uint64);

Time of the last accepted report of any kind.

ReturnsType
-uint64

lastHour​

function lastHour() external view returns (uint64);

Time of the last accepted hourly report.

ReturnsType
-uint64

fundingWindows​

function fundingWindows() external view returns (int256 day, int256 month);

Funding rate of the last 24 and 720 hours, scaled by 1e18.

ReturnsType
dayint256
monthint256

limitsBroken​

function limitsBroken(Report calldata report) external view returns (uint256);

Limits a report breaks, one bit for each, zero when it is within all of them.

Bit 0 hour, 1 day, 2 month, 3 short size, 4 fill price, 5 fill size, 6 cash, 7 liquidation that the books do not explain.

ParameterType
reportReport
ReturnsType
-uint256

Events​

ReportSubmitted​

event ReportSubmitted(
uint8 indexed slot,
address indexed reporter,
uint64 indexed number,
Report report
);
ParameterType
slot (indexed)uint8
reporter (indexed)address
number (indexed)uint64
reportReport

ReportMismatch​

event ReportMismatch(uint64 indexed number);
ParameterType
number (indexed)uint64

ReportHeld​

event ReportHeld(uint64 indexed number, bytes32 reportHash, uint256 limits);
ParameterType
number (indexed)uint64
reportHashbytes32
limitsuint256

ReportAccepted​

event ReportAccepted(
uint64 indexed number,
uint64 indexed time,
bytes32 reportHash
);
ParameterType
number (indexed)uint64
time (indexed)uint64
reportHashbytes32

ExceptionalReportApproved​

event ExceptionalReportApproved(
uint64 indexed number,
bytes32 indexed reportHash,
uint64 readyAt,
uint64 fundingUntil
);
ParameterType
number (indexed)uint64
reportHash (indexed)bytes32
readyAtuint64
fundingUntiluint64

ExceptionalReportWithdrawn​

event ExceptionalReportWithdrawn(
uint64 indexed number,
bytes32 indexed reportHash
);
ParameterType
number (indexed)uint64
reportHash (indexed)bytes32

SecondReporterChanged​

event SecondReporterChanged(
address indexed oldReporter,
address indexed newReporter
);
ParameterType
oldReporter (indexed)address
newReporter (indexed)address

Errors​

NotReporter​

error NotReporter();

The caller is neither an operator nor the second reporter.

SameReporter​

error SameReporter();

One address cannot fill both slots.

WrongNumber​

error WrongNumber(uint64 expected);

The report is not the next one.

ParameterType
expecteduint64

WrongTime​

error WrongTime(uint64 expected);

The time is in the future, not later than the last report, or skips an hour.

ParameterType
expecteduint64

FundingOutsideHour​

error FundingOutsideHour();

An execution report carries funding or is exactly on the hour.

BadFill​

error BadFill(uint256 commandId);

A command is missing, unknown, twice or in the wrong place, its fill is below an earlier report, or it is done too early.

ParameterType
commandIduint256

BadPriceRound​

error BadPriceRound(uint80 roundId);

The Chainlink round was not in force while the command was open, or, for a liquidation, since the report before.

ParameterType
roundIduint80

NotHeld​

error NotHeld(bytes32 reportHash);

No held report has this hash.

ParameterType
reportHashbytes32

AllowanceTooLong​

error AllowanceTooLong(uint64 limit);

The allowance is too long.

ParameterType
limituint64

ExceptionalNotReady​

error ExceptionalNotReady(uint64 readyAt);

The waiting time of the exceptional report is not over.

ParameterType
readyAtuint64