LicensingModule.sol

Licensing module is the main entry point for the licensing system. It is responsible for:

  • Registering policy frameworks
  • Registering policies
  • Minting licenses
  • Linking IP to its parent
  • Verifying linking parameters
  • Verifying policy parameters

name

string name

Returns the string identifier associated with the module.

ROYALTY_MODULE

contract RoyaltyModule ROYALTY_MODULE

Returns the canonical protocol-wide RoyaltyModule

LICENSE_REGISTRY

contract ILicenseRegistry LICENSE_REGISTRY

Returns the canonical protocol-wide LicenseRegistry

DISPUTE_MODULE

contract IDisputeModule DISPUTE_MODULE

Returns the dispute module

onlyLicenseRegistry

modifier onlyLicenseRegistry()

Modifier to allow only LicenseRegistry as the caller

constructor

constructor(address accessController, address ipAccountRegistry, address royaltyModule, address registry, address disputeModule) public

registerPolicyFrameworkManager

function registerPolicyFrameworkManager(address manager) external

Registers a policy framework manager into the contract, so it can add policy data for licenses.

Parameters

NameTypeDescription
manageraddressthe address of the manager. Will be ERC165 checked for IPolicyFrameworkManager

registerPolicy

function registerPolicy(struct Licensing.Policy pol) external returns (uint256 policyId)

Registers a policy into the contract. MUST be called by a registered framework or it will revert.
The policy data and its integrity must be verified by the policy framework manager.

Parameters

NameTypeDescription
polstruct Licensing.PolicyThe Licensing policy data. MUST have same policy framework as the caller address

Return Values

NameTypeDescription
policyIduint256The id of the newly registered policy

addPolicyToIp

function addPolicyToIp(address ipId, uint256 polId) external returns (uint256 indexOnIpId)

Adds a policy to the set of policies of an IP. Reverts if policy is undefined in LicenseRegistry.

Parameters

NameTypeDescription
ipIdaddressThe id of the IP
polIduint256The id of the policy

Return Values

NameTypeDescription
indexOnIpIduint256The index of the policy in the IP's policy list

mintLicense

function mintLicense(uint256 policyId, address licensorIpId, uint256 amount, address receiver, bytes royaltyContext) external returns (uint256 licenseId)

Mints a license to create derivative IP. License NFTs represent a policy granted by IPs (licensors).
Reverts if caller is not authorized by any of the licensors.

This NFT needs to be burned in order to link a derivative IP with its parents. If this is the first
combination of policy and licensors, a new licenseId will be created (by incrementing prev totalLicenses).
If not, the license is fungible and an id will be reused. The licensing terms that regulate creating new
licenses will be verified to allow minting.

Parameters

NameTypeDescription
policyIduint256The id of the policy with the licensing parameters
licensorIpIdaddressThe id of the licensor IP
amountuint256The amount of licenses to mint
receiveraddressThe address that will receive the license
royaltyContextbytesThe context for the royalty module to process

Return Values

NameTypeDescription
licenseIduint256The ID of the license NFT(s)

linkIpToParents

function linkIpToParents(uint256[] licenseIds, address childIpId, bytes royaltyContext) external

Links an IP to the licensors listed in the license NFTs, if their policies allow it. Burns the license
NFTs in the proccess. The caller must be the owner of the IP asset and license NFTs.

Parameters

NameTypeDescription
licenseIdsuint256[]The id of the licenses to burn
childIpIdaddressThe id of the child IP to be linked
royaltyContextbytesThe context for the royalty module to process

isFrameworkRegistered

function isFrameworkRegistered(address policyFramework) external view returns (bool)

Returns if the framework address is registered in the LicensingModule.

Parameters

NameTypeDescription
policyFrameworkaddressThe address of the policy framework manager

Return Values

NameTypeDescription
[0]boolisRegistered True if the framework is registered

totalPolicies

function totalPolicies() external view returns (uint256)

Returns amount of distinct licensing policies in the LicensingModule.

Return Values

NameTypeDescription
[0]uint256totalPolicies The amount of policies

policy

function policy(uint256 policyId) public view returns (struct Licensing.Policy pol)

Returns the policy data for policyId, reverts if not found.

Parameters

NameTypeDescription
policyIduint256The id of the policy

Return Values

NameTypeDescription
polstruct Licensing.PolicyThe policy data

getPolicyId

function getPolicyId(struct Licensing.Policy pol) external view returns (uint256 policyId)

Returns the policy id for the given policy data, or 0 if not found.

Parameters

NameTypeDescription
polstruct Licensing.PolicyThe policy data in Policy struct

Return Values

NameTypeDescription
policyIduint256The id of the policy

policyAggregatorData

function policyAggregatorData(address framework, address ipId) external view returns (bytes)

Returns the policy aggregator data for the given IP ID in the framework.

Parameters

NameTypeDescription
frameworkaddressThe address of the policy framework manager
ipIdaddressThe id of the IP asset

Return Values

NameTypeDescription
[0]bytesdata The encoded policy aggregator data to be decoded by the framework manager

isPolicyDefined

function isPolicyDefined(uint256 policyId) public view returns (bool)

Returns if policyId exists in the LicensingModule

Parameters

NameTypeDescription
policyIduint256The id of the policy

Return Values

NameTypeDescription
[0]boolisDefined True if the policy is defined

policyIdsForIp

function policyIdsForIp(bool isInherited, address ipId) external view returns (uint256[] policyIds)

Returns the policy ids attached to an IP

Potentially gas-intensive operation, use with care.

Parameters

NameTypeDescription
isInheritedboolTrue if the policy is inherited from a parent IP
ipIdaddressThe id of the IP asset

Return Values

NameTypeDescription
policyIdsuint256[]The ids of policy ids for the IP

totalPoliciesForIp

function totalPoliciesForIp(bool isInherited, address ipId) public view returns (uint256)

Returns the total number of policies attached to an IP

Parameters

NameTypeDescription
isInheritedboolTrue if the policy is inherited from a parent IP
ipIdaddressThe id of the IP asset

Return Values

NameTypeDescription
[0]uint256totalPolicies The total number of policies for the IP

isPolicyIdSetForIp

function isPolicyIdSetForIp(bool isInherited, address ipId, uint256 policyId) external view returns (bool)

True if the given policy attached to the given IP is inherited from a parent IP.

Parameters

NameTypeDescription
isInheritedbool
ipIdaddressThe id of the IP asset that has the policy attached
policyIduint256The id of the policy to check if inherited

Return Values

NameTypeDescription
[0]boolisInherited True if the policy is inherited from a parent IP

policyIdForIpAtIndex

function policyIdForIpAtIndex(bool isInherited, address ipId, uint256 index) external view returns (uint256 policyId)

Returns the policy ID for an IP by local index on the IP's policy set

Parameters

NameTypeDescription
isInheritedboolTrue if the policy is inherited from a parent IP
ipIdaddressThe id of the IP asset to check
indexuint256The local index of a policy in the IP's policy set

Return Values

NameTypeDescription
policyIduint256The id of the policy

policyForIpAtIndex

function policyForIpAtIndex(bool isInherited, address ipId, uint256 index) external view returns (struct Licensing.Policy)

Returns the policy data for an IP by the policy's local index on the IP's policy set

Parameters

NameTypeDescription
isInheritedboolTrue if the policy is inherited from a parent IP
ipIdaddressThe id of the IP asset to check
indexuint256The local index of a policy in the IP's policy set

Return Values

NameTypeDescription
[0]struct Licensing.Policypolicy The policy data

policyStatus

function policyStatus(address ipId, uint256 policyId) external view returns (uint256 index, bool isInherited, bool active)

Returns the status of a policy in an IP's policy set

Parameters

NameTypeDescription
ipIdaddressThe id of the IP asset to check
policyIduint256The id of the policy

Return Values

NameTypeDescription
indexuint256The local index of the policy in the IP's policy set
isInheritedboolTrue if the policy is inherited from a parent IP
activeboolTrue if the policy is active

isPolicyInherited

function isPolicyInherited(address ipId, uint256 policyId) external view returns (bool)

Returns if the given policy attached to the given IP is inherited from a parent IP.

Parameters

NameTypeDescription
ipIdaddressThe id of the IP asset that has the policy attached
policyIduint256The id of the policy to check if inherited

Return Values

NameTypeDescription
[0]boolisInherited True if the policy is inherited from a parent IP

isParent

function isParent(address parentIpId, address childIpId) external view returns (bool)

Returns if an IP is a derivative of another IP

Parameters

NameTypeDescription
parentIpIdaddressThe id of the parent IP asset to check
childIpIdaddressThe id of the child IP asset to check

Return Values

NameTypeDescription
[0]boolisParent True if the child IP is a derivative of the parent IP

parentIpIds

function parentIpIds(address ipId) external view returns (address[])

Returns the list of parent IP assets for a given child IP asset

Parameters

NameTypeDescription
ipIdaddressThe id of the child IP asset to check

Return Values

NameTypeDescription
[0]address[]parentIpIds The ids of the parent IP assets

totalParentsForIpId

function totalParentsForIpId(address ipId) external view returns (uint256)

Returns the total number of parents for an IP asset

Parameters

NameTypeDescription
ipIdaddressThe id of the IP asset to check

Return Values

NameTypeDescription
[0]uint256totalParents The total number of parent IP assets