Skip to content

Commit

Permalink
🚧 add tests to track contract balances (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
audsssy committed Oct 12, 2023
1 parent a5d1771 commit 2081ef8
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/KaliBerger.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down

0 comments on commit 2081ef8

Please sign in to comment.