Skip to content

Commit

Permalink
fix issue audit-6.8
Browse files Browse the repository at this point in the history
  • Loading branch information
danoctavian committed Mar 27, 2024
1 parent a0393f2 commit fc9cc1c
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/YieldNestOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ contract YieldNestOracle is AccessControlUpgradeable, IYieldNestOracleEvents {
revert ArraysLengthMismatch({assetsLength: init.assets.length, priceFeedAddressesLength: init.priceFeedAddresses.length, maxAgesLength: init.maxAges.length});
}
for (uint256 i = 0; i < init.assets.length; i++) {
if(init.assets[i] == address(0)) {
revert ZeroAddress();
}
if(init.priceFeedAddresses[i] == address(0)) {
revert ZeroAddress();
}
_setAssetPriceFeed(init.assets[i], init.priceFeedAddresses[i], init.maxAges[i]);
}
}
Expand All @@ -69,6 +63,10 @@ contract YieldNestOracle is AccessControlUpgradeable, IYieldNestOracleEvents {
* @param maxAge The maximum age (in seconds) of the price feed data to be considered valid.
*/
function setAssetPriceFeed(address asset, address priceFeedAddress, uint256 maxAge) public onlyRole(ORACLE_MANAGER_ROLE) {
_setAssetPriceFeed(asset, priceFeedAddress, maxAge);
}

function _setAssetPriceFeed(address asset, address priceFeedAddress, uint256 maxAge) internal {
if(priceFeedAddress == address(0) || asset == address(0)) {
revert ZeroAddress();
}
Expand All @@ -77,10 +75,6 @@ contract YieldNestOracle is AccessControlUpgradeable, IYieldNestOracleEvents {
revert ZeroAge();
}

_setAssetPriceFeed(asset, priceFeedAddress, maxAge);
}

function _setAssetPriceFeed(address asset, address priceFeedAddress, uint256 maxAge) internal {
assetPriceFeeds[asset] = AssetPriceFeed(AggregatorV3Interface(priceFeedAddress), maxAge);
emit AssetPriceFeedSet(asset, priceFeedAddress, maxAge);
}
Expand Down

0 comments on commit fc9cc1c

Please sign in to comment.