Skip to content

Commit

Permalink
Merge pull request #24 from smartcontractkit/load-config-in-memory
Browse files Browse the repository at this point in the history
Replace storage with memory access in update config
  • Loading branch information
amit-momin committed Mar 22, 2024
2 parents d15c5fb + 4df9c25 commit 55e01f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contracts/PriceOracle/PriceOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ contract PriceOracle is Ownable2Step {
* @param priceFeed The address of the new price feed the config needs to be updated to
*/
function updateConfigPriceFeed(address cToken, address priceFeed) external onlyOwner {
TokenConfig storage config = tokenConfigs[cToken];
TokenConfig memory config = tokenConfigs[cToken];
// Check if config exists for cToken
if (config.cToken == address(0)) revert ConfigNotFound(cToken);
// Validate price feed
Expand All @@ -168,7 +168,7 @@ contract PriceOracle is Ownable2Step {
_validateDecimals(priceFeed, config.underlyingAssetDecimals);

address existingPriceFeed = config.priceFeed;
config.priceFeed = priceFeed;
tokenConfigs[cToken].priceFeed = priceFeed;
emit PriceOracleAssetPriceFeedUpdated(cToken, existingPriceFeed, priceFeed);
}

Expand Down

0 comments on commit 55e01f4

Please sign in to comment.