Skip to content

Commit

Permalink
Fixes import ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
leeren committed Oct 30, 2023
1 parent 47a1615 commit ee6a099
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 22 deletions.
32 changes: 17 additions & 15 deletions contracts/IPAssetOrgFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,27 @@ contract IPAssetOrgFactory is
mapping(address => bool) registered;
}

/// @notice Checks if an address is a valid IP Asset Organization.
/// @param ipAssetOrg_ the address to check
/// @return true if `ipAssetOrg_` is a valid IP Asset Organization, false otherwise
function isIpAssetOrg(
address ipAssetOrg_
) external view returns (bool) {
IPAssetOrgFactoryStorage storage $ = _getIpAssetOrgFactoryStorage();
return $.registered[ipAssetOrg_];
}

/// @notice Returns the current version of the factory contract.
function version() external pure override returns (string memory) {
return _VERSION;
}


/// @notice Registers a new ipAssetOrg for IP asset collection management.
/// @param params_ Parameters required for ipAssetOrg creation.
/// TODO: Converge on core primitives utilized for ipAssetOrg management.
/// TODO: Add ipAssetOrg-wide module configurations to the registration process.
// TODO: Remove registry
function registerIPAssetOrg(
IPAsset.RegisterIPAssetOrgParams calldata params_
) public returns (address) {
Expand Down Expand Up @@ -76,21 +93,6 @@ contract IPAssetOrgFactory is

}

/// @notice Checks if an address is a valid IP Asset Organization.
/// @param ipAssetOrg_ the address to check
/// @return true if `ipAssetOrg_` is a valid IP Asset Organization, false otherwise
function isIpAssetOrg(
address ipAssetOrg_
) external view returns (bool) {
IPAssetOrgFactoryStorage storage $ = _getIpAssetOrgFactoryStorage();
return $.registered[ipAssetOrg_];
}

/// @notice Returns the current version of the factory contract.
function version() external pure override returns (string memory) {
return _VERSION;
}

/// @notice Initializes the IPAssetOrgFactory contract.
/// @param accessControl_ Address of the contract responsible for access control.
function initialize(address accessControl_) public initializer {
Expand Down
18 changes: 16 additions & 2 deletions contracts/IPAssetRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;

import { IIPAssetRegistry } from "contracts/interfaces/IIPAssetRegistry.sol";

/// @title IP Asset Registry
/// @notice The source of truth for IP on Story Protocol.
// TO-DO(@leeren): Add authorization around IP Asset registration and ownership transferring.
// TO-DO(ramarti): Add authorization around IP Asset Org transfer of IP Assets.
contract IPAssetRegistry {
contract IPAssetRegistry is IIPAssetRegistry {

/// @notice Core attributes that make up an IP Asset.
// TO-DO: Add other core IP Asset primitives (namely module linking).
struct IPAsset {
address owner;
address owner; // TO-DO: Consider removing this in the future.
address ipAssetOrg;
}

Expand All @@ -31,9 +33,21 @@ contract IPAssetRegistry {
owner: owner_,
ipAssetOrg: ipAssetOrg_
});

emit IPAssetRegistered(ipAssetId, owner_, ipAssetOrg_);
return ipAssetId;
}

function setOwner(uint256 ipAssetId_, address owner_) public {
ipAssets[ipAssetId_].owner = owner_;
emit OwnerTransferred(ipAssetId_, owner_);
}

function setIpAssetOrg(uint256 ipAssetId_, address ipAssetOrg_) public {
ipAssets[ipAssetId_].ipAssetOrg = ipAssetOrg_;
emit OrgTransferred(ipAssetId_, ipAssetOrg_);
}

/// @notice Gets the IP Asset Org that administers a specific IP Asset.
/// @param ipAssetId_ The id of the IP Asset being queried.
function ipAssetOrg(uint256 ipAssetId_) public returns (address) {
Expand Down
24 changes: 24 additions & 0 deletions contracts/interfaces/IIPAssetRegistry.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { IPAsset } from "contracts/lib/IPAsset.sol";

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;

interface IIPAssetRegistry {

event IPAssetRegistered(
uint256 ipAssetId_,
address owner_,
address ipAssetOrg_
);

event OrgTransferred(
uint256 indexed ipAssetId_,
address indexed owner_
);

event OwnerTransferred(
uint256 indexed ipAssetId_,
address indexed owner_
);

}
11 changes: 6 additions & 5 deletions contracts/ip-assets/IPAssetOrg.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ contract IPAssetOrg is
// TODO(ramarti): Refactor to configure IP Asset types via registry modules.
uint256 private constant _ROOT_IP_ASSET = 0;

/// @notice Returns the current version of the IP asset org contract.
function version() external pure virtual returns (string memory) {
return _VERSION;
}


function initialize(IPAsset.InitIPAssetOrgParams memory params_) public initializer {

// TODO(ramarti) Decouple IPAssetOrg from the RightsManager and make sure to move `__ERC721_init` here.
Expand All @@ -63,11 +69,6 @@ contract IPAssetOrg is
COLLECT_MODULE = ICollectModule(params_.collectModule);
}

/// @notice Returns the current version of the IP asset org contract.
function version() external pure virtual returns (string memory) {
return _VERSION;
}

/// Creates a new IPAsset, and assigns licenses (rights) to it, according to the IPAssetOrg
/// config in LicensingModule.
/// A Non commercial license is always assigned, and if the IPAsset is a root IPAsset,
Expand Down

0 comments on commit ee6a099

Please sign in to comment.