From 03379992cded164494b28f35e7a306fe50708f9b Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Thu, 2 Nov 2023 11:05:41 -0700 Subject: [PATCH] updates --- script/DeployAndConfigure1155Receive.s.sol | 8 +-- ...eployAndConfigureExampleCampaign.s.sol.txt | 5 +- ...dRedeemTokens-CampaignOnReceiveToken.s.sol | 48 ++++++-------- script/DeployAndRedeemTokens.s.sol | 5 +- script/DeployAndRedeemTrait.s.sol | 8 +-- ...kenWithPredeployedSeadropRedeemToken.s.sol | 5 +- script/RedeemTokens.s.sol | 4 +- src/extensions/ERC1155RedemptionMintable.sol | 2 +- .../ERC721ShipyardRedeemableMintable.sol | 39 ------------ src/lib/ERC7498NFTRedeemables.sol | 23 +++---- src/lib/RedeemablesConstants.sol | 2 +- ...pyardRedeemablePreapprovedTraitSetters.sol | 3 + test/ERC7498-DynamicTraits.t.sol | 10 +-- test/ERC7498-MultiRedeem.t.sol | 18 ++---- test/ERC7498-Revert.t.sol | 16 ++--- test/ERC7498-SimpleRedeem.t.sol | 19 ++---- test/RedeemableContractOfferer-1155.t.sol.txt | 63 ++++++++++--------- test/RedeemableContractOfferer-721.t.sol.txt | 63 ++++++++++--------- ...RedeemableContractOfferer-Revert.t.sol.txt | 17 +++-- test/utils/BaseRedeemablesTest.sol | 14 ++--- 20 files changed, 145 insertions(+), 227 deletions(-) diff --git a/script/DeployAndConfigure1155Receive.s.sol b/script/DeployAndConfigure1155Receive.s.sol index e494d1e..d96095b 100644 --- a/script/DeployAndConfigure1155Receive.s.sol +++ b/script/DeployAndConfigure1155Receive.s.sol @@ -6,13 +6,12 @@ import {Test} from "forge-std/Test.sol"; import {ItemType} from "seaport-types/src/lib/ConsiderationEnums.sol"; import {OfferItem, ConsiderationItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; import {CampaignParams, CampaignRequirements} from "../src/lib/RedeemablesStructs.sol"; +import {BURN_ADDRESS} from "../src/lib/RedeemablesConstants.sol"; import {ERC721RedemptionMintable} from "../src/extensions/ERC721RedemptionMintable.sol"; import {ERC721OwnerMintable} from "../src/test/ERC721OwnerMintable.sol"; import {ERC1155ShipyardRedeemableMintable} from "../src/extensions/ERC1155ShipyardRedeemableMintable.sol"; contract DeployAndConfigure1155Receive is Script, Test { - address constant _BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; - function run() external { vm.startBroadcast(); @@ -51,7 +50,7 @@ contract DeployAndConfigure1155Receive is Script, Test { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); CampaignRequirements[] memory requirements = new CampaignRequirements[]( @@ -68,8 +67,7 @@ contract DeployAndConfigure1155Receive is Script, Test { maxCampaignRedemptions: 1_000, manager: msg.sender }); - uint256 campaignId = - receiveToken.createCampaign(params, "ipfs://QmQjubc6guHReNW5Es5ZrgDtJRwXk2Aia7BkVoLJGaCRqP"); + receiveToken.createCampaign(params, "ipfs://QmQjubc6guHReNW5Es5ZrgDtJRwXk2Aia7BkVoLJGaCRqP"); // To test updateCampaign, update to proper start/end times. params.startTime = uint32(block.timestamp); diff --git a/script/DeployAndConfigureExampleCampaign.s.sol.txt b/script/DeployAndConfigureExampleCampaign.s.sol.txt index d6c573a..426ad7e 100644 --- a/script/DeployAndConfigureExampleCampaign.s.sol.txt +++ b/script/DeployAndConfigureExampleCampaign.s.sol.txt @@ -7,6 +7,7 @@ import {ItemType} from "seaport-types/src/lib/ConsiderationEnums.sol"; import {OfferItem, ConsiderationItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; import {RedeemableContractOfferer} from "../src/RedeemableContractOfferer.sol"; import {CampaignParams} from "../src/lib/RedeemablesStructs.sol"; +import {BURN_ADDRESS} from "../src/lib/RedeemablesConstants.sol"; import {ERC721RedemptionMintable} from "../src/extensions/ERC721RedemptionMintable.sol"; import {TestERC721} from "../test/utils/mocks/TestERC721.sol"; @@ -16,8 +17,6 @@ contract DeployAndConfigureExampleCampaign is Script { address conduit = 0x1E0049783F008A0085193E00003D00cd54003c71; bytes32 conduitKey = 0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000; - address constant _BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; - function run() external { vm.startBroadcast(); @@ -49,7 +48,7 @@ contract DeployAndConfigureExampleCampaign is Script { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); CampaignParams memory params = CampaignParams({ diff --git a/script/DeployAndRedeemTokens-CampaignOnReceiveToken.s.sol b/script/DeployAndRedeemTokens-CampaignOnReceiveToken.s.sol index 0e46489..848a441 100644 --- a/script/DeployAndRedeemTokens-CampaignOnReceiveToken.s.sol +++ b/script/DeployAndRedeemTokens-CampaignOnReceiveToken.s.sol @@ -6,22 +6,18 @@ import {Test} from "forge-std/Test.sol"; import {ItemType} from "seaport-types/src/lib/ConsiderationEnums.sol"; import {OfferItem, ConsiderationItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; import {CampaignParams, CampaignRequirements} from "../src/lib/RedeemablesStructs.sol"; +import {BURN_ADDRESS} from "../src/lib/RedeemablesConstants.sol"; import {ERC721RedemptionMintable} from "../src/extensions/ERC721RedemptionMintable.sol"; import {ERC721OwnerMintable} from "../src/test/ERC721OwnerMintable.sol"; import {ERC721ShipyardRedeemableMintable} from "../src/extensions/ERC721ShipyardRedeemableMintable.sol"; contract DeployAndRedeemTokens_CampaignOnReceiveToken is Script, Test { - address constant _BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; - function run() external { vm.startBroadcast(); - ERC721ShipyardRedeemableMintable redeemToken = - ERC721ShipyardRedeemableMintable(0xe0535403Af71813B59bcEae5F8F6685B7daF6d07); - ERC721ShipyardRedeemableMintable receiveToken = new ERC721ShipyardRedeemableMintable( - "Demo 721 Receive Token", - "DemoReceive721" - ); + ERC721OwnerMintable redeemToken = new ERC721OwnerMintable(); + ERC721ShipyardRedeemableMintable receiveToken = + new ERC721ShipyardRedeemableMintable("TestRedeemablesReceiveToken", "TEST"); // Configure the campaign. OfferItem[] memory offer = new OfferItem[](1); @@ -40,7 +36,7 @@ contract DeployAndRedeemTokens_CampaignOnReceiveToken is Script, Test { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); CampaignRequirements[] memory requirements = new CampaignRequirements[]( @@ -60,31 +56,27 @@ contract DeployAndRedeemTokens_CampaignOnReceiveToken is Script, Test { uint256 campaignId = receiveToken.createCampaign(params, "ipfs://QmQKc93y2Ev5k9Kz54mCw48ZM487bwGDktZYPLtrjJ3r1d"); - assertEq(campaignId, 1); - // // redeemToken.setBaseURI( - // // "ipfs://QmYTSupCtriDLBHgPBBhZ98wYdp6N9S8jTL5sKSZwbASeT" - // // ); - receiveToken.setBaseURI("ipfs://QmWxgnz8T9wsMBmpCY4Cvanj3RR1obFD2hqDKPZhKN5Tsq/"); - - // // Mint token 1 to redeem for token 1. - // redeemToken.mint(msg.sender, 1); + // Mint token 1 to redeem for token 1. + redeemToken.mint(msg.sender, 1); // Let's redeem them! - // uint256 requirementsIndex = 0; - // bytes32 redemptionHash = bytes32(0); - // bytes memory data = abi.encode(1, requirementsIndex, redemptionHash); + uint256 requirementsIndex = 0; + bytes32 redemptionHash; + uint256 salt; + bytes memory signature; + bytes memory data = abi.encode(campaignId, requirementsIndex, redemptionHash, salt, signature); - // uint256[] memory tokenIds = new uint256[](1); - // tokenIds[0] = 2; + uint256[] memory tokenIds = new uint256[](1); + tokenIds[0] = 1; - // // Individual user approvals not needed when setting the burn address. - // // redeemToken.setApprovalForAll(address(receiveToken), true); - // // redeemToken.setBurnAddress(address(receiveToken)); + // Individual user approvals not needed when setting the burn address. + redeemToken.setApprovalForAll(address(receiveToken), true); + // redeemToken.setBurnAddress(address(receiveToken)); - // receiveToken.redeem(tokenIds, msg.sender, data); + receiveToken.redeem(tokenIds, msg.sender, data); // Assert redeemable token is burned and redemption token is minted. - // assertEq(redeemToken.balanceOf(msg.sender), 0); - // assertEq(receiveToken.ownerOf(1), msg.sender); + assertEq(redeemToken.balanceOf(msg.sender), 0); + assertEq(receiveToken.ownerOf(1), msg.sender); } } diff --git a/script/DeployAndRedeemTokens.s.sol b/script/DeployAndRedeemTokens.s.sol index c21a496..9e8d742 100644 --- a/script/DeployAndRedeemTokens.s.sol +++ b/script/DeployAndRedeemTokens.s.sol @@ -6,12 +6,11 @@ import {Test} from "forge-std/Test.sol"; import {ItemType} from "seaport-types/src/lib/ConsiderationEnums.sol"; import {OfferItem, ConsiderationItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; import {CampaignParams, CampaignRequirements} from "../src/lib/RedeemablesStructs.sol"; +import {BURN_ADDRESS} from "../src/lib/RedeemablesConstants.sol"; import {ERC721RedemptionMintable} from "../src/extensions/ERC721RedemptionMintable.sol"; import {ERC721ShipyardRedeemableOwnerMintable} from "../src/test/ERC721ShipyardRedeemableOwnerMintable.sol"; contract DeployAndRedeemTokens is Script, Test { - address constant _BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; - function run() external { vm.startBroadcast(); @@ -44,7 +43,7 @@ contract DeployAndRedeemTokens is Script, Test { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); CampaignRequirements[] memory requirements = new CampaignRequirements[]( diff --git a/script/DeployAndRedeemTrait.s.sol b/script/DeployAndRedeemTrait.s.sol index 67aab07..09b1105 100644 --- a/script/DeployAndRedeemTrait.s.sol +++ b/script/DeployAndRedeemTrait.s.sol @@ -5,7 +5,7 @@ import {Script} from "forge-std/Script.sol"; import {Test} from "forge-std/Test.sol"; import {ItemType} from "seaport-types/src/lib/ConsiderationEnums.sol"; import {OfferItem, ConsiderationItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; -import {DynamicTraits} from "shipyard-core/src/dynamic-traits/DynamicTraits.sol"; +import {IERC7496} from "shipyard-core/src/dynamic-traits/interfaces/IERC7496.sol"; import {CampaignParams, CampaignRequirements, TraitRedemption} from "../src/lib/RedeemablesStructs.sol"; import {ERC721RedemptionMintable} from "../src/extensions/ERC721RedemptionMintable.sol"; import {ERC721ShipyardRedeemableMintable} from "../src/extensions/ERC721ShipyardRedeemableMintable.sol"; @@ -13,8 +13,6 @@ import {ERC721ShipyardRedeemablePreapprovedTraitSetters} from "../src/test/ERC721ShipyardRedeemablePreapprovedTraitSetters.sol"; contract DeployAndRedeemTrait is Script, Test { - address constant _BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; - function run() external { vm.startBroadcast(); @@ -107,11 +105,9 @@ contract DeployAndRedeemTrait is Script, Test { receiveToken.redeem(new uint256[](0), msg.sender, data); // Assert new trait has been set and redemption token is minted. - bytes32 actualTraitValue = DynamicTraits(address(redeemToken)).getTraitValue(1, traitKey); - + bytes32 actualTraitValue = IERC7496(address(redeemToken)).getTraitValue(1, traitKey); // "hasRedeemed" should be 1 (true) assertEq(bytes32(uint256(1)), actualTraitValue); - assertEq(receiveToken.ownerOf(1), msg.sender); } } diff --git a/script/DeployERC721ReceiveTokenWithPredeployedSeadropRedeemToken.s.sol b/script/DeployERC721ReceiveTokenWithPredeployedSeadropRedeemToken.s.sol index 78e334d..f693f70 100644 --- a/script/DeployERC721ReceiveTokenWithPredeployedSeadropRedeemToken.s.sol +++ b/script/DeployERC721ReceiveTokenWithPredeployedSeadropRedeemToken.s.sol @@ -6,13 +6,12 @@ import {Test} from "forge-std/Test.sol"; import {ItemType} from "seaport-types/src/lib/ConsiderationEnums.sol"; import {OfferItem, ConsiderationItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; import {CampaignParams, CampaignRequirements} from "../src/lib/RedeemablesStructs.sol"; +import {BURN_ADDRESS} from "../src/lib/RedeemablesConstants.sol"; import {ERC721RedemptionMintable} from "../src/extensions/ERC721RedemptionMintable.sol"; import {ERC721OwnerMintable} from "../src/test/ERC721OwnerMintable.sol"; import {ERC721ShipyardRedeemableMintable} from "../src/extensions/ERC721ShipyardRedeemableMintable.sol"; contract DeployERC721ReceiveTokenWithPredeployedSeadropRedeemToken is Script, Test { - address constant _BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; - function run() external { vm.startBroadcast(); @@ -38,7 +37,7 @@ contract DeployERC721ReceiveTokenWithPredeployedSeadropRedeemToken is Script, Te identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); CampaignRequirements[] memory requirements = new CampaignRequirements[]( diff --git a/script/RedeemTokens.s.sol b/script/RedeemTokens.s.sol index 402ba92..3c89521 100644 --- a/script/RedeemTokens.s.sol +++ b/script/RedeemTokens.s.sol @@ -14,7 +14,7 @@ contract RedeemTokens is Script, Test { function run() external { vm.startBroadcast(); - address redeemToken = 0x1eCC76De3f9E4e9f8378f6ade61A02A10f976c45; + // address redeemToken = 0x1eCC76De3f9E4e9f8378f6ade61A02A10f976c45; ERC1155ShipyardRedeemableMintable receiveToken = ERC1155ShipyardRedeemableMintable(0x3D0fa2a8D07dfe357905a4cB4ed51b0Aea8385B9); @@ -22,7 +22,7 @@ contract RedeemTokens is Script, Test { uint256 campaignId = 1; uint256 requirementsIndex = 0; bytes32 redemptionHash = bytes32(0); - bytes memory data = abi.encode(campaignId, requirementsIndex, redemptionHash); + bytes memory data = abi.encode(campaignId, requirementsIndex, redemptionHash, bytes32(0), ""); uint256[] memory redeemTokenIds = new uint256[](1); redeemTokenIds[0] = 1; diff --git a/src/extensions/ERC1155RedemptionMintable.sol b/src/extensions/ERC1155RedemptionMintable.sol index 6b84744..7eee4c3 100644 --- a/src/extensions/ERC1155RedemptionMintable.sol +++ b/src/extensions/ERC1155RedemptionMintable.sol @@ -27,7 +27,7 @@ contract ERC1155RedemptionMintable is ERC1155ShipyardContractMetadata, IRedempti function mintRedemption( uint256, /* campaignId */ address recipient, - ConsiderationItem[] calldata consideration, + ConsiderationItem[] calldata, /* consideration */ TraitRedemption[] calldata /* traitRedemptions */ ) external { bool validSender; diff --git a/src/extensions/ERC721ShipyardRedeemableMintable.sol b/src/extensions/ERC721ShipyardRedeemableMintable.sol index 8ab0a0d..fb9a2ca 100644 --- a/src/extensions/ERC721ShipyardRedeemableMintable.sol +++ b/src/extensions/ERC721ShipyardRedeemableMintable.sol @@ -15,13 +15,10 @@ import {TraitRedemption} from "../lib/RedeemablesStructs.sol"; contract ERC721ShipyardRedeemableMintable is ERC721ShipyardRedeemable, IRedemptionMintable { /// @dev Revert if the sender of mintRedemption is not this contract. error InvalidSender(); - error InvalidTokenURIQuery(); /// @dev The next token id to mint. uint256 _nextTokenId = 1; - mapping(uint256 => uint256) public tokenURINumbers; - constructor(string memory name_, string memory symbol_) ERC721ShipyardRedeemable(name_, symbol_) {} function mintRedemption( @@ -49,40 +46,4 @@ contract ERC721ShipyardRedeemableMintable is ERC721ShipyardRedeemable, IRedempti return interfaceId == type(IRedemptionMintable).interfaceId || ERC721ShipyardRedeemable.supportsInterface(interfaceId); } - - /** - * @notice Hook to set tokenURINumber on mint. - */ - function _beforeTokenTransfer(address from, address, /* to */ uint256 id) internal virtual override { - // Set tokenURINumbers on mint. - if (from == address(0)) { - // 60% chance of tokenURI 1 - // 30% chance of tokenURI 2 - // 10% chance of tokenURI 3 - - // block.difficulty returns PREVRANDAO on Ethereum post-merge - // NOTE: do not use this on other chains - uint256 randomness = (uint256(keccak256(abi.encode(block.difficulty))) % 100) + 1; - - uint256 tokenURINumber = 1; - if (randomness >= 60 && randomness < 90) { - tokenURINumber = 2; - } else if (randomness >= 90) { - tokenURINumber = 3; - } - - tokenURINumbers[id] = tokenURINumber; - } - } - - /* - * @notice Overrides the `tokenURI()` function to return baseURI + 1, 2, or 3 - */ - function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { - if (!_exists(tokenId)) revert InvalidTokenURIQuery(); - - uint256 tokenURINumber = tokenURINumbers[tokenId]; - - return string(abi.encodePacked(baseURI, _toString(tokenURINumber))); - } } diff --git a/src/lib/ERC7498NFTRedeemables.sol b/src/lib/ERC7498NFTRedeemables.sol index ee1e1d3..34919fe 100644 --- a/src/lib/ERC7498NFTRedeemables.sol +++ b/src/lib/ERC7498NFTRedeemables.sol @@ -16,6 +16,7 @@ import {IERC7498} from "../interfaces/IERC7498.sol"; import {IRedemptionMintable} from "../interfaces/IRedemptionMintable.sol"; import {RedeemablesErrors} from "./RedeemablesErrors.sol"; import {CampaignParams, CampaignRequirements, TraitRedemption} from "./RedeemablesStructs.sol"; +import {BURN_ADDRESS} from "./RedeemablesConstants.sol"; contract ERC7498NFTRedeemables is IERC165, IERC7498, DynamicTraits, RedeemablesErrors { /// @dev Counter for next campaign id. @@ -30,9 +31,6 @@ contract ERC7498NFTRedeemables is IERC165, IERC7498, DynamicTraits, RedeemablesE /// @dev The total current redemptions by campaign id. mapping(uint256 campaignId => uint256 count) private _totalRedemptions; - /// @dev The burn address. - address constant _BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; - function redeem(uint256[] calldata considerationTokenIds, address recipient, bytes calldata extraData) public payable @@ -43,16 +41,15 @@ contract ERC7498NFTRedeemables is IERC165, IERC7498, DynamicTraits, RedeemablesE } // Get the values from extraData. - // uint256 campaignId = uint256(bytes32(extraData[0:32])); - // uint256 requirementsIndex = uint256(bytes32(extraData[32:64])); - // uint256[] memory traitRedemptionTokenIds; ( uint256 campaignId, uint256 requirementsIndex, - bytes32 redemptionHash, + /* bytes32 redemptionHash */ + , uint256[] memory traitRedemptionTokenIds, - uint256 salt, - bytes memory signature + /* uint256 salt */ + , + /*bytes memory signature */ ) = abi.decode(extraData, (uint256, uint256, bytes32, uint256[], uint256, bytes)); // Get the campaign params. @@ -223,13 +220,13 @@ contract ERC7498NFTRedeemables is IERC165, IERC7498, DynamicTraits, RedeemablesE // If consideration item is this contract, recipient is burn address, and _useInternalBurn() fn returns true, // call the internal burn function and return. - if (c.token == address(this) && c.recipient == payable(_BURN_ADDRESS) && _useInternalBurn()) { + if (c.token == address(this) && c.recipient == payable(BURN_ADDRESS) && _useInternalBurn()) { _internalBurn(msg.sender, id, c.startAmount); } else { // Transfer the token to the consideration recipient. if (c.itemType == ItemType.ERC721 || c.itemType == ItemType.ERC721_WITH_CRITERIA) { // If recipient is the burn address, try burning the token first, if that doesn't work use transfer. - if (c.recipient == payable(_BURN_ADDRESS)) { + if (c.recipient == payable(BURN_ADDRESS)) { try ERC721Burnable(c.token).burn(id) { // If the burn worked, return. return; @@ -241,7 +238,7 @@ contract ERC7498NFTRedeemables is IERC165, IERC7498, DynamicTraits, RedeemablesE IERC721(c.token).safeTransferFrom(msg.sender, c.recipient, id); } } else if ((c.itemType == ItemType.ERC1155 || c.itemType == ItemType.ERC1155_WITH_CRITERIA)) { - if (c.recipient == payable(_BURN_ADDRESS)) { + if (c.recipient == payable(BURN_ADDRESS)) { // If recipient is the burn address, try burning the token first, if that doesn't work use transfer. try ERC1155Burnable(c.token).burn(msg.sender, id, c.startAmount) { // If the burn worked, return. @@ -254,7 +251,7 @@ contract ERC7498NFTRedeemables is IERC165, IERC7498, DynamicTraits, RedeemablesE IERC1155(c.token).safeTransferFrom(msg.sender, c.recipient, id, c.startAmount, ""); } } else if (c.itemType == ItemType.ERC20) { - if (c.recipient == payable(_BURN_ADDRESS)) { + if (c.recipient == payable(BURN_ADDRESS)) { // If recipient is the burn address, try burning the token first, if that doesn't work use transfer. try ERC20Burnable(c.token).burnFrom(msg.sender, c.startAmount) { // If the burn worked, return. diff --git a/src/lib/RedeemablesConstants.sol b/src/lib/RedeemablesConstants.sol index 695123c..fc43783 100644 --- a/src/lib/RedeemablesConstants.sol +++ b/src/lib/RedeemablesConstants.sol @@ -1,4 +1,4 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -address constant _BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; +address constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; diff --git a/src/test/ERC721ShipyardRedeemablePreapprovedTraitSetters.sol b/src/test/ERC721ShipyardRedeemablePreapprovedTraitSetters.sol index ce47666..e6893ad 100644 --- a/src/test/ERC721ShipyardRedeemablePreapprovedTraitSetters.sol +++ b/src/test/ERC721ShipyardRedeemablePreapprovedTraitSetters.sol @@ -7,6 +7,9 @@ import {DynamicTraits} from "shipyard-core/src/dynamic-traits/DynamicTraits.sol" import {CampaignParams} from "../lib/RedeemablesStructs.sol"; contract ERC721ShipyardRedeemablePreapprovedTraitSetters is ERC721ShipyardRedeemableOwnerMintable { + // TODO add the `allowedTraitSetters` logic to DynamicTraits.sol contract in shipyard-core + // with getAllowedTraitSetters() and setAllowedTraitSetters(). add `is DynamicTraits` to + // ERC721ShipyardRedeemable and ERC721SeaDropRedeemable contracts with onlyOwner on setAllowedTraitSetters(). address[] public allowedTraitSetters; constructor(string memory name_, string memory symbol_, address[] memory allowedTraitSetters_) diff --git a/test/ERC7498-DynamicTraits.t.sol b/test/ERC7498-DynamicTraits.t.sol index 10bc5dd..788c698 100644 --- a/test/ERC7498-DynamicTraits.t.sol +++ b/test/ERC7498-DynamicTraits.t.sol @@ -11,8 +11,8 @@ import {TestERC1155} from "./utils/mocks/TestERC1155.sol"; import {IERC721A} from "seadrop/lib/ERC721A/contracts/IERC721A.sol"; import {IERC721} from "openzeppelin-contracts/contracts/interfaces/IERC721.sol"; import {IERC1155} from "openzeppelin-contracts/contracts/interfaces/IERC1155.sol"; +import {IERC7496} from "shipyard-core/src/dynamic-traits/interfaces/IERC7496.sol"; import {IERC7498} from "../src/interfaces/IERC7498.sol"; -import {DynamicTraits} from "shipyard-core/src/dynamic-traits/DynamicTraits.sol"; import {OfferItem, ConsiderationItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; import {ItemType, OrderType, Side} from "seaport-sol/src/SeaportEnums.sol"; import {OfferItemLib} from "seaport-sol/src/lib/OfferItemLib.sol"; @@ -119,10 +119,6 @@ contract ERC7498_DynamicTraits is BaseRedeemablesTest { // campaignId: 1 // requirementsIndex: 0 - // redemptionHash: bytes32(0) - // traitRedemptionTokenIds: traitRedemptionTokenIds - // salt: 0 - // signature: bytes(0) bytes memory extraData = abi.encode(1, 0, bytes32(0), traitRedemptionTokenIds, uint256(0), bytes("")); vm.expectEmit(true, true, true, true); @@ -130,10 +126,8 @@ contract ERC7498_DynamicTraits is BaseRedeemablesTest { context.erc7498Token.redeem(considerationTokenIds, address(this), extraData); - bytes32 actualTraitValue = DynamicTraits(address(redeemToken)).getTraitValue(tokenId, traitKey); - + bytes32 actualTraitValue = IERC7496(address(redeemToken)).getTraitValue(tokenId, traitKey); assertEq(bytes32(uint256(1)), actualTraitValue); - assertEq(IERC721(address(receiveToken721)).ownerOf(1), address(this)); } } diff --git a/test/ERC7498-MultiRedeem.t.sol b/test/ERC7498-MultiRedeem.t.sol index 0767388..17e2b37 100644 --- a/test/ERC7498-MultiRedeem.t.sol +++ b/test/ERC7498-MultiRedeem.t.sol @@ -85,8 +85,8 @@ contract ERC7498_MultiRedeem is BaseRedeemablesTest { } ERC721RedemptionMintable receiveToken = new ERC721RedemptionMintable( - "TestRedeemablesReceive721", - "TEST", + "", + "", erc7498Tokens ); @@ -114,7 +114,6 @@ contract ERC7498_MultiRedeem is BaseRedeemablesTest { IERC7498(context.erc7498Token).createCampaign(params, ""); // campaignId: 1 // requirementsIndex: 0 - // redemptionHash: bytes32(0) bytes memory extraData = abi.encode(1, 0, bytes32(0), defaultTraitRedemptionTokenIds, uint256(0), bytes("")); consideration[0].identifierOrCriteria = tokenId; @@ -122,9 +121,7 @@ contract ERC7498_MultiRedeem is BaseRedeemablesTest { IERC7498(context.erc7498Token).redeem(tokenIds, address(this), extraData); - _checkTokenDoesNotExist( - address(context.erc7498Token), tokenId, context.isErc7498Token721, context.isErc7498TokenSeaDrop - ); + _checkTokenDoesNotExist(address(context.erc7498Token), tokenId, context.isErc7498Token721); _checkTokenSentToBurnAddress(secondRedeemTokenAddress, tokenId, context.isErc7498Token721); @@ -156,8 +153,8 @@ contract ERC7498_MultiRedeem is BaseRedeemablesTest { } ERC1155ShipyardRedeemableMintable receiveToken = new ERC1155ShipyardRedeemableMintable( - "TestRedeemablesReceive1155SequentialIds", - "TEST" + "", + "" ); ERC721(address(context.erc7498Token)).setApprovalForAll(address(receiveToken), true); @@ -205,7 +202,6 @@ contract ERC7498_MultiRedeem is BaseRedeemablesTest { IERC7498(receiveToken).createCampaign(params, ""); // campaignId: 1 // requirementsIndex: 0 - // redemptionHash: bytes32(0) bytes memory extraData = abi.encode(1, 0, bytes32(0), defaultTraitRedemptionTokenIds, uint256(0), bytes("")); consideration[0].identifierOrCriteria = tokenId; @@ -213,9 +209,7 @@ contract ERC7498_MultiRedeem is BaseRedeemablesTest { IERC7498(receiveToken).redeem(tokenIds, address(this), extraData); - _checkTokenDoesNotExist( - address(context.erc7498Token), tokenId, context.isErc7498Token721, context.isErc7498TokenSeaDrop - ); + _checkTokenDoesNotExist(address(context.erc7498Token), tokenId, context.isErc7498Token721); assertEq(receiveToken.balanceOf(address(this), 1), 1); assertEq(receiveToken.balanceOf(address(this), 2), 1); diff --git a/test/ERC7498-Revert.t.sol b/test/ERC7498-Revert.t.sol index 539329b..719d236 100644 --- a/test/ERC7498-Revert.t.sol +++ b/test/ERC7498-Revert.t.sol @@ -13,6 +13,7 @@ import {ItemType, OrderType, Side} from "seaport-sol/src/SeaportEnums.sol"; import {OfferItemLib} from "seaport-sol/src/lib/OfferItemLib.sol"; import {ConsiderationItemLib} from "seaport-sol/src/lib/ConsiderationItemLib.sol"; import {CampaignParams, CampaignRequirements, TraitRedemption} from "../src/lib/RedeemablesStructs.sol"; +import {BURN_ADDRESS} from "../src/lib/RedeemablesConstants.sol"; import {ERC721RedemptionMintable} from "../src/extensions/ERC721RedemptionMintable.sol"; import {ERC721ShipyardRedeemableOwnerMintable} from "../src/test/ERC721ShipyardRedeemableOwnerMintable.sol"; @@ -65,7 +66,6 @@ contract ERC7498_Revert is BaseRedeemablesTest { IERC7498(erc7498Tokens[0]).createCampaign(params, ""); // campaignId: 1 // requirementsIndex: 0 - // redemptionHash: bytes32(0) bytes memory extraData = abi.encode(1, 0, bytes32(0), defaultTraitRedemptionTokenIds, uint256(0), bytes("")); uint256[] memory tokenIds = Solarray.uint256s(invalidTokenId); @@ -100,7 +100,7 @@ contract ERC7498_Revert is BaseRedeemablesTest { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); consideration[1] = ConsiderationItem({ itemType: ItemType.ERC721_WITH_CRITERIA, @@ -108,7 +108,7 @@ contract ERC7498_Revert is BaseRedeemablesTest { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); CampaignRequirements[] memory requirements = new CampaignRequirements[]( @@ -130,7 +130,6 @@ contract ERC7498_Revert is BaseRedeemablesTest { // campaignId: 1 // requirementsIndex: 0 - // redemptionHash: bytes32(0) bytes memory extraData = abi.encode(1, 0, bytes32(0), defaultTraitRedemptionTokenIds, uint256(0), bytes("")); consideration[0].identifierOrCriteria = tokenId; @@ -165,7 +164,7 @@ contract ERC7498_Revert is BaseRedeemablesTest { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); consideration[1] = ConsiderationItem({ itemType: ItemType.NATIVE, @@ -195,12 +194,10 @@ contract ERC7498_Revert is BaseRedeemablesTest { // campaignId: 1 // requirementsIndex: 0 - // redemptionHash: bytes32(0) bytes memory extraData = abi.encode(1, 0, bytes32(0), defaultTraitRedemptionTokenIds, uint256(0), bytes("")); consideration[0].identifierOrCriteria = tokenId; uint256[] memory considerationTokenIds = Solarray.uint256s(tokenId, 0); - uint256[] memory traitRedemptionTokenIds; vm.expectRevert(abi.encodeWithSelector(InvalidTxValue.selector, 0.05 ether, 0.1 ether)); IERC7498(erc7498Tokens[0]).redeem{value: 0.05 ether}(considerationTokenIds, address(this), extraData); @@ -233,7 +230,7 @@ contract ERC7498_Revert is BaseRedeemablesTest { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); consideration[1] = ConsiderationItem({ itemType: ItemType.ERC20, @@ -265,7 +262,6 @@ contract ERC7498_Revert is BaseRedeemablesTest { // campaignId: 1 // requirementsIndex: 0 - // redemptionHash: bytes32(0) bytes memory extraData = abi.encode(1, 0, bytes32(0), defaultTraitRedemptionTokenIds, uint256(0), bytes("")); consideration[0].identifierOrCriteria = tokenId; @@ -315,7 +311,6 @@ contract ERC7498_Revert is BaseRedeemablesTest { // campaignId: 1 // requirementsIndex: 0 - // redemptionHash: bytes32(0) bytes memory extraData = abi.encode(1, 0, bytes32(0), defaultTraitRedemptionTokenIds, uint256(0), bytes("")); uint256[] memory considerationTokenIds = Solarray.uint256s(tokenId); @@ -367,7 +362,6 @@ contract ERC7498_Revert is BaseRedeemablesTest { // campaignId: 1 // requirementsIndex: 0 - // redemptionHash: bytes32(0) bytes memory extraData = abi.encode(1, 0, bytes32(0), defaultTraitRedemptionTokenIds, uint256(0), bytes("")); uint256[] memory considerationTokenIds = Solarray.uint256s(tokenId); diff --git a/test/ERC7498-SimpleRedeem.t.sol b/test/ERC7498-SimpleRedeem.t.sol index f73c727..419f400 100644 --- a/test/ERC7498-SimpleRedeem.t.sol +++ b/test/ERC7498-SimpleRedeem.t.sol @@ -17,6 +17,7 @@ import {ItemType, OrderType, Side} from "seaport-sol/src/SeaportEnums.sol"; import {OfferItemLib} from "seaport-sol/src/lib/OfferItemLib.sol"; import {ConsiderationItemLib} from "seaport-sol/src/lib/ConsiderationItemLib.sol"; import {CampaignParams, CampaignRequirements, TraitRedemption} from "../src/lib/RedeemablesStructs.sol"; +import {BURN_ADDRESS} from "../src/lib/RedeemablesConstants.sol"; import {ERC721RedemptionMintable} from "../src/extensions/ERC721RedemptionMintable.sol"; import {ERC721ShipyardRedeemableOwnerMintable} from "../src/test/ERC721ShipyardRedeemableOwnerMintable.sol"; import {ERC1155ShipyardRedeemableOwnerMintable} from "../src/test/ERC1155ShipyardRedeemableOwnerMintable.sol"; @@ -90,9 +91,8 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest { context.erc7498Token.createCampaign(params, ""); - // campaignId: 1 + // campaignId: 1, // requirementsIndex: 0 - // redemptionHash: bytes32(0) bytes memory extraData = abi.encode(1, 0, bytes32(0), defaultTraitRedemptionTokenIds, uint256(0), bytes("")); uint256[] memory considerationTokenIds = Solarray.uint256s(tokenId); @@ -101,9 +101,7 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest { emit Redemption(1, 0, bytes32(0), considerationTokenIds, defaultTraitRedemptionTokenIds, address(this)); context.erc7498Token.redeem(considerationTokenIds, address(this), extraData); - _checkTokenDoesNotExist( - address(context.erc7498Token), tokenId, context.isErc7498Token721, context.isErc7498TokenSeaDrop - ); + _checkTokenDoesNotExist(address(context.erc7498Token), tokenId, context.isErc7498Token721); assertEq(receiveToken721.ownerOf(1), address(this)); } @@ -147,7 +145,7 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); ConsiderationItem[] memory secondRequirementConsideration = new ConsiderationItem[](1); @@ -182,16 +180,13 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest { // campaignId: 1 // requirementsIndex: 1 - // redemptionHash: bytes32(0) bytes memory extraData = abi.encode(1, 1, bytes32(0), defaultTraitRedemptionTokenIds, uint256(0), bytes("")); uint256[] memory tokenIds = Solarray.uint256s(tokenId); IERC7498(context.erc7498Token).redeem(tokenIds, address(this), extraData); - _checkTokenDoesNotExist( - address(context.erc7498Token), tokenId, context.isErc7498Token721, context.isErc7498TokenSeaDrop - ); + _checkTokenDoesNotExist(address(context.erc7498Token), tokenId, context.isErc7498Token721); assertEq(firstRequirementRedeemToken.ownerOf(tokenId), address(this)); @@ -214,7 +209,7 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest { } } - function burnErc20RedeemErc721(RedeemablesContext memory context) public { + function burnErc20RedeemErc721(RedeemablesContext memory /* context */ ) public { erc20s[0].mint(address(this), 0.5 ether); CampaignRequirements[] memory requirements = new CampaignRequirements[]( @@ -244,7 +239,6 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest { // campaignId: 1 // requirementsIndex: 0 - // redemptionHash: bytes32(0) bytes memory extraData = abi.encode(1, 0, bytes32(0), defaultTraitRedemptionTokenIds, uint256(0), bytes("")); uint256[] memory considerationTokenIds = Solarray.uint256s(0); @@ -288,7 +282,6 @@ contract ERC7498_SimpleRedeem is BaseRedeemablesTest { // campaignId: 1 // requirementsIndex: 0 - // redemptionHash: bytes32(0) bytes memory extraData = abi.encode(1, 0, bytes32(0), defaultTraitRedemptionTokenIds, uint256(0), bytes("")); uint256[] memory considerationTokenIds = Solarray.uint256s(tokenId); diff --git a/test/RedeemableContractOfferer-1155.t.sol.txt b/test/RedeemableContractOfferer-1155.t.sol.txt index 044a97d..2568b18 100644 --- a/test/RedeemableContractOfferer-1155.t.sol.txt +++ b/test/RedeemableContractOfferer-1155.t.sol.txt @@ -20,6 +20,7 @@ import {MockERC721DynamicTraits} from "./utils/mocks/MockERC721DynamicTraits.sol import {OfferItemLib, ConsiderationItemLib, OrderParametersLib} from "seaport-sol/src/SeaportSol.sol"; import {RedeemableContractOfferer} from "../src/RedeemableContractOfferer.sol"; import {CampaignParams, TraitRedemption} from "../src/lib/RedeemablesStructs.sol"; +import {BURN_ADDRESS} from "../src/lib/RedeemablesConstants.sol"; import {RedeemablesErrors} from "../src/lib/RedeemablesErrors.sol"; import {ERC1155RedemptionMintable} from "../src/lib/ERC1155RedemptionMintable.sol"; import {ERC721RedemptionMintable} from "../src/extensions/ERC721RedemptionMintable.sol"; @@ -37,7 +38,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors CriteriaResolver[] criteriaResolvers; Merkle merkle = new Merkle(); - address constant _BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; + address constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; function setUp() public override { super.setUp(); @@ -77,7 +78,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors identifierOrCriteria: 0, startAmount: amount, endAmount: amount, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); { @@ -113,7 +114,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors identifierOrCriteria: tokenId, startAmount: amount, endAmount: amount, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); assertGt(uint256(consideration[0].itemType), uint256(considerationFromEvent[0].itemType)); @@ -147,7 +148,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors recipient: address(0) }); - assertEq(redeemableToken.balanceOf(_BURN_ADDRESS, tokenId), amount); + assertEq(redeemableToken.balanceOf(BURN_ADDRESS, tokenId), amount); // tokenId of redemption token will be 0. // amount minted will be equal to amount burned. @@ -191,7 +192,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors identifierOrCriteria: 0, startAmount: amount, endAmount: amount, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); campaignConsideration[1] = ConsiderationItem({ itemType: ItemType.ERC20, @@ -235,7 +236,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors identifierOrCriteria: tokenId, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); assertGt(uint256(campaignConsideration[0].itemType), uint256(considerationFromEvent[0].itemType)); @@ -267,7 +268,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors recipient: address(0) }); - assertEq(redeemableToken.balanceOf(_BURN_ADDRESS, tokenId), amount); + assertEq(redeemableToken.balanceOf(BURN_ADDRESS, tokenId), amount); assertEq(redemptionToken.balanceOf(address(this), 0), amount); assertEq(erc20BalanceBefore - erc20.balanceOf(address(this)), erc20Amount); assertEq(erc20.balanceOf(eve.addr), erc20Amount); @@ -309,7 +310,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors identifierOrCriteria: uint256(root), startAmount: amount, endAmount: amount, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); { @@ -342,7 +343,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors identifierOrCriteria: tokenId, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); assertGt(uint256(consideration[0].itemType), uint256(considerationFromEvent[0].itemType)); @@ -382,7 +383,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors }); // TODO: failing because redemptionToken tokenId is merkle root - assertEq(redeemableToken.balanceOf(_BURN_ADDRESS, tokenId), amount); + assertEq(redeemableToken.balanceOf(BURN_ADDRESS, tokenId), amount); // assertEq(redemptionToken.ownerOf(tokenId), address(this)); } } @@ -427,7 +428,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: 0, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // consideration[1] = ConsiderationItem({ @@ -436,7 +437,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: 0, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // // Create the CampaignParams with the offer and consideration from above. @@ -478,7 +479,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: burnTokenId0, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // considerationFromEvent[1] = ConsiderationItem({ @@ -487,7 +488,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: burnTokenId1, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // // Check that the consideration passed into createCampaign has itemType ERC721_WITH_CRITERIA @@ -534,8 +535,8 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // }); // // Check that the two redeemable tokens have been burned - // assertEq(redeemableToken.ownerOf(burnTokenId0), _BURN_ADDRESS); - // assertEq(redeemableToken.ownerOf(burnTokenId1), _BURN_ADDRESS); + // assertEq(redeemableToken.ownerOf(burnTokenId0), BURN_ADDRESS); + // assertEq(redeemableToken.ownerOf(burnTokenId1), BURN_ADDRESS); // // Check that the redemption token has been minted to the test contract // assertEq(redemptionToken.ownerOf(burnTokenId0), address(this)); @@ -587,7 +588,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: 0, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // // Create the CampaignParams with the offer and consideration from above. @@ -637,7 +638,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: redeemableTokenId0, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // // Check that the consideration passed into createCampaign has itemType ERC721_WITH_CRITERIA @@ -685,7 +686,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // // Check that the redeemableToken has been burned // assertEq( // redeemableToken.ownerOf(redeemableTokenId0), - // _BURN_ADDRESS + // BURN_ADDRESS // ); // // Check that the two redemptionTokens has been minted to the test contract @@ -733,7 +734,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: 0, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // consideration[1] = ConsiderationItem({ @@ -742,7 +743,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: 0, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // // Create the CampaignParams with the offer and consideration from above. @@ -784,7 +785,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: burnTokenId0, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // considerationFromEvent[1] = ConsiderationItem({ @@ -793,7 +794,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: burnTokenId0, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // // Check that the consideration passed into createCampaign has itemType ERC721_WITH_CRITERIA @@ -840,8 +841,8 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // }); // // Check that one redeemableToken and one redeemableTokenTwo have been burned - // assertEq(redeemableToken.ownerOf(burnTokenId0), _BURN_ADDRESS); - // assertEq(redeemableTokenTwo.ownerOf(burnTokenId0), _BURN_ADDRESS); + // assertEq(redeemableToken.ownerOf(burnTokenId0), BURN_ADDRESS); + // assertEq(redeemableTokenTwo.ownerOf(burnTokenId0), BURN_ADDRESS); // // Check that the redemption token has been minted to the test contract // assertEq(redemptionToken.ownerOf(burnTokenId0), address(this)); @@ -895,7 +896,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: 0, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // // Create the CampaignParams with the offer and consideration from above. @@ -945,7 +946,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: redeemableTokenId, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // // Check that the consideration passed into createCampaign has itemType ERC721_WITH_CRITERIA @@ -991,7 +992,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // }); // // Check that the redeemableToken has been burned - // assertEq(redeemableToken.ownerOf(redeemableTokenId), _BURN_ADDRESS); + // assertEq(redeemableToken.ownerOf(redeemableTokenId), BURN_ADDRESS); // // Check that the two redemptionTokens has been minted to the test contract // assertEq(redemptionToken.ownerOf(redemptionTokenId), address(this)); @@ -1149,7 +1150,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: 0, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // OrderParameters memory parameters = OrderParametersLib @@ -1207,7 +1208,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // identifierOrCriteria: 0, // startAmount: 1, // endAmount: 1, - // recipient: payable(_BURN_ADDRESS) + // recipient: payable(BURN_ADDRESS) // }); // ( @@ -1227,7 +1228,7 @@ contract TestRedeemableContractOfferer_1155 is BaseOrderTest, RedeemablesErrors // for (uint256 i; i < 5; i++) { // tokenId = i; - // assertEq(redeemableToken.ownerOf(tokenId), _BURN_ADDRESS); + // assertEq(redeemableToken.ownerOf(tokenId), BURN_ADDRESS); // assertEq(redemptionToken.ownerOf(tokenId), address(this)); // } // } diff --git a/test/RedeemableContractOfferer-721.t.sol.txt b/test/RedeemableContractOfferer-721.t.sol.txt index 7606a2d..0592086 100644 --- a/test/RedeemableContractOfferer-721.t.sol.txt +++ b/test/RedeemableContractOfferer-721.t.sol.txt @@ -19,6 +19,7 @@ import {MockERC721DynamicTraits} from "./utils/mocks/MockERC721DynamicTraits.sol import {OfferItemLib, ConsiderationItemLib, OrderParametersLib} from "seaport-sol/src/SeaportSol.sol"; import {RedeemableContractOfferer} from "../src/RedeemableContractOfferer.sol"; import {CampaignParams, TraitRedemption} from "../src/lib/RedeemablesStructs.sol"; +import {BURN_ADDRESS} from "../src/lib/RedeemablesConstants.sol"; import {RedeemablesErrors} from "../src/lib/RedeemablesErrors.sol"; import {ERC721RedemptionMintable} from "../src/extensions/ERC721RedemptionMintable.sol"; import {ERC721RedemptionMintable} from "../src/extensions/ERC721RedemptionMintable.sol"; @@ -35,7 +36,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { CriteriaResolver[] criteriaResolvers; Merkle merkle = new Merkle(); - address constant _BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; + address constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; function setUp() public override { super.setUp(); @@ -74,7 +75,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); { @@ -110,7 +111,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: tokenId, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); assertGt(uint256(consideration[0].itemType), uint256(considerationFromEvent[0].itemType)); @@ -144,7 +145,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { recipient: address(0) }); - assertEq(redeemableToken.ownerOf(tokenId), _BURN_ADDRESS); + assertEq(redeemableToken.ownerOf(tokenId), BURN_ADDRESS); assertEq(redemptionToken.ownerOf(0), address(this)); } } @@ -184,7 +185,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); campaignConsideration[1] = ConsiderationItem({ itemType: ItemType.ERC20, @@ -228,7 +229,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: tokenId, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); assertGt(uint256(campaignConsideration[0].itemType), uint256(considerationFromEvent[0].itemType)); @@ -260,7 +261,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { recipient: address(0) }); - assertEq(redeemableToken.ownerOf(tokenId), _BURN_ADDRESS); + assertEq(redeemableToken.ownerOf(tokenId), BURN_ADDRESS); assertEq(redemptionToken.ownerOf(0), address(this)); assertEq(erc20BalanceBefore - erc20.balanceOf(address(this)), erc20Amount); assertEq(erc20.balanceOf(eve.addr), erc20Amount); @@ -306,7 +307,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: uint256(root), startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); { @@ -339,7 +340,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: tokenId, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); assertGt(uint256(consideration[0].itemType), uint256(considerationFromEvent[0].itemType)); @@ -378,7 +379,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { recipient: address(0) }); - assertEq(redeemableToken.ownerOf(tokenId), _BURN_ADDRESS); + assertEq(redeemableToken.ownerOf(tokenId), BURN_ADDRESS); assertEq(redemptionTokenWithCounter.ownerOf(0), address(this)); } } @@ -423,7 +424,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); consideration[1] = ConsiderationItem({ @@ -432,7 +433,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); // Create the CampaignParams with the offer and consideration from above. @@ -473,7 +474,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: burnTokenId0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); considerationFromEvent[1] = ConsiderationItem({ @@ -482,7 +483,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: burnTokenId1, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); // Check that the consideration passed into createCampaign has itemType ERC721_WITH_CRITERIA @@ -521,8 +522,8 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { }); // Check that the two redeemable tokens have been burned - assertEq(redeemableToken.ownerOf(burnTokenId0), _BURN_ADDRESS); - assertEq(redeemableToken.ownerOf(burnTokenId1), _BURN_ADDRESS); + assertEq(redeemableToken.ownerOf(burnTokenId0), BURN_ADDRESS); + assertEq(redeemableToken.ownerOf(burnTokenId1), BURN_ADDRESS); // Check that the redemption token has been minted to the test contract assertEq(redemptionToken.ownerOf(0), address(this)); @@ -574,7 +575,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); // Create the CampaignParams with the offer and consideration from above. @@ -623,7 +624,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: redeemableTokenId0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); // Check that the consideration passed into createCampaign has itemType ERC721_WITH_CRITERIA @@ -661,7 +662,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { }); // Check that the redeemableToken has been burned - assertEq(redeemableToken.ownerOf(redeemableTokenId0), _BURN_ADDRESS); + assertEq(redeemableToken.ownerOf(redeemableTokenId0), BURN_ADDRESS); // Check that the two redemptionTokens has been minted to the test contract assertEq(redemptionTokenWithCounter.ownerOf(redemptionTokenId0), address(this)); @@ -702,7 +703,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); consideration[1] = ConsiderationItem({ @@ -711,7 +712,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); // Create the CampaignParams with the offer and consideration from above. @@ -752,7 +753,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: burnTokenId0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); considerationFromEvent[1] = ConsiderationItem({ @@ -761,7 +762,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: burnTokenId0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); // Check that the consideration passed into createCampaign has itemType ERC721_WITH_CRITERIA @@ -800,8 +801,8 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { }); // Check that one redeemableToken and one redeemableTokenTwo have been burned - assertEq(redeemableToken.ownerOf(burnTokenId0), _BURN_ADDRESS); - assertEq(redeemableTokenTwo.ownerOf(burnTokenId0), _BURN_ADDRESS); + assertEq(redeemableToken.ownerOf(burnTokenId0), BURN_ADDRESS); + assertEq(redeemableTokenTwo.ownerOf(burnTokenId0), BURN_ADDRESS); // Check that the redemption token has been minted to the test contract assertEq(redemptionToken.ownerOf(0), address(this)); @@ -855,7 +856,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); // Create the CampaignParams with the offer and consideration from above. @@ -904,7 +905,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: redeemableTokenId, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); // Check that the consideration passed into createCampaign has itemType ERC721_WITH_CRITERIA @@ -942,7 +943,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { }); // Check that the redeemableToken has been burned - assertEq(redeemableToken.ownerOf(redeemableTokenId), _BURN_ADDRESS); + assertEq(redeemableToken.ownerOf(redeemableTokenId), BURN_ADDRESS); // Check that the two redemptionTokens has been minted to the test contract assertEq(redemptionToken.ownerOf(0), address(this)); @@ -1103,7 +1104,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); OrderParameters memory parameters = OrderParametersLib.empty().withOfferer(address(offerer)).withOrderType( @@ -1156,7 +1157,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); ( @@ -1176,7 +1177,7 @@ contract TestRedeemableContractOfferer_721 is BaseOrderTest, RedeemablesErrors { for (uint256 i; i < 5; i++) { tokenId = i; - assertEq(redeemableToken.ownerOf(tokenId), _BURN_ADDRESS); + assertEq(redeemableToken.ownerOf(tokenId), BURN_ADDRESS); assertEq(redemptionToken.ownerOf(0), address(this)); } } diff --git a/test/RedeemableContractOfferer-Revert.t.sol.txt b/test/RedeemableContractOfferer-Revert.t.sol.txt index 09a3756..7b8e25a 100644 --- a/test/RedeemableContractOfferer-Revert.t.sol.txt +++ b/test/RedeemableContractOfferer-Revert.t.sol.txt @@ -19,6 +19,7 @@ import {ItemType, OrderType, Side} from "seaport-sol/src/SeaportEnums.sol"; import {OfferItemLib, ConsiderationItemLib, OrderParametersLib} from "seaport-sol/src/SeaportSol.sol"; import {RedeemableContractOfferer} from "../src/RedeemableContractOfferer.sol"; import {CampaignParams} from "../src/lib/RedeemablesStructs.sol"; +import {BURN_ADDRESS} from "../src/lib/RedeemablesConstants.sol"; import {RedeemablesErrors} from "../src/lib/RedeemablesErrors.sol"; import {ERC721RedemptionMintable} from "../src/extensions/ERC721RedemptionMintable.sol"; import {ERC721RedemptionMintable} from "../src/extensions/ERC721RedemptionMintable.sol"; @@ -35,8 +36,6 @@ contract TestRedeemableContractOfferer_Revert is BaseOrderTest, RedeemablesError CriteriaResolver[] criteriaResolvers; Merkle merkle = new Merkle(); - address constant _BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; - function setUp() public override { super.setUp(); offerer = new RedeemableContractOfferer( @@ -86,7 +85,7 @@ contract TestRedeemableContractOfferer_Revert is BaseOrderTest, RedeemablesError identifierOrCriteria: uint256(root), startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); { @@ -127,7 +126,7 @@ contract TestRedeemableContractOfferer_Revert is BaseOrderTest, RedeemablesError identifierOrCriteria: tokenId, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); assertGt(uint256(consideration[0].itemType), uint256(considerationFromEvent[0].itemType)); @@ -197,7 +196,7 @@ contract TestRedeemableContractOfferer_Revert is BaseOrderTest, RedeemablesError identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); { @@ -230,7 +229,7 @@ contract TestRedeemableContractOfferer_Revert is BaseOrderTest, RedeemablesError identifierOrCriteria: 0, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); offerFromEvent[0] = OfferItem({ @@ -247,7 +246,7 @@ contract TestRedeemableContractOfferer_Revert is BaseOrderTest, RedeemablesError identifierOrCriteria: 1, startAmount: 1, endAmount: 1, - recipient: payable(_BURN_ADDRESS) + recipient: payable(BURN_ADDRESS) }); assertGt(uint256(consideration[0].itemType), uint256(considerationFromEvent[0].itemType)); @@ -317,8 +316,8 @@ contract TestRedeemableContractOfferer_Revert is BaseOrderTest, RedeemablesError recipient: address(0) }); - assertEq(redeemableToken.ownerOf(0), _BURN_ADDRESS); - assertEq(redeemableToken.ownerOf(1), _BURN_ADDRESS); + assertEq(redeemableToken.ownerOf(0), BURN_ADDRESS); + assertEq(redeemableToken.ownerOf(1), BURN_ADDRESS); assertEq(redemptionTokenWithCounter.ownerOf(0), address(this)); assertEq(redemptionTokenWithCounter.ownerOf(1), address(this)); } diff --git a/test/utils/BaseRedeemablesTest.sol b/test/utils/BaseRedeemablesTest.sol index b3f03ca..0f46f6f 100644 --- a/test/utils/BaseRedeemablesTest.sol +++ b/test/utils/BaseRedeemablesTest.sol @@ -26,6 +26,7 @@ import {ERC1155ShipyardRedeemableOwnerMintable} from "../../src/test/ERC1155Ship import {ERC1155SeaDropRedeemableOwnerMintable} from "../../src/test/ERC1155SeaDropRedeemableOwnerMintable.sol"; import {RedeemablesErrors} from "../../src/lib/RedeemablesErrors.sol"; import {CampaignParams, CampaignRequirements, TraitRedemption} from "../../src/lib/RedeemablesStructs.sol"; +import {BURN_ADDRESS} from "../../src/lib/RedeemablesConstants.sol"; contract BaseRedeemablesTest is RedeemablesErrors, BaseOrderTest { using OfferItemLib for OfferItem; @@ -59,8 +60,6 @@ contract BaseRedeemablesTest is RedeemablesErrors, BaseOrderTest { CampaignRequirements[] defaultCampaignRequirements; // CampaignParams defaultCampaignParams; - address constant _BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; - string constant DEFAULT_ERC721_CAMPAIGN_OFFER = "default erc721 campaign offer"; string constant DEFAULT_ERC721_CAMPAIGN_CONSIDERATION = "default erc721 campaign consideration"; @@ -113,9 +112,8 @@ contract BaseRedeemablesTest is RedeemablesErrors, BaseOrderTest { ItemType.ERC721_WITH_CRITERIA ).saveDefault(DEFAULT_ERC721_CAMPAIGN_OFFER); - ConsiderationItemLib.fromDefault(SINGLE_ERC721).withToken(address(erc7498Tokens[0])).withRecipient( - _BURN_ADDRESS - ).withItemType(ItemType.ERC721_WITH_CRITERIA).saveDefault(DEFAULT_ERC721_CAMPAIGN_CONSIDERATION); + ConsiderationItemLib.fromDefault(SINGLE_ERC721).withToken(address(erc7498Tokens[0])).withRecipient(BURN_ADDRESS) + .withItemType(ItemType.ERC721_WITH_CRITERIA).saveDefault(DEFAULT_ERC721_CAMPAIGN_CONSIDERATION); defaultCampaignOffer.push(OfferItemLib.fromDefault(DEFAULT_ERC721_CAMPAIGN_OFFER)); @@ -181,10 +179,10 @@ contract BaseRedeemablesTest is RedeemablesErrors, BaseOrderTest { ); } - function _checkTokenDoesNotExist(address token, uint256 tokenId, bool isToken721, bool isTokenSeaDrop) internal { + function _checkTokenDoesNotExist(address token, uint256 tokenId, bool isToken721) internal { if (isToken721) { try IERC721(address(token)).ownerOf(tokenId) returns (address owner) { - assertEq(owner, address(_BURN_ADDRESS)); + assertEq(owner, address(BURN_ADDRESS)); } catch {} } else { // token is ERC1155 @@ -194,7 +192,7 @@ contract BaseRedeemablesTest is RedeemablesErrors, BaseOrderTest { function _checkTokenSentToBurnAddress(address token, uint256 tokenId, bool isToken721) internal { if (isToken721) { - assertEq(IERC721(address(token)).ownerOf(tokenId), _BURN_ADDRESS); + assertEq(IERC721(address(token)).ownerOf(tokenId), BURN_ADDRESS); } else { // token is ERC1155 assertEq(IERC1155(address(token)).balanceOf(address(this), tokenId), 0);