Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
rebase with latest code on main
Browse files Browse the repository at this point in the history
  • Loading branch information
kingster-will committed Feb 12, 2024
1 parent 8245a65 commit f8f6ecd
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 12 deletions.
1 change: 0 additions & 1 deletion contracts/modules/licensing/LicensingModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ contract LicensingModule is AccessControlled, ILicensingModule, BaseModule, Reen
LICENSE_REGISTRY.burnLicenses(holder, licenseIds);
}


function supportsInterface(bytes4 interfaceId) public view virtual override(BaseModule, IERC165) returns (bool) {
return interfaceId == type(ILicensingModule).interfaceId || super.supportsInterface(interfaceId);
}
Expand Down
5 changes: 2 additions & 3 deletions test/foundry/mocks/MockTokenGatedHook.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import { IERC165, ERC165 } from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import { IERC165 } from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import { IHookModule } from "../../../contracts/interfaces/modules/base/IHookModule.sol";
import { BaseModule } from "../../../contracts/modules/BaseModule.sol";

/// @title Token Gated Hook.
/// @title Mock Token Gated Hook.
/// @notice Hook for ensursing caller is the owner of an NFT token.
contract MockTokenGatedHook is BaseModule, IHookModule {
using ERC165Checker for address;
Expand All @@ -33,5 +33,4 @@ contract MockTokenGatedHook is BaseModule, IHookModule {
function supportsInterface(bytes4 interfaceId) public view virtual override(BaseModule, IERC165) returns (bool) {
return interfaceId == type(IHookModule).interfaceId || super.supportsInterface(interfaceId);
}

}
8 changes: 7 additions & 1 deletion test/foundry/mocks/licensing/MockLicensingModule.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;

import { IERC165 } from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import { Licensing } from "contracts/lib/Licensing.sol";
import { ILicensingModule } from "contracts/interfaces/modules/licensing/ILicensingModule.sol";
import { BaseModule } from "contracts/modules/BaseModule.sol";

/// @title Mock Licensing Module
contract MockLicensingModule is ILicensingModule {
contract MockLicensingModule is BaseModule, ILicensingModule {
function licenseRegistry() external view returns (address) {}

function registerPolicyFrameworkManager(address manager) external {}
Expand Down Expand Up @@ -71,4 +73,8 @@ contract MockLicensingModule is ILicensingModule {
function name() external view returns (string memory) {
return "LICENSING_MODULE";
}

function supportsInterface(bytes4 interfaceId) public view virtual override(BaseModule, IERC165) returns (bool) {
return interfaceId == type(ILicensingModule).interfaceId || super.supportsInterface(interfaceId);
}
}
1 change: 0 additions & 1 deletion test/foundry/modules/ModuleBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ abstract contract ModuleBaseTest is BaseTest {
);
ipResolver = new IPResolver(address(accessController), address(ipAssetRegistry));
registrationModule = new RegistrationModule(
address(accessController),
address(ipAssetRegistry),
address(licensingModule),
address(ipResolver)
Expand Down
13 changes: 9 additions & 4 deletions test/foundry/modules/licensing/LicensingModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ contract LicensingModuleTest is Test {
UMLPolicyFrameworkManager internal umlManager;

MockERC721 internal nft = new MockERC721("MockERC721");
MockERC721 internal gatedNftFoo = new MockERC721("GatedNftFoo");
MockERC721 internal gatedNftBar = new MockERC721("GatedNftBar");
MockERC721 internal gatedNftFoo = new MockERC721{ salt: bytes32(uint256(1)) }("GatedNftFoo");
MockERC721 internal gatedNftBar = new MockERC721{ salt: bytes32(uint256(2)) }("GatedNftBar");

ModuleRegistry internal moduleRegistry;

Expand Down Expand Up @@ -113,7 +113,6 @@ contract LicensingModuleTest is Test {
);
IPResolver ipResolver = new IPResolver(address(accessController), address(ipAssetRegistry));
RegistrationModule registrationModule = new RegistrationModule(
address(accessController),
address(ipAssetRegistry),
address(licensingModule),
address(ipResolver)
Expand All @@ -132,6 +131,12 @@ contract LicensingModuleTest is Test {

vm.label(ipId1, "IPAccount1");
vm.label(ipId2, "IPAccount2");

// MockERC721 tempGatedNftFoo = new MockERC721("GatedNftFoo");
// bytes memory GatedNftFooCode = address(tempGatedNftFoo).code;
// address gatedNftFoo = makeAddr("GatedNftFoo");
//// vm.etch(gatedNftFoo, GatedNftFooCode);
// deployCodeTo("test/foundry/mocks/MockTokenGatedHook.sol", gatedNftFoo);
}

function _createPolicy() internal pure returns (bytes memory) {
Expand Down Expand Up @@ -548,7 +553,7 @@ contract LicensingModuleTest is Test {

/* solhint-disable */
string
memory expectedJson = "eyJuYW1lIjogIlN0b3J5IFByb3RvY29sIExpY2Vuc2UgTkZUIiwgImRlc2NyaXB0aW9uIjogIkxpY2Vuc2UgYWdyZWVtZW50IHN0YXRpbmcgdGhlIHRlcm1zIG9mIGEgU3RvcnkgUHJvdG9jb2wgSVBBc3NldCIsICJhdHRyaWJ1dGVzIjogW3sidHJhaXRfdHlwZSI6ICJBdHRyaWJ1dGlvbiIsICJ2YWx1ZSI6ICJ0cnVlIn0seyJ0cmFpdF90eXBlIjogIlRyYW5zZmVyYWJsZSIsICJ2YWx1ZSI6ICJ0cnVlIn0seyJ0cmFpdF90eXBlIjogIkNvbW1lcmljYWwgVXNlIiwgInZhbHVlIjogInRydWUifSx7InRyYWl0X3R5cGUiOiAiY29tbWVyY2lhbEF0dHJpYnV0aW9uIiwgInZhbHVlIjogInRydWUifSx7InRyYWl0X3R5cGUiOiAiY29tbWVyY2lhbFJldlNoYXJlIiwgInZhbHVlIjogMH0seyJ0cmFpdF90eXBlIjogImNvbW1lcmNpYWxpemVyQ2hlY2siLCAidmFsdWUiOiAiMHhhMDViYzBlYTdhMzZiY2FkODQxNjc0OWFmOGE2MzBhODkxZTJkNDZjIn0sIHsidHJhaXRfdHlwZSI6IC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vbW1lcmNpYWxpemVyQ2hlY2siLCAidmFsdWUiOiAiMHgxMGY3YWJkMDEyNmE5MDkzNWYzZjkwMDJmYTc5NzY3YWZjMGUzYzBkIn0sIHsidHJhaXRfdHlwZSI6ICJkZXJpdmF0aXZlc0FsbG93ZWQiLCAidmFsdWUiOiAidHJ1ZSJ9LHsidHJhaXRfdHlwZSI6ICJkZXJpdmF0aXZlc0F0dHJpYnV0aW9uIiwgInZhbHVlIjogInRydWUifSx7InRyYWl0X3R5cGUiOiAiZGVyaXZhdGl2ZXNBcHByb3ZhbCIsICJ2YWx1ZSI6ICJ0cnVlIn0seyJ0cmFpdF90eXBlIjogImRlcml2YXRpdmVzUmVjaXByb2NhbCIsICJ2YWx1ZSI6ICJ0cnVlIn0seyJ0cmFpdF90eXBlIjogImRlcml2YXRpdmVzUmV2U2hhcmUiLCAidmFsdWUiOiAwfSx7InRyYWl0X3R5cGUiOiAidGVycml0b3JpZXMiLCAidmFsdWUiOiBbInRlcnJpdG9yeTEiXX0sIHsidHJhaXRfdHlwZSI6ICJkaXN0cmlidXRpb25DaGFubmVscyIsICJ2YWx1ZSI6IFsiZGlzdHJpYnV0aW9uQ2hhbm5lbDEiXX1dfQ==";
/* solhint-enable */

string memory expectedUri = string(abi.encodePacked("data:application/json;base64,", expectedJson));
Expand Down
3 changes: 2 additions & 1 deletion test/foundry/modules/licensing/UMLPolicyFramework.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ contract UMLPolicyFrameworkTest is TestHelper {
attribution: true,
commercialUse: false,
commercialAttribution: false,
commercializers: emptyStringArray,
commercializerChecker: address(0),
commercializerCheckerData: "",
commercialRevShare: 0,
derivativesAllowed: false,
derivativesAttribution: false,
Expand Down
1 change: 0 additions & 1 deletion test/foundry/registries/metadata/MetadataProvider.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ contract MetadataProviderTest is BaseTest {
);
IPResolver ipResolver = new IPResolver(address(accessController), address(registry));
RegistrationModule registrationModule = new RegistrationModule(
address(accessController),
address(registry),
address(licensingModule),
address(ipResolver)
Expand Down

0 comments on commit f8f6ecd

Please sign in to comment.