Skip to content

Commit

Permalink
add tryCatch to LibDeltaB
Browse files Browse the repository at this point in the history
  • Loading branch information
Brean0 committed Sep 23, 2024
1 parent 6d645e1 commit d5714c8
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions protocol/contracts/libraries/Oracle/LibDeltaB.sol
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,17 @@ library LibDeltaB {
revert("Well: USD Oracle call failed");
}

return
int256(
IBeanstalkWellFunction(wellFunction.target).calcReserveAtRatioSwap(
reserves,
beanIndex,
ratios,
wellFunction.data
)
).sub(int256(reserves[beanIndex]));
try
IBeanstalkWellFunction(wellFunction.target).calcReserveAtRatioSwap(
reserves,
beanIndex,
ratios,
wellFunction.data
)
returns (uint256 reserve) {
return int256(reserve).sub(int256(reserves[beanIndex]));
} catch {
return 0;
}
}
}

0 comments on commit d5714c8

Please sign in to comment.