Skip to content

Commit

Permalink
feat: DN404 revert tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pop-punk committed Feb 10, 2024
1 parent 3d506f0 commit cd28445
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/DN404.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ contract DN404Test is SoladyTest {
vm.expectRevert(DN404.TransferToZeroAddress.selector);
dn.initializeDN404(totalNFTSupply, initialSupplyOwner, address(mirror));
} else {
vm.expectRevert(DN404.MirrorAddressIsZero.selector);
dn.initializeDN404(totalNFTSupply, initialSupplyOwner, address(0));
dn.initializeDN404(totalNFTSupply, initialSupplyOwner, address(mirror));
assertEq(dn.totalSupply(), uint256(totalNFTSupply) * 10 ** 18);
assertEq(dn.balanceOf(initialSupplyOwner), uint256(totalNFTSupply) * 10 ** 18);
Expand Down Expand Up @@ -127,4 +129,21 @@ contract DN404Test is SoladyTest {
vm.expectRevert(DN404.TokenDoesNotExist.selector);
mirror.ownerOf(1);
}

function testTransferToZeroAddress(
uint32 totalNFTSupply,
address initialSupplyOwner,
address recipient
) public {
vm.assume(
totalNFTSupply != 0 && uint256(totalNFTSupply) + 1 <= type(uint32).max
&& initialSupplyOwner != address(0)
);
vm.assume(initialSupplyOwner != recipient && recipient != address(0));

dn.initializeDN404(totalNFTSupply, initialSupplyOwner, address(mirror));

vm.expectRevert(DN404.TransferToZeroAddress.selector);
dn.transfer(address(0), _WAD);
}
}

0 comments on commit cd28445

Please sign in to comment.