Skip to content

Commit

Permalink
Fixes IP asset types (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
leeren authored Nov 21, 2023
1 parent f3d78de commit 0edd7f0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 17 deletions.
20 changes: 10 additions & 10 deletions contracts/ip-org/IPOrgController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,16 @@ contract IPOrgController is
pendingOwner: address(0)
});

// bytes memory encodedParams = abi.encode(
// Registration.SET_IP_ORG_ASSET_TYPES,
// abi.encode(ipAssetTypes_)
// );
// ModuleRegistry(MODULE_REGISTRY).configure(
// IIPOrg(ipOrg_),
// address(this),
// ModuleRegistryKeys.REGISTRATION_MODULE,
// encodedParams
// );
bytes memory encodedParams = abi.encode(
Registration.SET_IP_ORG_ASSET_TYPES,
abi.encode(ipAssetTypes_)
);
ModuleRegistry(MODULE_REGISTRY).configure(
IIPOrg(ipOrg_),
address(this),
ModuleRegistryKeys.REGISTRATION_MODULE,
encodedParams
);

emit IPOrgRegistered(
msg.sender,
Expand Down
34 changes: 28 additions & 6 deletions test/foundry/IPOrgTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ import { IPOrgController } from "contracts/ip-org/IPOrgController.sol";
import { ModuleRegistry } from "contracts/modules/ModuleRegistry.sol";
import { IPOrgParams } from "contracts/lib/IPOrgParams.sol";
import { AccessControl } from "contracts/lib/AccessControl.sol";
import { LicenseRegistry } from "contracts/modules/licensing/LicenseRegistry.sol";
import { AccessControlSingleton } from "contracts/access-control/AccessControlSingleton.sol";
import { IPAssetRegistry } from "contracts/IPAssetRegistry.sol";
import { AccessControlHelper } from "./utils/AccessControlHelper.sol";
import { MockCollectNFT } from "./mocks/MockCollectNFT.sol";
import { MockCollectModule } from "./mocks/MockCollectModule.sol";
import { MockIPOrgController } from "./mocks/MockIPOrgController.sol";
import { BaseModule } from "contracts/modules/base/BaseModule.sol";
import { RegistrationModule } from "contracts/modules/registration/RegistrationModule.sol";
import { ModuleRegistryKeys } from "contracts/lib/modules/ModuleRegistryKeys.sol";
import 'test/foundry/utils/ProxyHelper.sol';
import "forge-std/Test.sol";

Expand All @@ -24,8 +28,11 @@ contract IPOrgTest is Test, ProxyHelper, AccessControlHelper {
event BeaconUpgraded(address indexed beacon);
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

RegistrationModule public registrationModule;
LicenseRegistry public licenseRegistry;
IPAssetRegistry public registry;
IPOrgController public ipOrgController;
ModuleRegistry public moduleRegistry;
IPOrg public ipOrg;

uint256 internal ipOrgOwnerPk = 0xa11ce;
Expand All @@ -35,18 +42,33 @@ contract IPOrgTest is Test, ProxyHelper, AccessControlHelper {
_setupAccessControl();
_grantRole(vm, AccessControl.IPORG_CREATOR_ROLE, ipOrgOwner);

address moduleRegistry = address(new ModuleRegistry(address(accessControl)));
registry = new IPAssetRegistry(moduleRegistry);

address implementation = address(new IPOrgController(moduleRegistry));
moduleRegistry = new ModuleRegistry(address(accessControl));
registry = new IPAssetRegistry(address(moduleRegistry));
address ipOrgControllerImpl = address(new IPOrgController(address(moduleRegistry)));
ipOrgController = IPOrgController(
_deployUUPSProxy(
implementation,
ipOrgControllerImpl,
abi.encodeWithSelector(
bytes4(keccak256(bytes("initialize(address)"))), address(accessControl)
bytes4(keccak256(bytes("initialize(address)"))),
address(accessControl)
)
)
);
_grantRole(vm, AccessControl.MODULE_EXECUTOR_ROLE, address(address(ipOrgController)));

licenseRegistry = new LicenseRegistry(address(registry), address(moduleRegistry));
registrationModule = new RegistrationModule(
BaseModule.ModuleConstruction({
ipaRegistry: registry,
moduleRegistry: moduleRegistry,
licenseRegistry: licenseRegistry,
ipOrgController: ipOrgController
}),
address(accessControl)
);
_grantRole(vm, AccessControl.MODULE_REGISTRAR_ROLE, address(this));
moduleRegistry.registerProtocolModule(ModuleRegistryKeys.REGISTRATION_MODULE, registrationModule);

}

function test_ipOrgController_registerIpOrg() public {
Expand Down
3 changes: 2 additions & 1 deletion test/foundry/utils/BaseTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ contract BaseTest is BaseTestUtils, ProxyHelper, AccessControlHelper {
);

vm.startPrank(ipAssetOrgOwner);
string[] memory ipAssetTypes = new string[](0);
string[] memory ipAssetTypes = new string[](1);
ipAssetTypes[0] = "CHARACTER";
ipOrg = IPOrg(spg.registerIpOrg(
ipAssetOrgOwner,
ipAssetOrgParams.name,
Expand Down

0 comments on commit 0edd7f0

Please sign in to comment.