-
Notifications
You must be signed in to change notification settings - Fork 0
Constant round ID implementation leads to inconsistent Chainlink interface behavior #13
Description
Description
The ERC4626PriceFeed contract serves as an adapter to expose ERC4626 vault share pricing through the Chainlink AggregatorV2V3Interface. The contract implements price feed functionality by calling vault.convertToAssets(1e18) to determine the asset value of vault shares. However, the current implementation uses a constant CURRENT_ROUND_ID = 1 for all round-related functions, effectively treating all price queries as the same round regardless of when they occur. This breaks the Chainlink interface expectation that different rounds represent distinct data points. Functions like ERC4626PriceFeed::getRoundData and ERC4626PriceFeed::getAnswer will always return the current real-time price for any valid round ID, making historical data retrieval impossible and potentially breaking integrations that rely on proper round differentiation.
Recommendation
Implement proper round tracking by introducing storage variables to track round increments and store historical round data. Add a currentRoundId storage variable that increments when new data is fetched, and use mappings to store round-specific data for retrieval by historical round queries.