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
| Name | Type | Description |
|---|---|---|
primaryOracle | IOracle | The primary oracle, always used for the price. |
validationOracle | IOracle | The validation oracle used to bound-check the primary's price. |
maxOracleDeviation | uint256 | The maximum allowed deviation, in WAD. |
revertOnValidationOracleFailure | bool | Whether price() reverts when the validation oracle call reverts. |
owner | address | The initial owner of the deployed oracle. |
salt | bytes32 | The CREATE2 salt. |
Returns
| Name | Type | Description |
|---|---|---|
oracle | address | The address of the deployed oracle. |