Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramarti committed Apr 12, 2024
1 parent abb834e commit 20b78ec
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 6 deletions.
3 changes: 3 additions & 0 deletions contracts/LicenseToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ contract LicenseToken is ILicenseToken, ERC721EnumerableUpgradeable, AccessManag
/// @dev Initializes the LicenseToken contract
function initialize(address accessManager, string memory imageUrl) public initializer {
__ERC721_init("Programmable IP License Token", "PILicenseToken");
if (accessManager == address(0)) {
revert Errors.LicenseToken__ZeroAccessManager();
}
__AccessManaged_init(accessManager);
__UUPSUpgradeable_init();
_getLicenseTokenStorage().imageUrl = imageUrl;
Expand Down
3 changes: 3 additions & 0 deletions contracts/access/AccessController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ contract AccessController is IAccessController, AccessManagedUpgradeable, UUPSUp
/// @notice initializer for this implementation contract
/// @param accessManager The address of the protocol admin roles contract
function initialize(address accessManager) external initializer {
if (accessManager == address(0)) {
revert Errors.AccessController__ZeroAccessManager();
}
__AccessManaged_init(accessManager);
}

Expand Down
15 changes: 15 additions & 0 deletions contracts/lib/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ library Errors {
// IPAssetRegistry //
////////////////////////////////////////////////////////////////////////////

/// @notice zero address provided for access manager in initializer.
error IPAssetRegistry__ZeroAccessManager();

/// @notice The IP asset has already been registered.
error IPAssetRegistry__AlreadyRegistered();

Expand Down Expand Up @@ -110,6 +113,7 @@ library Errors {
// LicenseRegistry //
////////////////////////////////////////////////////////////////////////////

error LicenseRegistry__ZeroAccessManager();
error LicenseRegistry__CallerNotLicensingModule();
error LicenseRegistry__ZeroLicensingModule();
error LicensingModule__CallerNotLicenseRegistry();
Expand Down Expand Up @@ -140,6 +144,7 @@ library Errors {
error LicenseToken__CallerNotLicensingModule();
error LicenseToken__ZeroLicensingModule();
error LicenseToken__ZeroDisputeModule();
error LicenseToken__ZeroAccessManager();
error LicenseToken__RevokedLicense(uint256 tokenId);
error LicenseToken__NotTransferable();
error LicenseToken__LicenseTokenExpired(uint256 tokenId, uint256 expiredAt, uint256 currentTimestamp);
Expand All @@ -152,6 +157,7 @@ library Errors {
// LicensingModule //
////////////////////////////////////////////////////////////////////////////

error LicensingModule__ZeroAccessManager();
error LicensingModule__IpAlreadyLinked();
error LicensingModule__PolicyAlreadySetForIpId();
error LicensingModule__FrameworkNotFound();
Expand Down Expand Up @@ -222,6 +228,7 @@ library Errors {
// Dispute Module //
////////////////////////////////////////////////////////////////////////////

error DisputeModule__ZeroAccessManager();
error DisputeModule__ZeroArbitrationPolicy();
error DisputeModule__ZeroArbitrationRelayer();
error DisputeModule__ZeroDisputeTag();
Expand All @@ -242,6 +249,11 @@ library Errors {
error DisputeModule__ZeroController();
error DisputeModule__ZeroAccessManager();

////////////////////////////////////////////////////////////////////////////
// ArbitrationPolicy SP //
////////////////////////////////////////////////////////////////////////////

error ArbitrationPolicySP__ZeroAccessManager();
error ArbitrationPolicySP__ZeroDisputeModule();
error ArbitrationPolicySP__ZeroPaymentToken();
error ArbitrationPolicySP__NotDisputeModule();
Expand All @@ -251,6 +263,7 @@ library Errors {
// Royalty Module //
////////////////////////////////////////////////////////////////////////////

error RoyaltyModule__ZeroAccessManager();
error RoyaltyModule__ZeroRoyaltyPolicy();
error RoyaltyModule__NotWhitelistedRoyaltyPolicy();
error RoyaltyModule__ZeroRoyaltyToken();
Expand Down Expand Up @@ -294,6 +307,7 @@ library Errors {
// ModuleRegistry //
////////////////////////////////////////////////////////////////////////////

error ModuleRegistry__ZeroAccessManager();
error ModuleRegistry__ModuleAddressZeroAddress();
error ModuleRegistry__ModuleAddressNotContract();
error ModuleRegistry__ModuleAlreadyRegistered();
Expand All @@ -311,6 +325,7 @@ library Errors {
// AccessController //
////////////////////////////////////////////////////////////////////////////

error AccessController__ZeroAccessManager();
error AccessController__IPAccountIsZeroAddress();
error AccessController__IPAccountIsNotValid(address ipAccount);
error AccessController__SignerIsZeroAddress();
Expand Down
5 changes: 3 additions & 2 deletions contracts/modules/dispute/DisputeModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ contract DisputeModule is
/// @notice Initializer for this implementation contract
/// @param accessManager The address of the protocol admin roles contract
function initialize(address accessManager) external initializer {
if (accessManager == address(0)) revert Errors.DisputeModule__ZeroAccessManager();

if (accessManager == address(0)) {
revert Errors.DisputeModule__ZeroAccessManager();
}
__AccessManaged_init(accessManager);
__ReentrancyGuard_init();
__UUPSUpgradeable_init();
Expand Down
5 changes: 3 additions & 2 deletions contracts/modules/dispute/policies/ArbitrationPolicySP.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ contract ArbitrationPolicySP is IArbitrationPolicy, AccessManagedUpgradeable, UU
/// @notice initializer for this implementation contract
/// @param accessManager The address of the protocol admin roles contract
function initialize(address accessManager) public initializer {
if (accessManager == address(0)) revert Errors.ArbitrationPolicySP__ZeroAccessManager();

if (accessManager == address(0)) {
revert Errors.ArbitrationPolicySP__ZeroAccessManager();
}
__AccessManaged_init(accessManager);
__UUPSUpgradeable_init();
}
Expand Down
3 changes: 3 additions & 0 deletions contracts/modules/licensing/LicensingModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ contract LicensingModule is
function initialize(address accessManager) public initializer {
__ReentrancyGuard_init();
__UUPSUpgradeable_init();
if (accessManager == address(0)) {
revert Errors.LicensingModule__ZeroAccessManager();
}
__AccessManaged_init(accessManager);
}

Expand Down
4 changes: 3 additions & 1 deletion contracts/modules/royalty/RoyaltyModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ contract RoyaltyModule is
/// @notice Initializer for this implementation contract
/// @param accessManager The address of the protocol admin roles contract
function initialize(address accessManager) external initializer {
if (accessManager == address(0)) revert Errors.RoyaltyModule__ZeroAccessManager();
if (accessManager == address(0)) {
revert Errors.RoyaltyModule__ZeroAccessManager();
}
__AccessManaged_init(accessManager);
__ReentrancyGuard_init();
__UUPSUpgradeable_init();
Expand Down
7 changes: 6 additions & 1 deletion contracts/registries/IPAssetRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ contract IPAssetRegistry is IIPAssetRegistry, IPAccountRegistry, AccessManagedUp
0x987c61809af5a42943abd137c7acff8426aab6f7a1f5c967a03d1d718ba5cf00;

/// @custom:oz-upgrades-unsafe-allow constructor
constructor(address erc6551Registry, address ipAccountImpl) IPAccountRegistry(erc6551Registry, ipAccountImpl) {}
constructor(address erc6551Registry, address ipAccountImpl) IPAccountRegistry(erc6551Registry, ipAccountImpl) {
_disableInitializers();
}

/// @notice Initializes the IPAssetRegistry contract.
/// @param accessManager The address of the access manager.
function initialize(address accessManager) public initializer {
if (accessManager == address(0)) {
revert Errors.IPAssetRegistry__ZeroAccessManager();
}
__AccessManaged_init(accessManager);
__UUPSUpgradeable_init();
}
Expand Down
3 changes: 3 additions & 0 deletions contracts/registries/LicenseRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ contract LicenseRegistry is ILicenseRegistry, AccessManagedUpgradeable, UUPSUpgr
/// @notice initializer for this implementation contract
/// @param accessManager The address of the protocol admin roles contract
function initialize(address accessManager) public initializer {
if (accessManager == address(0)) {
revert Errors.LicenseRegistry__ZeroAccessManager();
}
__AccessManaged_init(accessManager);
__UUPSUpgradeable_init();
}
Expand Down
3 changes: 3 additions & 0 deletions contracts/registries/ModuleRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ contract ModuleRegistry is IModuleRegistry, AccessManagedUpgradeable, UUPSUpgrad
/// @notice initializer for this implementation contract
/// @param accessManager The address of the governance.
function initialize(address accessManager) public initializer {
if (accessManager == address(0)) {
revert Errors.ModuleRegistry__ZeroAccessManager();
}
__AccessManaged_init(accessManager);
__UUPSUpgradeable_init();

Expand Down

0 comments on commit 20b78ec

Please sign in to comment.