Skip to main content

OracleWithValidationFactory

Git Source - Generated with forge doc

Inherits: IOracleWithValidationFactory

Title: OracleWithValidationFactory

CREATE2 factory deploying OracleWithValidation instances.

The factory rejects zero addresses, identical oracles, and maxOracleDeviation >= 1e18.

The overpricing maxOracleDeviation permits must stay within the buffer the market allows, which is (1 - LLTV * maxLif), where maxLif is the max Morpho liquidation incentive factor of any market consuming the oracle. A liquidation seizes collateral worth repaidDebt * maxLif, so once overpricing exceeds this buffer a liquidation no longer covers the debt and bad debt accrues. The deviation is scaled by the primary price, so a threshold d allows up to d / (1 - d) effective overpricing (e.g. 5% allows ~5.26%); leave headroom below the buffer for both this and natural oracle drift. Setting the threshold too tight can also reject valid prices during routine drift, blocking price() and halting liquidations, which can let bad debt accumulate.

State Variables

isDeployedOracle

mapping(address => bool) public isDeployedOracle

Functions

createOracleWithValidation

Deploys a new OracleWithValidation via CREATE2.

Reverts if an oracle address is zero, the two oracles are identical, or maxOracleDeviation >= 1e18.

function createOracleWithValidation(
IOracle primaryOracle,
IOracle validationOracle,
uint256 maxOracleDeviation,
bool revertOnValidationOracleFailure,
address owner,
bytes32 salt
) external returns (address oracle);

Parameters

NameTypeDescription
primaryOracleIOracleThe primary oracle, always used for the price.
validationOracleIOracleThe validation oracle used to bound-check the primary's price.
maxOracleDeviationuint256The maximum allowed deviation, in WAD.
revertOnValidationOracleFailureboolWhether price() reverts when the validation oracle call reverts.
owneraddressThe initial owner of the deployed oracle.
saltbytes32The CREATE2 salt.

Returns

NameTypeDescription
oracleaddressThe address of the deployed oracle.