Skip to content

Commit

Permalink
chore: add test purchase w recipient
Browse files Browse the repository at this point in the history
  • Loading branch information
kulkarohan committed Jun 26, 2023
1 parent e418f13 commit 1f9ea9f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/ERC721Drop.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 1f9ea9f

Please sign in to comment.