From 4785f5780e670df082189cc32cb5a3e391b81b17 Mon Sep 17 00:00:00 2001 From: pizzaman1337 Date: Sun, 22 Sep 2024 22:39:55 -0600 Subject: [PATCH] Try catch on calcReserveAtRatioSwap in calculateDeltaBAtBeanIndex --- .../libraries/Minting/LibWellMinting.sol | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/protocol/contracts/libraries/Minting/LibWellMinting.sol b/protocol/contracts/libraries/Minting/LibWellMinting.sol index 4005b19a9..d5060b474 100644 --- a/protocol/contracts/libraries/Minting/LibWellMinting.sol +++ b/protocol/contracts/libraries/Minting/LibWellMinting.sol @@ -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; + } } /**