Skip to content

Commit

Permalink
fix: handle check balances before and after
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomariscal committed Dec 16, 2024
1 parent aa47d27 commit 48c9ca6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions l2-contracts/test/ZkCappedMinterV2.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ contract Mint is ZkCappedMinterV2Test {

_grantMinterRole(cappedMinter, cappedMinterAdmin, _minter);

uint256 amountBefore = token.balanceOf(_receiver);

vm.prank(_minter);
cappedMinter.mint(_receiver, _amount);
assertEq(token.balanceOf(_receiver), _amount);
assertEq(token.balanceOf(_receiver), amountBefore + _amount);
}

function testFuzz_MintsNewTokensInSuccessionToDifferentAccountsWhileRemainingBelowCap(
Expand All @@ -86,13 +88,16 @@ contract Mint is ZkCappedMinterV2Test {

_grantMinterRole(cappedMinter, cappedMinterAdmin, _minter);

uint256 amountBefore1 = token.balanceOf(_receiver1);
uint256 amountBefore2 = token.balanceOf(_receiver2);

vm.startPrank(_minter);
cappedMinter.mint(_receiver1, _amount1);
cappedMinter.mint(_receiver2, _amount2);
vm.stopPrank();

assertEq(token.balanceOf(_receiver1), _amount1);
assertEq(token.balanceOf(_receiver2), _amount2);
assertEq(token.balanceOf(_receiver1), amountBefore1 + _amount1);
assertEq(token.balanceOf(_receiver2), amountBefore2 + _amount2);
}

function testFuzz_RevertIf_MintAttemptedByNonMinter(address _nonMinter, uint256 _amount) public {
Expand Down

0 comments on commit 48c9ca6

Please sign in to comment.