ERC4626Oracle
Inherits: BaseAdapter
Author: Storm Labs (https://storm-labs.xyz/)
A price oracle adapter for ERC4626 vault tokens
Handles price conversions between ERC4626 vault shares and their underlying assets. When the vault token is used as the base or quote, the oracle automatically converts between share and asset prices using the vault's convertToAssets/convertToShares functions. The oracle follows the behavior of the ERC4626 vault's implementation of its functions, typically ignoring the maximum amount of shares that can be redeemed or minted. This oracle relies on the convertToAssets/convertToShares functions of the underlying ERC4626 vault. If the dependent ERC4626 contract does not implement sufficient protection against donation attacks, sudden price jumps may occur when large amounts of assets are donated to the vault without a proportional increase in shares. Users should verify the security measures implemented by the underlying vault. Due to this risk, this oracle should only be used when there is no direct price feed available for the vault token.
State Variables
name
The name of the oracle.
string public constant override name = "ERC4626Oracle";
base
The address of the base asset.
address public immutable base;
quote
The address of the quote asset.
address public immutable quote;
Functions
constructor
Constructor for the ERC4626Oracle contract.
constructor(IERC4626 _vault) payable;
Parameters
Name | Type | Description |
---|---|---|
_vault | IERC4626 | The ERC4626 vault that should be used as the base asset. |
_getQuote
function _getQuote(uint256 inAmount, address _base, address _quote) internal view virtual override returns (uint256);