MorphoOracle
Inherits: IMorphoOracle
Title: MorphoOracle
Adapts BasketOracle price to Morpho Blue’s 1e36 scale format.
Supports both plDXY-BEAR (direct) and plDXY-BULL (inverse) pricing.
State Variables
BASKET_ORACLE
Source price feed (BasketOracle).
AggregatorV3Interface public immutable BASKET_ORACLE
CAP
Protocol CAP price (8 decimals).
uint256 public immutable CAP
IS_INVERSE
If true, returns CAP - Price (for plDXY-BULL).
bool public immutable IS_INVERSE
STALENESS_TIMEOUT
Maximum age for valid oracle price.
uint256 public constant STALENESS_TIMEOUT = 8 hours
Functions
constructor
Creates Morpho-compatible oracle wrapper.
constructor(
address _basketOracle,
uint256 _cap,
bool _isInverse
) ;
Parameters
| Name | Type | Description |
|---|---|---|
_basketOracle | address | BasketOracle address. |
_cap | uint256 | Protocol CAP (8 decimals, e.g., 2e8 = $2.00). |
_isInverse | bool | True for plDXY-BULL (CAP - Price), false for plDXY-BEAR. |
price
Returns collateral price scaled to 1e36.
function price() external view override returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Price of 1 plDXY token in USDC terms (1e36 scale). |
Errors
MorphoOracle__InvalidPrice
Thrown when source oracle returns zero or negative price.
error MorphoOracle__InvalidPrice();
MorphoOracle__StalePrice
Thrown when source oracle data is stale.
error MorphoOracle__StalePrice();
MorphoOracle__PriceExceedsCap
Thrown when basket price exceeds protocol CAP (liquidation state).
error MorphoOracle__PriceExceedsCap();
MorphoOracle__ZeroAddress
Thrown when zero address provided to constructor.
error MorphoOracle__ZeroAddress();