diff --git a/test/ERC721Drop.t.sol b/test/ERC721Drop.t.sol index cc538e8..61c6284 100644 --- a/test/ERC721Drop.t.sol +++ b/test/ERC721Drop.t.sol @@ -366,6 +366,34 @@ contract ERC721DropTest is Test { zoraNFTBase.purchaseWithComment{value: paymentAmount}(purchaseQuantity, "test comment"); } + function test_PurchaseWithRecipient(uint64 salePrice, uint32 purchaseQuantity) public setupZoraNFTBase(purchaseQuantity) { + vm.assume(purchaseQuantity < 100 && purchaseQuantity > 0); + vm.prank(DEFAULT_OWNER_ADDRESS); + zoraNFTBase.setSaleConfiguration({ + publicSaleStart: 0, + publicSaleEnd: type(uint64).max, + presaleStart: 0, + presaleEnd: 0, + publicSalePrice: salePrice, + maxSalePurchasePerAddress: purchaseQuantity + 1, + presaleMerkleRoot: bytes32(0) + }); + + (, uint256 zoraFee) = zoraNFTBase.zoraFeeForAmount(purchaseQuantity); + uint256 paymentAmount = uint256(salePrice) * purchaseQuantity + zoraFee; + + address minter = makeAddr("minter"); + address recipient = makeAddr("recipient"); + + vm.deal(minter, paymentAmount); + vm.prank(minter); + zoraNFTBase.purchaseWithRecipient{value: paymentAmount}(recipient, purchaseQuantity, ""); + + for (uint256 i; i < purchaseQuantity; ) { + assertEq(zoraNFTBase.ownerOf(++i), recipient); + } + } + function test_UpgradeApproved() public setupZoraNFTBase(10) { address newImpl = address( new ERC721Drop(