Skip to content

Commit

Permalink
fix: use global minter
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomariscal committed Dec 12, 2024
1 parent 0b17e88 commit 7631a29
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions l2-contracts/test/ZkCappedMinterV2.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -209,35 +209,23 @@ contract Unpause is ZkCappedMinterV2Test {
}

contract Close is ZkCappedMinterV2Test {
function testFuzz_CorrectlyPermanentlyBlocksMinting(
address _cappedMinterAdmin,
address _minter,
address _receiver,
uint256 _cap,
uint256 _amount
) public {
_cap = bound(_cap, 0, MAX_MINT_SUPPLY);
vm.assume(_cap > 0);
_amount = bound(_amount, 1, _cap);
function testFuzz_CorrectlyPermanentlyBlocksMinting(address _minter, address _receiver, uint256 _amount) public {
_amount = bound(_amount, 1, DEFAULT_CAP);
vm.assume(_receiver != address(0) && _receiver != initMintReceiver);

ZkCappedMinterV2 cappedMinter = _createCappedMinter(_cappedMinterAdmin, _cap);
vm.prank(_cappedMinterAdmin);
vm.prank(cappedMinterAdmin);
cappedMinter.grantRole(MINTER_ROLE, _minter);

vm.prank(_cappedMinterAdmin);
vm.prank(cappedMinterAdmin);
cappedMinter.close();

vm.expectRevert(ZkCappedMinterV2.ZkCappedMinterV2__ContractClosed.selector);
vm.prank(_minter);
cappedMinter.mint(_receiver, _amount);
}

function testFuzz_RevertIf_NotAdminCloses(address _cappedMinterAdmin, address _nonAdmin, uint256 _cap) public {
vm.assume(_nonAdmin != _cappedMinterAdmin);
_cap = bound(_cap, 0, MAX_MINT_SUPPLY);

ZkCappedMinterV2 cappedMinter = _createCappedMinter(_cappedMinterAdmin, _cap);
function testFuzz_RevertIf_NotAdminCloses(address _nonAdmin, uint256 _amount) public {
_amount = bound(_amount, 1, DEFAULT_CAP);
vm.expectRevert(_formatAccessControlError(_nonAdmin, DEFAULT_ADMIN_ROLE));
vm.prank(_nonAdmin);
cappedMinter.close();
Expand Down

0 comments on commit 7631a29

Please sign in to comment.