From d5714c86e949c58939f273c3edb5095c22877079 Mon Sep 17 00:00:00 2001 From: Brean0 Date: Mon, 23 Sep 2024 08:46:11 -0500 Subject: [PATCH] add tryCatch to LibDeltaB --- .../contracts/libraries/Oracle/LibDeltaB.sol | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/protocol/contracts/libraries/Oracle/LibDeltaB.sol b/protocol/contracts/libraries/Oracle/LibDeltaB.sol index d5eab259b..6f84694a7 100644 --- a/protocol/contracts/libraries/Oracle/LibDeltaB.sol +++ b/protocol/contracts/libraries/Oracle/LibDeltaB.sol @@ -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; + } } }