From 902def176398108ade036c89f24b8a865a46c134 Mon Sep 17 00:00:00 2001 From: Sebastian Liu Date: Mon, 2 Sep 2024 12:37:56 -0700 Subject: [PATCH] fix(test): modify tests to work w/ the latest protocol --- test/SPGNFT.t.sol | 1 - test/StoryProtocolGateway.t.sol | 15 ++++++++++----- test/utils/BaseTest.t.sol | 11 +++-------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/test/SPGNFT.t.sol b/test/SPGNFT.t.sol index 1677aec..987e2fe 100644 --- a/test/SPGNFT.t.sol +++ b/test/SPGNFT.t.sol @@ -14,7 +14,6 @@ import { Errors } from "../contracts/lib/Errors.sol"; import { BaseTest } from "./utils/BaseTest.t.sol"; contract SPGNFTTest is BaseTest { - address internal feeRecipient; string internal nftMetadataEmpty; string internal nftMetadataDefault; diff --git a/test/StoryProtocolGateway.t.sol b/test/StoryProtocolGateway.t.sol index 6bde58c..14630f6 100644 --- a/test/StoryProtocolGateway.t.sol +++ b/test/StoryProtocolGateway.t.sol @@ -21,8 +21,6 @@ contract StoryProtocolGatewayTest is BaseTest { address owner; } - address internal feeRecipient; - mapping(uint256 index => IPAsset) internal ipAsset; address internal ipIdParent; @@ -433,14 +431,17 @@ contract StoryProtocolGatewayTest is BaseTest { nftContracts = new ISPGNFT[](10); bytes[] memory data = new bytes[](10); for (uint256 i = 0; i < 10; i++) { - data[i] = abi.encodeWithSignature( - "createCollection(string,string,uint32,uint256,address,address)", + data[i] = abi.encodeWithSelector( + spg.createCollection.selector, "Test Collection", "TEST", 100, 100 * 10 ** mockToken.decimals(), address(mockToken), - minter + feeRecipient, + minter, + true, + false ); } @@ -455,6 +456,10 @@ contract StoryProtocolGatewayTest is BaseTest { assertEq(nftContracts[i].totalSupply(), 0); assertTrue(nftContracts[i].hasRole(SPGNFTLib.MINTER_ROLE, alice)); assertEq(nftContracts[i].mintFee(), 100 * 10 ** mockToken.decimals()); + assertEq(nftContracts[i].mintFeeToken(), address(mockToken)); + assertEq(nftContracts[i].mintFeeRecipient(), bob); + assertTrue(nftContracts[i].mintOpen()); + assertFalse(nftContracts[i].publicMinting()); } } diff --git a/test/utils/BaseTest.t.sol b/test/utils/BaseTest.t.sol index b4effe3..f38e51d 100644 --- a/test/utils/BaseTest.t.sol +++ b/test/utils/BaseTest.t.sol @@ -198,7 +198,7 @@ contract BaseTest is Test { impl = address(0); // Make sure we don't deploy wrong impl address ipAccountRegistry = address(ipAssetRegistry); - impl = address(new AccessController()); + impl = address(new AccessController(address(ipAssetRegistry), address(moduleRegistry))); accessController = AccessController( TestProxyHelper.deployUUPSProxy( create3Deployer, @@ -278,6 +278,7 @@ contract BaseTest is Test { impl = address(0); // Make sure we don't deploy wrong impl impl = address( new RoyaltyModule( + _getDeployedAddress(type(LicensingModule).name), address(disputeModule), address(licenseRegistry), address(ipAssetRegistry) @@ -302,6 +303,7 @@ contract BaseTest is Test { new LicensingModule( address(accessController), address(ipAccountRegistry), + address(moduleRegistry), address(royaltyModule), address(licenseRegistry), address(disputeModule), @@ -480,13 +482,6 @@ contract BaseTest is Test { moduleRegistry.registerModule("CORE_METADATA_VIEW_MODULE", address(coreMetadataViewModule)); moduleRegistry.registerModule("GROUPING_MODULE", address(groupingModule)); - accessController.setAddresses(address(ipAssetRegistry), address(moduleRegistry)); - licenseRegistry.setDisputeModule(address(disputeModule)); - licenseRegistry.setLicensingModule(address(licensingModule)); - licenseToken.setLicensingModule(address(licensingModule)); - licenseToken.setDisputeModule(address(disputeModule)); - royaltyModule.setLicensingModule(address(licensingModule)); - coreMetadataViewModule.updateCoreMetadataModule(); licenseRegistry.registerLicenseTemplate(address(pilTemplate));