From 833ed845484efba4ca20d28681ffd2942e179235 Mon Sep 17 00:00:00 2001 From: Guillaume Lambert Date: Tue, 21 Nov 2023 10:53:27 -0500 Subject: [PATCH] fix: properly compute balances --- contracts/CollateralTracker.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/CollateralTracker.sol b/contracts/CollateralTracker.sol index 98f2747..2301c93 100644 --- a/contracts/CollateralTracker.sol +++ b/contracts/CollateralTracker.sol @@ -1371,10 +1371,10 @@ contract CollateralTracker is ERC20Minimal, Multicall { uint256 collateralAmount = convertToAssets(balanceOf[user]); // add/subtract the accumulated premia to the collateral amount - uint256 netBalance; + uint256 netBalance = collateralAmount; if (premiumAllPositions > 0) { unchecked { - netBalance = collateralAmount + uint256(uint128(premiumAllPositions)); + netBalance += uint256(uint128(premiumAllPositions)); } }