Skip to content
LogoLogo

ERC4626Oracle

Git Source

Inherits: AggregatorV2V3Interface

Title: ERC4626Oracle

Chainlink-like price oracle wrapping ERC4626 vaults. This oracle exposes the price of one share of the vault it wraps in terms of its underlying asset (the exchange rate).

Constants

version

The implementation version of this contract.

uint256 public immutable version = 1;

vault

The ERC4626 vault.

IERC4626 public immutable vault;

underlying

The underlying asset of the vault.

IERC20Metadata public immutable underlying;

decimals

The number of decimals of the price returned by this oracle.

uint8 public immutable decimals;

ONE_SHARE

One unit of the ERC4626 vault.

uint256 public immutable ONE_SHARE;

SCALING_NUMERATOR

Scaling factor numerator used to adjust price to the desired decimals.

uint256 public immutable SCALING_NUMERATOR;

State Variables

description

The description for this oracle.

string public description;

Functions

constructor

Constructor for the ERC4626Oracle.

constructor(IERC4626 _vault, uint8 _decimals);

Parameters

NameTypeDescription
_vaultIERC4626The ERC4626 vault.
_decimalsuint8The decimals to use for the price.

getPrice

function getPrice() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256

latestAnswer

function latestAnswer() external view override returns (int256);

Returns

NameTypeDescription
<none>int256

latestTimestamp

function latestTimestamp() external view override returns (uint256);

Returns

NameTypeDescription
<none>uint256

latestRound

function latestRound() external pure override returns (uint256);

Returns

NameTypeDescription
<none>uint256

getAnswer

function getAnswer(uint256) external view override returns (int256);

Parameters

NameTypeDescription
_uint256

Returns

NameTypeDescription
<none>int256

getTimestamp

function getTimestamp(uint256) external view override returns (uint256);

Parameters

NameTypeDescription
_uint256

Returns

NameTypeDescription
<none>uint256

getRoundData

function getRoundData(uint80)
        external
        view
        override
        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

Parameters

NameTypeDescription
_uint80

Returns

NameTypeDescription
roundIduint80
answerint256
startedAtuint256
updatedAtuint256
answeredInRounduint80

latestRoundData

function latestRoundData()
        external
        view
        override
        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

Returns

NameTypeDescription
roundIduint80
answerint256
startedAtuint256
updatedAtuint256
answeredInRounduint80

_latestRoundData

function _latestRoundData()
        internal
        view
        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

Returns

NameTypeDescription
roundIduint80
answerint256
startedAtuint256
updatedAtuint256
answeredInRounduint80