Skip to content

Commit

Permalink
Merge pull request #92 from 1inch/fix/curve-oracle
Browse files Browse the repository at this point in the history
[SC-933] Fix CurveOracle
  • Loading branch information
ZumZoom authored Sep 22, 2023
2 parents 38be6b3 + 861b6da commit ee4ad79
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions contracts/oracles/CurveOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ contract CurveOracle is IOracle {
FunctionInfo memory info;
uint256 index = 0;
for (uint256 i = 0; i < REGISTRIES_COUNT && index < MAX_POOLS; i++) {
address pool = registries[i].find_pool_for_coins(address(srcToken), address(dstToken), index);
uint256 registryIndex = 0;
address pool = registries[i].find_pool_for_coins(address(srcToken), address(dstToken), registryIndex);
while (pool != address(0) && index < MAX_POOLS) {
index++;
(int128 srcTokenIndex, int128 dstTokenIndex, bool isUnderlying) = registries[i].get_coin_indices(pool, address(srcToken), address(dstToken));
if (!isUnderlying) {
info = FunctionInfo({
Expand Down Expand Up @@ -74,7 +76,7 @@ contract CurveOracle is IOracle {
}
ratesAndWeights.append(OraclePrices.OraclePrice(Math.mulDiv(b1, 1e18, b0), w));
}
pool = registries[i].find_pool_for_coins(address(srcToken), address(dstToken), ++index);
pool = registries[i].find_pool_for_coins(address(srcToken), address(dstToken), ++registryIndex);
}
}
(rate, weight) = ratesAndWeights.getRateAndWeight(thresholdFilter);
Expand Down

0 comments on commit ee4ad79

Please sign in to comment.