From 2081ef822af67ed2ba02c3c55b836869fa290b74 Mon Sep 17 00:00:00 2001 From: audsssy Date: Thu, 12 Oct 2023 14:00:36 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20add=20tests=20to=20track=20contr?= =?UTF-8?q?act=20balances=20(wip)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/KaliBerger.t.sol | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/test/KaliBerger.t.sol b/test/KaliBerger.t.sol index d2bcd76..59a8ea2 100644 --- a/test/KaliBerger.t.sol +++ b/test/KaliBerger.t.sol @@ -339,10 +339,10 @@ contract KaliBergerTest is Test { // Retrieve data for validation. uint256 unclaimed = kaliBerger.getUnclaimed(impactDao); + // Validate balances. vm.prank(impactDao); kaliBerger.claim(); assertEq(address(impactDao).balance, oldImpactDaoBalance + patronage); - emit log_uint(address(kaliBerger).balance); assertEq(address(kaliBerger).balance, oldBalance - 0.3 ether - unclaimed); } // timestamp: 6000 @@ -362,12 +362,19 @@ contract KaliBergerTest is Test { vm.prank(bob); kaliBerger.exit(address(token_1), 1, deposit - patronage); - // Validate + // Validate token assertEq(kaliBerger.getDeposit(address(token_1), 1), 0); assertEq(token_1.balanceOf(address(kaliBerger)), 1); validatePatronageToCollect(token_1, 1); - // TODO: Validate KaliBerger balance - // assertEq(address(kaliBerger).balance, 0.1 ether); + + // Validate balances. + vm.prank(impactDao); + kaliBerger.claim(); + // emit log_uint(unclaimed); + // emit log_uint(address(impactDao).balance); + // emit log_uint(address(kaliBerger).balance); + assertEq(address(impactDao).balance, oldImpactDaoBalance + patronage); + assertEq(address(kaliBerger).balance, 0); } /// @notice Bob withdraws too much and triggers InvalidExit() error.