Skip to content

Commit

Permalink
Add test for minting on transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
QuitCrypto committed Feb 10, 2024
1 parent 188c846 commit d6c4ad5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/DN404.sol
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ abstract contract DN404 {
if (addressAlias == 0) {
addressAlias = ++$.numAliases;
toAddressData.addressAlias = addressAlias;
$.aliasToAddress[addressAlias] = to;
}
return addressAlias;
}
Expand Down
10 changes: 10 additions & 0 deletions test/DN404.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,15 @@ contract DN404Test is SoladyTest {
}
}

function testMintOnTransfer(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);

vm.startPrank(initialSupplyOwner);
dn.transfer(recipient, 1e18);

assertEq(dn.ownerOf(1), recipient);
}
}

0 comments on commit d6c4ad5

Please sign in to comment.