Skip to content

Commit

Permalink
fix(test): modify tests to work w/ the latest protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
sebsadface committed Sep 2, 2024
1 parent 15f9260 commit 32d1524
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
5 changes: 1 addition & 4 deletions contracts/SPGNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,7 @@ contract SPGNFT is ISPGNFT, ERC721URIStorageUpgradeable, AccessControlUpgradeabl
/// @param to The address of the recipient of the minted NFT.
/// @param nftMetadataURI OPTIONAL. The URI of the desired metadata for the newly minted NFT.
/// @return tokenId The ID of the minted NFT.
function mint(
address to,
string calldata nftMetadataURI
) public virtual returns (uint256 tokenId) {
function mint(address to, string calldata nftMetadataURI) public virtual returns (uint256 tokenId) {
if (!_getSPGNFTStorage().publicMinting && !hasRole(SPGNFTLib.MINTER_ROLE, msg.sender)) {
revert Errors.SPGNFT__MintingDenied();
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ library Errors {

/// @notice Minting is closed.
error SPGNFT__MintingClosed();

/// @notice Caller is not one of the periphery contracts.
error SPGNFT__CallerNotPeripheryContract();

Expand Down
1 change: 0 additions & 1 deletion test/SPGNFT.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
15 changes: 10 additions & 5 deletions test/StoryProtocolGateway.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ contract StoryProtocolGatewayTest is BaseTest {
address owner;
}

address internal feeRecipient;

mapping(uint256 index => IPAsset) internal ipAsset;
address internal ipIdParent;

Expand Down Expand Up @@ -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
);
}

Expand All @@ -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());
}
}

Expand Down
11 changes: 3 additions & 8 deletions test/utils/BaseTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -302,6 +303,7 @@ contract BaseTest is Test {
new LicensingModule(
address(accessController),
address(ipAccountRegistry),
address(moduleRegistry),
address(royaltyModule),
address(licenseRegistry),
address(disputeModule),
Expand Down Expand Up @@ -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));

Expand Down

0 comments on commit 32d1524

Please sign in to comment.