SwEthSpotOracle

Git Source

Inherits: SpotOracle

The swETH spot oracle.

State Variables

POOL

IUniswapV3Pool public immutable POOL;

SECONDS_AGO

uint32 public immutable SECONDS_AGO;

Functions

constructor

Creates a new SwEthSpotOracle instance.

constructor(
    uint256 _ltv,
    address _reserveOracle,
    address _uniswapPool,
    uint32 _secondsAgo
)
    SpotOracle(_ltv, _reserveOracle);

Parameters

getPrice

Gets the price of swETH in ETH.

Uniswap returns price in swETH per ETH. This needs to be inversed.

function getPrice() public view override returns (uint256 ethPerSwEth);

Returns

_getPriceInWadFromSqrtPriceX96

Converts a sqrtPriceX96 to a price in WAD.

function _getPriceInWadFromSqrtPriceX96(uint256 sqrtPriceX96) internal pure returns (uint256);

Parameters

Errors

InvalidSecondsAgo

error InvalidSecondsAgo(uint32 invalidSecondsAgo);