AutoPoolCompounderOracle
Inherits: ChainedERC4626Oracle
Author: Storm Labs (https://storm-labs.xyz/)
A price oracle adapter for Autopool Compounder tokens that provides pricing relative to the base asset
*Extends ChainedERC4626Oracle to handle the AutopoolCompounder -> Autopool -> BaseAsset chain with additional validation for the Autopool's debt reporting staleness. The oracle validates that the Autopool's oldestDebtReporting timestamp is within 24 hours to ensure accurate pricing. If the debt reporting is stale, the oracle will revert. Chain structure:
- AutopoolCompounder (Yearn V3 Strategy, ERC4626) holds Autopool tokens
- Autopool (Tokemak Vault, ERC4626) holds base asset (e.g., USDC)
- Base Asset (e.g., USDC)*
State Variables
MAX_DEBT_REPORTING_AGE
Maximum allowed age for debt reporting (24 hours in seconds)
uint256 public constant MAX_DEBT_REPORTING_AGE = 24 hours;
autopool
The Autopool contract for debt reporting validation
IAutopool public immutable autopool;
Functions
constructor
Constructor for the AutoPoolCompounderOracle contract
The constructor automatically discovers the chain from compounder to base asset and validates that the autopool's debt reporting is fresh
constructor(IERC4626 _compounder) payable ChainedERC4626Oracle(_compounder, _getBaseAsset(_compounder));
Parameters
Name | Type | Description |
---|---|---|
_compounder | IERC4626 | The AutopoolCompounder (Yearn V3 Strategy) contract |
_getQuote
Internal function to get quote with debt reporting validation
function _getQuote(uint256 inAmount, address _base, address _quote) internal view virtual override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
inAmount | uint256 | The input amount to convert |
_base | address | The base asset address |
_quote | address | The quote asset address |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The converted amount |
_validateDebtReporting
Validates that the Autopool's debt reporting is not stale
Reverts if the oldest debt reporting timestamp is more than 24 hours old
function _validateDebtReporting() internal view;
_getBaseAsset
Helper function to extract the base asset from the compounder chain
function _getBaseAsset(IERC4626 _compounder) private view returns (address);
Parameters
Name | Type | Description |
---|---|---|
_compounder | IERC4626 | The AutopoolCompounder contract |
Returns
Name | Type | Description |
---|---|---|
<none> | address | The base asset address (e.g., USDC) |
Errors
StaleDebtReporting
Thrown when the Autopool's debt reporting is stale (older than 24 hours)
error StaleDebtReporting(uint256 oldestTimestamp, uint256 currentTimestamp);
InvalidChainLength
Thrown when the vault chain length is invalid
error InvalidChainLength();