diff --git a/test/ERC721Drop.t.sol b/test/ERC721Drop.t.sol index cc538e8..c08cadf 100644 --- a/test/ERC721Drop.t.sol +++ b/test/ERC721Drop.t.sol @@ -24,38 +24,19 @@ contract ERC721DropTest is Test { /// @param amount amount that was withdrawn /// @param feeRecipient user getting withdraw fee (if any) /// @param feeAmount amount of the fee getting sent (if any) - event FundsWithdrawn( - address indexed withdrawnBy, - address indexed withdrawnTo, - uint256 amount, - address feeRecipient, - uint256 feeAmount - ); - - event Sale( - address indexed to, - uint256 indexed quantity, - uint256 indexed pricePerToken, - uint256 firstPurchasedTokenId - ); - - event MintComment( - address indexed sender, - address indexed tokenContract, - uint256 indexed tokenId, - uint256 quantity, - string comment - ); + event FundsWithdrawn(address indexed withdrawnBy, address indexed withdrawnTo, uint256 amount, address feeRecipient, uint256 feeAmount); + + event Sale(address indexed to, uint256 indexed quantity, uint256 indexed pricePerToken, uint256 firstPurchasedTokenId); + + event MintComment(address indexed sender, address indexed tokenContract, uint256 indexed tokenId, uint256 quantity, string comment); ERC721Drop zoraNFTBase; MockUser mockUser; DummyMetadataRenderer public dummyRenderer = new DummyMetadataRenderer(); FactoryUpgradeGate public factoryUpgradeGate; address public constant DEFAULT_OWNER_ADDRESS = address(0x23499); - address payable public constant DEFAULT_FUNDS_RECIPIENT_ADDRESS = - payable(address(0x21303)); - address payable public constant DEFAULT_ZORA_DAO_ADDRESS = - payable(address(0x999)); + address payable public constant DEFAULT_FUNDS_RECIPIENT_ADDRESS = payable(address(0x21303)); + address payable public constant DEFAULT_ZORA_DAO_ADDRESS = payable(address(0x999)); address public constant UPGRADE_GATE_ADMIN_ADDRESS = address(0x942924224); address public constant mediaContract = address(0x123456); address public impl; @@ -90,69 +71,33 @@ contract ERC721DropTest is Test { function setUp() public { vm.prank(DEFAULT_ZORA_DAO_ADDRESS); factoryUpgradeGate = new FactoryUpgradeGate(UPGRADE_GATE_ADMIN_ADDRESS); - vm.etch( - address(0x000000000000AAeB6D7670E522A718067333cd4E), - address(new OperatorFilterRegistry()).code - ); - ownedSubscriptionManager = address( - new OwnedSubscriptionManager(address(0x123456)) - ); + vm.etch(address(0x000000000000AAeB6D7670E522A718067333cd4E), address(new OperatorFilterRegistry()).code); + ownedSubscriptionManager = address(new OwnedSubscriptionManager(address(0x123456))); vm.prank(DEFAULT_ZORA_DAO_ADDRESS); - impl = address( - new ERC721Drop( - address(0x1234), - factoryUpgradeGate, - address(0x0), - mintFee, - mintFeeRecipient - ) - ); - address payable newDrop = payable( - address(new ERC721DropProxy(impl, "")) - ); + impl = address(new ERC721Drop(address(0x1234), factoryUpgradeGate, address(0x0), mintFee, mintFeeRecipient)); + address payable newDrop = payable(address(new ERC721DropProxy(impl, ""))); zoraNFTBase = ERC721Drop(newDrop); } modifier factoryWithSubscriptionAddress(address subscriptionAddress) { vm.prank(DEFAULT_ZORA_DAO_ADDRESS); - impl = address( - new ERC721Drop( - address(0x1234), - factoryUpgradeGate, - address(subscriptionAddress), - mintFee, - mintFeeRecipient - ) - ); - address payable newDrop = payable( - address(new ERC721DropProxy(impl, "")) - ); + impl = address(new ERC721Drop(address(0x1234), factoryUpgradeGate, address(subscriptionAddress), mintFee, mintFeeRecipient)); + address payable newDrop = payable(address(new ERC721DropProxy(impl, ""))); zoraNFTBase = ERC721Drop(newDrop); _; } function test_Init() public setupZoraNFTBase(10) { - require( - zoraNFTBase.owner() == DEFAULT_OWNER_ADDRESS, - "Default owner set wrong" - ); + require(zoraNFTBase.owner() == DEFAULT_OWNER_ADDRESS, "Default owner set wrong"); - ( - IMetadataRenderer renderer, - uint64 editionSize, - uint16 royaltyBPS, - address payable fundsRecipient - ) = zoraNFTBase.config(); + (IMetadataRenderer renderer, uint64 editionSize, uint16 royaltyBPS, address payable fundsRecipient) = zoraNFTBase.config(); require(address(renderer) == address(dummyRenderer)); require(editionSize == 10, "EditionSize is wrong"); require(royaltyBPS == 800, "RoyaltyBPS is wrong"); - require( - fundsRecipient == payable(DEFAULT_FUNDS_RECIPIENT_ADDRESS), - "FundsRecipient is wrong" - ); + require(fundsRecipient == payable(DEFAULT_FUNDS_RECIPIENT_ADDRESS), "FundsRecipient is wrong"); string memory name = zoraNFTBase.name(); string memory symbol = zoraNFTBase.symbol(); @@ -199,20 +144,10 @@ contract ERC721DropTest is Test { assertTrue(!zoraNFTBase.isAdmin(address(0))); } - function test_SubscriptionEnabled() - public - factoryWithSubscriptionAddress(ownedSubscriptionManager) - setupZoraNFTBase(10) - { - IOperatorFilterRegistry operatorFilterRegistry = IOperatorFilterRegistry( - 0x000000000000AAeB6D7670E522A718067333cd4E - ); + function test_SubscriptionEnabled() public factoryWithSubscriptionAddress(ownedSubscriptionManager) setupZoraNFTBase(10) { + IOperatorFilterRegistry operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); vm.startPrank(address(0x123456)); - operatorFilterRegistry.updateOperator( - ownedSubscriptionManager, - address(0xcafeea3), - true - ); + operatorFilterRegistry.updateOperator(ownedSubscriptionManager, address(0xcafeea3), true); vm.stopPrank(); vm.startPrank(DEFAULT_OWNER_ADDRESS); zoraNFTBase.manageMarketFilterDAOSubscription(true); @@ -220,12 +155,7 @@ contract ERC721DropTest is Test { zoraNFTBase.setApprovalForAll(address(0xcafeea3), true); vm.stopPrank(); vm.prank(address(0xcafeea3)); - vm.expectRevert( - abi.encodeWithSelector( - OperatorFilterRegistryErrorsAndEvents.AddressFiltered.selector, - address(0xcafeea3) - ) - ); + vm.expectRevert(abi.encodeWithSelector(OperatorFilterRegistryErrorsAndEvents.AddressFiltered.selector, address(0xcafeea3))); zoraNFTBase.transferFrom(DEFAULT_OWNER_ADDRESS, address(0x123456), 1); vm.prank(DEFAULT_OWNER_ADDRESS); zoraNFTBase.manageMarketFilterDAOSubscription(false); @@ -233,73 +163,43 @@ contract ERC721DropTest is Test { zoraNFTBase.transferFrom(DEFAULT_OWNER_ADDRESS, address(0x123456), 1); } - function test_OnlyAdminEnableSubscription() - public - factoryWithSubscriptionAddress(ownedSubscriptionManager) - setupZoraNFTBase(10) - { + function test_OnlyAdminEnableSubscription() public factoryWithSubscriptionAddress(ownedSubscriptionManager) setupZoraNFTBase(10) { vm.startPrank(address(0xcafecafe)); vm.expectRevert(IERC721Drop.Access_OnlyAdmin.selector); zoraNFTBase.manageMarketFilterDAOSubscription(true); vm.stopPrank(); } - function test_ProxySubscriptionAccessOnlyAdmin() - public - factoryWithSubscriptionAddress(ownedSubscriptionManager) - setupZoraNFTBase(10) - { - bytes memory baseCall = abi.encodeWithSelector( - IOperatorFilterRegistry.register.selector, - address(zoraNFTBase) - ); + function test_ProxySubscriptionAccessOnlyAdmin() public factoryWithSubscriptionAddress(ownedSubscriptionManager) setupZoraNFTBase(10) { + bytes memory baseCall = abi.encodeWithSelector(IOperatorFilterRegistry.register.selector, address(zoraNFTBase)); vm.startPrank(address(0xcafecafe)); vm.expectRevert(IERC721Drop.Access_OnlyAdmin.selector); zoraNFTBase.updateMarketFilterSettings(baseCall); vm.stopPrank(); } - function test_ProxySubscriptionAccess() - public - factoryWithSubscriptionAddress(ownedSubscriptionManager) - setupZoraNFTBase(10) - { + function test_ProxySubscriptionAccess() public factoryWithSubscriptionAddress(ownedSubscriptionManager) setupZoraNFTBase(10) { vm.startPrank(address(DEFAULT_OWNER_ADDRESS)); - bytes memory baseCall = abi.encodeWithSelector( - IOperatorFilterRegistry.register.selector, - address(zoraNFTBase) - ); + bytes memory baseCall = abi.encodeWithSelector(IOperatorFilterRegistry.register.selector, address(zoraNFTBase)); zoraNFTBase.updateMarketFilterSettings(baseCall); vm.stopPrank(); } function test_RoyaltyInfo() public setupZoraNFTBase(10) { // assert 800 royaltyAmount or 8% - (address recipient, uint256 royaltyAmount) = zoraNFTBase.royaltyInfo( - 10, - 1 ether - ); + (address recipient, uint256 royaltyAmount) = zoraNFTBase.royaltyInfo(10, 1 ether); assertEq(royaltyAmount, 0.08 ether); } - function test_NoRoyaltyInfoNoFundsRecipientAddress() - public - setupZoraNFTBase(10) - { + function test_NoRoyaltyInfoNoFundsRecipientAddress() public setupZoraNFTBase(10) { vm.prank(DEFAULT_OWNER_ADDRESS); zoraNFTBase.setFundsRecipient(payable(address(0))); // assert 800 royaltyAmount or 8% - (address recipient, uint256 royaltyAmount) = zoraNFTBase.royaltyInfo( - 10, - 1 ether - ); + (address recipient, uint256 royaltyAmount) = zoraNFTBase.royaltyInfo(10, 1 ether); assertEq(royaltyAmount, 0 ether); } - function test_Purchase( - uint64 salePrice, - uint32 purchaseQuantity - ) public setupZoraNFTBase(purchaseQuantity) { + function test_Purchase(uint64 salePrice, uint32 purchaseQuantity) public setupZoraNFTBase(purchaseQuantity) { vm.assume(purchaseQuantity < 100 && purchaseQuantity > 0); vm.prank(DEFAULT_OWNER_ADDRESS); zoraNFTBase.setSaleConfiguration({ @@ -317,28 +217,17 @@ contract ERC721DropTest is Test { vm.deal(address(456), paymentAmount); vm.prank(address(456)); vm.expectEmit(true, true, true, true); - emit Sale( - address(456), - purchaseQuantity, - salePrice, - 0 - ); + emit Sale(address(456), purchaseQuantity, salePrice, 0); zoraNFTBase.purchase{value: paymentAmount}(purchaseQuantity); assertEq(zoraNFTBase.saleDetails().maxSupply, purchaseQuantity); assertEq(zoraNFTBase.saleDetails().totalMinted, purchaseQuantity); - require( - zoraNFTBase.ownerOf(1) == address(456), - "owner is wrong for new minted token" - ); + require(zoraNFTBase.ownerOf(1) == address(456), "owner is wrong for new minted token"); assertEq(address(zoraNFTBase).balance, paymentAmount - zoraFee); assertEq(mintFeeRecipient.balance, zoraFee); } - function test_PurchaseWithComment( - uint64 salePrice, - uint32 purchaseQuantity - ) public setupZoraNFTBase(purchaseQuantity) { + function test_PurchaseWithComment(uint64 salePrice, uint32 purchaseQuantity) public setupZoraNFTBase(purchaseQuantity) { vm.assume(purchaseQuantity < 100 && purchaseQuantity > 0); vm.prank(DEFAULT_OWNER_ADDRESS); zoraNFTBase.setSaleConfiguration({ @@ -356,56 +245,54 @@ contract ERC721DropTest is Test { vm.deal(address(456), paymentAmount); vm.prank(address(456)); vm.expectEmit(true, true, true, true); - emit MintComment( - address(456), - address(zoraNFTBase), - 0, - purchaseQuantity, - "test comment" - ); + emit MintComment(address(456), address(zoraNFTBase), 0, purchaseQuantity, "test comment"); 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( - address(0x3333), - factoryUpgradeGate, - address(0x0), - mintFee, - mintFeeRecipient - ) - ); + address newImpl = address(new ERC721Drop(address(0x3333), factoryUpgradeGate, address(0x0), mintFee, mintFeeRecipient)); address[] memory lastImpls = new address[](1); lastImpls[0] = impl; vm.prank(UPGRADE_GATE_ADMIN_ADDRESS); - factoryUpgradeGate.registerNewUpgradePath({ - _newImpl: newImpl, - _supportedPrevImpls: lastImpls - }); + factoryUpgradeGate.registerNewUpgradePath({_newImpl: newImpl, _supportedPrevImpls: lastImpls}); vm.prank(DEFAULT_OWNER_ADDRESS); zoraNFTBase.upgradeTo(newImpl); } function test_UpgradeFailsNotApproved() public setupZoraNFTBase(10) { - address newImpl = address( - new ERC721Drop( - address(0x3333), - factoryUpgradeGate, - address(0x0), - mintFee, - mintFeeRecipient - ) - ); + address newImpl = address(new ERC721Drop(address(0x3333), factoryUpgradeGate, address(0x0), mintFee, mintFeeRecipient)); vm.prank(DEFAULT_OWNER_ADDRESS); - vm.expectRevert( - abi.encodeWithSelector( - IERC721Drop.Admin_InvalidUpgradeAddress.selector, - newImpl - ) - ); + vm.expectRevert(abi.encodeWithSelector(IERC721Drop.Admin_InvalidUpgradeAddress.selector, newImpl)); zoraNFTBase.upgradeTo(newImpl); } @@ -462,10 +349,7 @@ contract ERC721DropTest is Test { zoraNFTBase.adminMint(DEFAULT_OWNER_ADDRESS, 1); assertEq(zoraNFTBase.saleDetails().maxSupply, 10); assertEq(zoraNFTBase.saleDetails().totalMinted, 1); - require( - zoraNFTBase.ownerOf(1) == DEFAULT_OWNER_ADDRESS, - "Owner is wrong for new minted token" - ); + require(zoraNFTBase.ownerOf(1) == DEFAULT_OWNER_ADDRESS, "Owner is wrong for new minted token"); } function test_MulticallAccessControl() public setupZoraNFTBase(10) { @@ -482,24 +366,11 @@ contract ERC721DropTest is Test { address notAdmin = address(0x444); bytes[] memory calls = new bytes[](2); - calls[0] = abi.encodeWithSelector( - IERC721Drop.adminMint.selector, - address(0x456), - 1 - ); - calls[1] = abi.encodeWithSelector( - IERC721Drop.adminMint.selector, - address(0x123), - 3 - ); + calls[0] = abi.encodeWithSelector(IERC721Drop.adminMint.selector, address(0x456), 1); + calls[1] = abi.encodeWithSelector(IERC721Drop.adminMint.selector, address(0x123), 3); vm.expectRevert( - abi.encodeWithSelector( - IERC721Drop.Access_MissingRoleOrAdmin.selector, - bytes32( - 0xf0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9 - ) - ) + abi.encodeWithSelector(IERC721Drop.Access_MissingRoleOrAdmin.selector, bytes32(0xf0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9)) ); zoraNFTBase.multicall(calls); @@ -515,47 +386,15 @@ contract ERC721DropTest is Test { function test_MintMulticall() public setupZoraNFTBase(10) { vm.startPrank(DEFAULT_OWNER_ADDRESS); bytes[] memory calls = new bytes[](3); - calls[0] = abi.encodeWithSelector( - IERC721Drop.adminMint.selector, - DEFAULT_OWNER_ADDRESS, - 5 - ); - calls[1] = abi.encodeWithSelector( - IERC721Drop.adminMint.selector, - address(0x123), - 3 - ); + calls[0] = abi.encodeWithSelector(IERC721Drop.adminMint.selector, DEFAULT_OWNER_ADDRESS, 5); + calls[1] = abi.encodeWithSelector(IERC721Drop.adminMint.selector, address(0x123), 3); calls[2] = abi.encodeWithSelector(IERC721Drop.saleDetails.selector); bytes[] memory results = zoraNFTBase.multicall(calls); - ( - bool saleActive, - bool presaleActive, - uint256 publicSalePrice, - , - , - , - , - , - , - , - - ) = abi.decode( - results[2], - ( - bool, - bool, - uint256, - uint64, - uint64, - uint64, - uint64, - bytes32, - uint256, - uint256, - uint256 - ) - ); + (bool saleActive, bool presaleActive, uint256 publicSalePrice, , , , , , , , ) = abi.decode( + results[2], + (bool, bool, uint256, uint64, uint64, uint64, uint64, bytes32, uint256, uint256, uint256) + ); assertTrue(!saleActive); assertTrue(!presaleActive); assertEq(publicSalePrice, 0); @@ -568,26 +407,9 @@ contract ERC721DropTest is Test { function test_UpdatePriceMulticall() public setupZoraNFTBase(10) { vm.startPrank(DEFAULT_OWNER_ADDRESS); bytes[] memory calls = new bytes[](3); - calls[0] = abi.encodeWithSelector( - IERC721Drop.setSaleConfiguration.selector, - 0.1 ether, - 2, - 0, - type(uint64).max, - 0, - 0, - bytes32(0) - ); - calls[1] = abi.encodeWithSelector( - IERC721Drop.adminMint.selector, - address(0x123), - 3 - ); - calls[2] = abi.encodeWithSelector( - IERC721Drop.adminMint.selector, - address(0x123), - 3 - ); + calls[0] = abi.encodeWithSelector(IERC721Drop.setSaleConfiguration.selector, 0.1 ether, 2, 0, type(uint64).max, 0, 0, bytes32(0)); + calls[1] = abi.encodeWithSelector(IERC721Drop.adminMint.selector, address(0x123), 3); + calls[2] = abi.encodeWithSelector(IERC721Drop.adminMint.selector, address(0x123), 3); bytes[] memory results = zoraNFTBase.multicall(calls); IERC721Drop.SaleDetails memory saleDetails = zoraNFTBase.saleDetails(); @@ -624,12 +446,7 @@ contract ERC721DropTest is Test { }); (, uint256 fee) = zoraNFTBase.zoraFeeForAmount(1); vm.prank(address(456)); - vm.expectRevert( - abi.encodeWithSelector( - IERC721Drop.Purchase_WrongPrice.selector, - 0.15 ether + fee - ) - ); + vm.expectRevert(abi.encodeWithSelector(IERC721Drop.Purchase_WrongPrice.selector, 0.15 ether + fee)); zoraNFTBase.purchase{value: 0.12 ether}(1); } @@ -640,21 +457,13 @@ contract ERC721DropTest is Test { vm.prank(DEFAULT_OWNER_ADDRESS); vm.expectEmit(true, true, true, true); - emit FundsWithdrawn( - DEFAULT_OWNER_ADDRESS, - DEFAULT_FUNDS_RECIPIENT_ADDRESS, - leftoverFunds, - payable(address(0)), - 0 - ); + emit FundsWithdrawn(DEFAULT_OWNER_ADDRESS, DEFAULT_FUNDS_RECIPIENT_ADDRESS, leftoverFunds, payable(address(0)), 0); zoraNFTBase.withdraw(); assertEq(DEFAULT_FUNDS_RECIPIENT_ADDRESS.balance, amount); } - function test_WithdrawNoZoraFee( - uint128 amount - ) public setupZoraNFTBase(10) { + function test_WithdrawNoZoraFee(uint128 amount) public setupZoraNFTBase(10) { vm.assume(amount > 0.01 ether); address payable fundsRecipientTarget = payable(address(0x0)); @@ -665,13 +474,7 @@ contract ERC721DropTest is Test { vm.deal(address(zoraNFTBase), amount); vm.prank(DEFAULT_OWNER_ADDRESS); vm.expectEmit(true, true, true, true); - emit FundsWithdrawn( - DEFAULT_OWNER_ADDRESS, - fundsRecipientTarget, - amount, - payable(address(0)), - 0 - ); + emit FundsWithdrawn(DEFAULT_OWNER_ADDRESS, fundsRecipientTarget, amount, payable(address(0)), 0); zoraNFTBase.withdraw(); assertTrue(fundsRecipientTarget.balance == uint256(amount)); @@ -693,9 +496,7 @@ contract ERC721DropTest is Test { (, uint256 limitFee) = zoraNFTBase.zoraFeeForAmount(limit); vm.deal(address(456), 100_000_000 ether); vm.prank(address(456)); - zoraNFTBase.purchase{value: 0.1 ether * uint256(limit) + limitFee}( - limit - ); + zoraNFTBase.purchase{value: 0.1 ether * uint256(limit) + limitFee}(limit); assertEq(zoraNFTBase.saleDetails().totalMinted, limit); @@ -703,10 +504,7 @@ contract ERC721DropTest is Test { vm.deal(address(444), 1_000_000 ether); vm.prank(address(444)); vm.expectRevert(IERC721Drop.Purchase_TooManyForAddress.selector); - zoraNFTBase.purchase{ - value: (0.1 ether * (uint256(limit) + 1)) + - (fee * (uint256(limit) + 1)) - }(uint256(limit) + 1); + zoraNFTBase.purchase{value: (0.1 ether * (uint256(limit) + 1)) + (fee * (uint256(limit) + 1))}(uint256(limit) + 1); assertEq(zoraNFTBase.saleDetails().totalMinted, limit); } @@ -728,10 +526,7 @@ contract ERC721DropTest is Test { address SALES_MANAGER_ADDR = address(0x11002); vm.startPrank(DEFAULT_OWNER_ADDRESS); - zoraNFTBase.grantRole( - zoraNFTBase.SALES_MANAGER_ROLE(), - SALES_MANAGER_ADDR - ); + zoraNFTBase.grantRole(zoraNFTBase.SALES_MANAGER_ROLE(), SALES_MANAGER_ADDR); vm.stopPrank(); vm.prank(SALES_MANAGER_ADDR); zoraNFTBase.setSaleConfiguration({ @@ -744,22 +539,12 @@ contract ERC721DropTest is Test { presaleMerkleRoot: bytes32(0) }); - ( - , - , - , - , - uint64 presaleStartLookup2, - uint64 presaleEndLookup2, - - ) = zoraNFTBase.salesConfig(); + (, , , , uint64 presaleStartLookup2, uint64 presaleEndLookup2, ) = zoraNFTBase.salesConfig(); assertEq(presaleEndLookup2, 0); assertEq(presaleStartLookup2, 100); } - function test_GlobalLimit( - uint16 limit - ) public setupZoraNFTBase(uint64(limit)) { + function test_GlobalLimit(uint16 limit) public setupZoraNFTBase(uint64(limit)) { vm.assume(limit > 0); vm.startPrank(DEFAULT_OWNER_ADDRESS); zoraNFTBase.adminMint(DEFAULT_OWNER_ADDRESS, limit); @@ -788,16 +573,11 @@ contract ERC721DropTest is Test { vm.prank(DEFAULT_OWNER_ADDRESS); zoraNFTBase.adminMint(address(0x1234), 2); vm.prank(DEFAULT_OWNER_ADDRESS); - vm.expectRevert( - IERC721Drop.Admin_UnableToFinalizeNotOpenEdition.selector - ); + vm.expectRevert(IERC721Drop.Admin_UnableToFinalizeNotOpenEdition.selector); zoraNFTBase.finalizeOpenEdition(); } - function test_ValidFinalizeOpenEdition() - public - setupZoraNFTBase(type(uint64).max) - { + function test_ValidFinalizeOpenEdition() public setupZoraNFTBase(type(uint64).max) { vm.prank(DEFAULT_OWNER_ADDRESS); zoraNFTBase.setSaleConfiguration({ publicSaleStart: 0, @@ -825,10 +605,7 @@ contract ERC721DropTest is Test { address minter = address(0x32402); vm.startPrank(DEFAULT_OWNER_ADDRESS); zoraNFTBase.adminMint(DEFAULT_OWNER_ADDRESS, 1); - require( - zoraNFTBase.balanceOf(DEFAULT_OWNER_ADDRESS) == 1, - "Wrong balance" - ); + require(zoraNFTBase.balanceOf(DEFAULT_OWNER_ADDRESS) == 1, "Wrong balance"); zoraNFTBase.grantRole(zoraNFTBase.MINTER_ROLE(), minter); vm.stopPrank(); vm.prank(minter); @@ -889,12 +666,7 @@ contract ERC721DropTest is Test { toMint[2] = address(0x12); toMint[3] = address(0x13); bytes32 minterRole = zoraNFTBase.MINTER_ROLE(); - vm.expectRevert( - abi.encodeWithSignature( - "Access_MissingRoleOrAdmin(bytes32)", - minterRole - ) - ); + vm.expectRevert(abi.encodeWithSignature("Access_MissingRoleOrAdmin(bytes32)", minterRole)); zoraNFTBase.adminMintAirdrop(toMint); } @@ -909,9 +681,7 @@ contract ERC721DropTest is Test { function test_AdminMintBatchFails() public setupZoraNFTBase(1000) { vm.startPrank(address(0x10)); bytes32 role = zoraNFTBase.MINTER_ROLE(); - vm.expectRevert( - abi.encodeWithSignature("Access_MissingRoleOrAdmin(bytes32)", role) - ); + vm.expectRevert(abi.encodeWithSignature("Access_MissingRoleOrAdmin(bytes32)", role)); zoraNFTBase.adminMint(address(0x10), 100); } @@ -940,39 +710,21 @@ contract ERC721DropTest is Test { vm.stopPrank(); vm.prank(address(1)); - vm.expectRevert( - IERC721AUpgradeable.TransferCallerNotOwnerNorApproved.selector - ); + vm.expectRevert(IERC721AUpgradeable.TransferCallerNotOwnerNorApproved.selector); zoraNFTBase.burn(1); } - function test_AdminMetadataRendererUpdateCall() - public - setupZoraNFTBase(10) - { + function test_AdminMetadataRendererUpdateCall() public setupZoraNFTBase(10) { vm.startPrank(DEFAULT_OWNER_ADDRESS); assertEq(dummyRenderer.someState(), ""); - zoraNFTBase.callMetadataRenderer( - abi.encodeWithSelector( - DummyMetadataRenderer.updateSomeState.selector, - "new state", - address(zoraNFTBase) - ) - ); + zoraNFTBase.callMetadataRenderer(abi.encodeWithSelector(DummyMetadataRenderer.updateSomeState.selector, "new state", address(zoraNFTBase))); assertEq(dummyRenderer.someState(), "new state"); } - function test_NonAdminMetadataRendererUpdateCall() - public - setupZoraNFTBase(10) - { + function test_NonAdminMetadataRendererUpdateCall() public setupZoraNFTBase(10) { vm.startPrank(address(0x99493)); assertEq(dummyRenderer.someState(), ""); - bytes memory targetCall = abi.encodeWithSelector( - DummyMetadataRenderer.updateSomeState.selector, - "new state", - address(zoraNFTBase) - ); + bytes memory targetCall = abi.encodeWithSelector(DummyMetadataRenderer.updateSomeState.selector, "new state", address(zoraNFTBase)); vm.expectRevert(IERC721Drop.Access_OnlyAdmin.selector); zoraNFTBase.callMetadataRenderer(targetCall); assertEq(dummyRenderer.someState(), ""); @@ -990,7 +742,7 @@ contract ERC721DropTest is Test { vm.assume(mintQuantity <= editionSize - totalRoyaltyMintsForSale); vm.startPrank(DEFAULT_OWNER_ADDRESS); - + zoraNFTBase.updateRoyaltyMintSchedule(royaltyMintSchedule); zoraNFTBase.setSaleConfiguration({ @@ -1119,15 +871,9 @@ contract ERC721DropTest is Test { function test_EIP165() public view { require(zoraNFTBase.supportsInterface(0x01ffc9a7), "supports 165"); require(zoraNFTBase.supportsInterface(0x80ac58cd), "supports 721"); - require( - zoraNFTBase.supportsInterface(0x5b5e139f), - "supports 721-metdata" - ); + require(zoraNFTBase.supportsInterface(0x5b5e139f), "supports 721-metdata"); require(zoraNFTBase.supportsInterface(0x2a55205a), "supports 2981"); require(zoraNFTBase.supportsInterface(0x49064906), "supports 4906"); - require( - !zoraNFTBase.supportsInterface(0x0000000), - "doesnt allow non-interface" - ); + require(!zoraNFTBase.supportsInterface(0x0000000), "doesnt allow non-interface"); } }