SpotOracle

Git Source

The SpotOracle is supposed to reflect the current market price of a collateral asset. It is used by IonPool to determine the health factor of a vault as a user is opening or closing a position. NOTE: The price data provided by this contract is not used by the liquidation module at all. The spot price will also always be bounded by the collateral's corresponding reserve oracle price to ensure that a user can never open position that is directly liquidatable.

State Variables

LTV

uint256 public immutable LTV;

RESERVE_ORACLE

ReserveOracle public immutable RESERVE_ORACLE;

Functions

constructor

Creates a new SpotOracle instance.

constructor(uint256 _ltv, address _reserveOracle);

Parameters

NameTypeDescription

_ltv

uint256

Loan to value ratio for the collateral.

_reserveOracle

address

Address for the associated reserve oracle.

getPrice

Gets the price of the collateral asset in ETH.

Overridden by collateral specific spot oracle contracts.

function getPrice() public view virtual returns (uint256 price);

Returns

NameTypeDescription

price

uint256

of the asset in ETH. [WAD]

getSpot

Gets the risk-adjusted market price.

function getSpot() external view returns (uint256 spot);

Returns

NameTypeDescription

spot

uint256

The risk-adjusted market price.

Errors

InvalidLtv

error InvalidLtv(uint256 ltv);

InvalidReserveOracle

error InvalidReserveOracle();