QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Invalid

Immutable Chainlink Price Feed

Description

In ChainlinkOracle, the price feed is set as immutable in the constructor:

AggregatorV3Interface internal immutable priceFeed;
constructor(address _chainlinkFeed) {
require(_chainlinkFeed != address(0), "INVADDR");
priceFeed = AggregatorV3Interface(_chainlinkFeed);
normalizationFactor = 18 - priceFeed.decimals();
}

This means the price feed address cannot be updated if Chainlink deprecates or changes the feed address. While immutability can provide security benefits, it creates a significant risk if Chainlink needs to upgrade or deprecate a price feed, as there would be no way to update to the new feed address.

Vulnerable Code

AggregatorV3Interface internal immutable priceFeed;

Recommended Fix

Consider implementing an upgradeable pattern for the price feed:

AggregatorV3Interface private priceFeed;
constructor(address _chainlinkFeed) {
_updatePriceFeed(_chainlinkFeed);
}
function _updatePriceFeed(address _newFeed) internal {
require(_newFeed != address(0), "INVADDR");
priceFeed = AggregatorV3Interface(_newFeed);
normalizationFactor = 18 - priceFeed.decimals();
emit PriceFeedUpdated(_newFeed);
}
function updatePriceFeed(address _newFeed) external onlyOwner {
_updatePriceFeed(_newFeed);
}
Updates

Lead Judging Commences

n0kto Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Design choice
Assigned finding tags:

invalid_immutable_oracles/variables

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.