Skip to content

Commit

Permalink
Try catch on calcReserveAtRatioSwap in calculateDeltaBAtBeanIndex (#1111
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Brean0 authored Sep 23, 2024
2 parents 0cb7518 + 4785f57 commit 98cb874
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions protocol/contracts/libraries/Minting/LibWellMinting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,18 @@ library LibWellMinting {
uint256 beanIndex
) internal view returns (int256) {
Call memory wellFunction = IWell(well).wellFunction();
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 reserveAtRatioSwap) {
return int256(reserveAtRatioSwap).sub(int256(reserves[beanIndex]));
} catch {
return 0;
}
}

/**
Expand Down

0 comments on commit 98cb874

Please sign in to comment.