The LicenseRegistry manages the registration and tracking of License NFTs (LNFTs), which represent licenses granted by IP ID licensors to create derivative IPs. It provides functionality for managing license templates, license terms, and the relationships between parent and derivative IP assets.

State Variables

MAX_PARENTS

uint256 public constant MAX_PARENTS = 16

The maximum number of parent IPs a derivative IP can have.

MAX_ANCESTORS

uint256 public constant MAX_ANCESTORS = 1024

The maximum number of ancestor IPs a derivative IP can have.

IP_GRAPH

address public constant IP_GRAPH = address(0x0101)

The address of the IP Graph contract that tracks relationships between IPs.

GROUP_IP_ASSET_REGISTRY

IGroupIPAssetRegistry public immutable GROUP_IP_ASSET_REGISTRY

The address of the Group IP Asset Registry contract.

LICENSING_MODULE

ILicensingModule public immutable LICENSING_MODULE

The address of the Licensing Module contract.

DISPUTE_MODULE

IDisputeModule public immutable DISPUTE_MODULE

The address of the Dispute Module contract.

IP_GRAPH_ACL

IPGraphACL public immutable IP_GRAPH_ACL

The address of the IP Graph Access Control List contract.

EXPIRATION_TIME

bytes32 public constant EXPIRATION_TIME = "EXPIRATION_TIME"

The key used to store expiration time in IP Account storage.

Functions

initialize

function initialize(address accessManager) public initializer

Initializes the LicenseRegistry contract.

Parameters:

  • accessManager: The address of the protocol admin roles contract.

setDefaultLicenseTerms

function setDefaultLicenseTerms(address newLicenseTemplate, uint256 newLicenseTermsId) external restricted

Sets the default license terms that are attached to all IPs by default.

Parameters:

  • newLicenseTemplate: The address of the new default license template.
  • newLicenseTermsId: The ID of the new default license terms.

registerLicenseTemplate

function registerLicenseTemplate(address licenseTemplate) external restricted

Registers a new license template on Story.

Parameters:

  • licenseTemplate: The address of the license template to register.

setLicensingConfigForLicense

function setLicensingConfigForLicense(
    address ipId,
    address licenseTemplate,
    uint256 licenseTermsId,
    Licensing.LicensingConfig calldata licensingConfig
) external onlyLicensingModule

Sets the minting license configuration for a specific license attached to a specific IP.

Parameters:

  • ipId: The address of the IP for which the configuration is being set.
  • licenseTemplate: The address of the license template used.
  • licenseTermsId: The ID of the license terms within the license template.
  • licensingConfig: The configuration for minting the license.

attachLicenseTermsToIp

function attachLicenseTermsToIp(
    address ipId,
    address licenseTemplate,
    uint256 licenseTermsId
) external onlyLicensingModule

Attaches license terms to an IP.

Parameters:

  • ipId: The address of the IP to which the license terms are attached.
  • licenseTemplate: The address of the license template.
  • licenseTermsId: The ID of the license terms.

registerDerivativeIp

function registerDerivativeIp(
    address childIpId,
    address[] calldata parentIpIds,
    address licenseTemplate,
    uint256[] calldata licenseTermsIds,
    bool isUsingLicenseToken
) external onlyLicensingModule

Registers a derivative IP and its relationship to parent IPs.

Parameters:

  • childIpId: The address of the derivative IP.
  • parentIpIds: An array of addresses of the parent IPs.
  • licenseTemplate: The address of the license template used.
  • licenseTermsIds: An array of IDs of the license terms.
  • isUsingLicenseToken: Whether the derivative IP is registered with license tokens.

initializeLicenseTemplate

function initializeLicenseTemplate(address ipId, address licenseTemplate) external onlyLicensingModule

Sets license template for an IP, if the IP has no license template set.

Parameters:

  • ipId: The address of the IP to which the license template is attached.
  • licenseTemplate: The address of the license template.

verifyMintLicenseToken

function verifyMintLicenseToken(
    address licensorIpId,
    address licenseTemplate,
    uint256 licenseTermsId,
    bool isMintedByIpOwner
) external view returns (Licensing.LicensingConfig memory)

Verifies the minting of a license token.

Parameters:

  • licensorIpId: The address of the licensor IP.
  • licenseTemplate: The address of the license template where the license terms are defined.
  • licenseTermsId: The ID of the license terms will mint the license token.
  • isMintedByIpOwner: Whether the license token is minted by the IP owner.

Returns:

  • Licensing.LicensingConfig: The configuration for minting the license.

verifyGroupAddIp

function verifyGroupAddIp(
    address groupId,
    address groupRewardPool,
    address ipId,
    address groupLicenseTemplate,
    uint256 groupLicenseTermsId
) external view returns (Licensing.LicensingConfig memory ipLicensingConfig)

Verifies the group can add given IP.

Parameters:

  • groupId: The address of the group.
  • groupRewardPool: The address of the reward pool of the group.
  • ipId: The address of the IP to be added to the group.
  • groupLicenseTemplate: The address of the license template attached to the group.
  • groupLicenseTermsId: The ID of the license terms attached to the group.

Returns:

  • ipLicensingConfig: The configuration for license attached to the IP.

isRegisteredLicenseTemplate

function isRegisteredLicenseTemplate(address licenseTemplate) external view returns (bool)

Checks if a license template is registered.

Parameters:

  • licenseTemplate: The address of the license template to check.

Returns:

  • bool: Whether the license template is registered.

isDerivativeIp

function isDerivativeIp(address childIpId) external view returns (bool)

Checks if an IP is a derivative IP.

Parameters:

  • childIpId: The address of the IP to check.

Returns:

  • bool: Whether the IP is a derivative IP.

hasDerivativeIps

function hasDerivativeIps(address parentIpId) external view returns (bool)

Checks if an IP has derivative IPs.

Parameters:

  • parentIpId: The address of the IP to check.

Returns:

  • bool: Whether the IP has derivative IPs.

exists

function exists(address licenseTemplate, uint256 licenseTermsId) external view returns (bool)

Checks if license terms exist.

Parameters:

  • licenseTemplate: The address of the license template where the license terms are defined.
  • licenseTermsId: The ID of the license terms.

Returns:

  • bool: Whether the license terms exist.

hasIpAttachedLicenseTerms

function hasIpAttachedLicenseTerms(
    address ipId,
    address licenseTemplate,
    uint256 licenseTermsId
) external view returns (bool)

Checks if an IP has attached any license terms.

Parameters:

  • ipId: The address of the IP to check.
  • licenseTemplate: The address of the license template where the license terms are defined.
  • licenseTermsId: The ID of the license terms.

Returns:

  • bool: Whether the IP has attached any license terms.

getAttachedLicenseTerms

function getAttachedLicenseTerms(
    address ipId,
    uint256 index
) external view returns (address licenseTemplate, uint256 licenseTermsId)

Gets the attached license terms of an IP by its index.

Parameters:

  • ipId: The address of the IP.
  • index: The index of the attached license terms within the array of all attached license terms of the IP.

Returns:

  • licenseTemplate: The address of the license template where the license terms are defined.
  • licenseTermsId: The ID of the license terms.

getAttachedLicenseTermsCount

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

Gets the count of attached license terms of an IP.

Parameters:

  • ipId: The address of the IP.

Returns:

  • uint256: The count of attached license terms.

getDerivativeIp

function getDerivativeIp(address parentIpId, uint256 index) external view returns (address childIpId)

Gets the derivative IP of an IP by its index.

Parameters:

  • parentIpId: The address of the IP.
  • index: The index of the derivative IP within the array of all derivative IPs of the IP.

Returns:

  • childIpId: The address of the derivative IP.

getDerivativeIpCount

function getDerivativeIpCount(address parentIpId) external view returns (uint256)

Gets the count of derivative IPs of an IP.

Parameters:

  • parentIpId: The address of the IP.

Returns:

  • uint256: The count of derivative IPs.

getParentIp

function getParentIp(address childIpId, uint256 index) external view returns (address parentIpId)

Gets the parent IP of an IP by its index.

Parameters:

  • childIpId: The address of the IP.
  • index: The index of the parent IP within the array of all parent IPs of the IP.

Returns:

  • parentIpId: The address of the parent IP.

isParentIp

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

Checks if an IP is a parent of another IP.

Parameters:

  • parentIpId: The address of the potential parent IP.
  • childIpId: The address of the potential child IP.

Returns:

  • bool: Whether the IP is a parent of the other IP.

getParentIpCount

function getParentIpCount(address childIpId) external view returns (uint256)

Gets the count of parent IPs.

Parameters:

  • childIpId: The address of the child IP.

Returns:

  • uint256: The count of parent IPs.

getAncestorsCount

function getAncestorsCount(address ipId) external returns (uint256)

Gets the count of ancestors IPs.

Parameters:

  • ipId: The ID of IP asset.

Returns:

  • uint256: The count of ancestor IPs.

getLicensingConfig

function getLicensingConfig(
    address ipId,
    address licenseTemplate,
    uint256 licenseTermsId
) external view returns (Licensing.LicensingConfig memory)

Retrieves the minting license configuration for a given license terms of the IP.

Parameters:

  • ipId: The address of the IP.
  • licenseTemplate: The address of the license template where the license terms are defined.
  • licenseTermsId: The ID of the license terms.

Returns:

  • Licensing.LicensingConfig: The configuration for minting the license.

getExpireTime

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

Gets the expiration time for an IP.

Parameters:

  • ipId: The address of the IP.

Returns:

  • uint256: The expiration time, 0 means never expired.

isExpiredNow

function isExpiredNow(address ipId) external view returns (bool)

Checks if an IP is expired.

Parameters:

  • ipId: The address of the IP.

Returns:

  • bool: Whether the IP is expired.

getDefaultLicenseTerms

function getDefaultLicenseTerms() external view returns (address licenseTemplate, uint256 licenseTermsId)

Returns the default license terms.

Returns:

  • licenseTemplate: The address of the default license template.
  • licenseTermsId: The ID of the default license terms.

isDefaultLicense

function isDefaultLicense(address licenseTemplate, uint256 licenseTermsId) external view returns (bool)

Checks if the license terms are the default license terms.

Parameters:

  • licenseTemplate: The address of the license template.
  • licenseTermsId: The ID of the license terms.

Returns:

  • bool: Whether the license terms are the default license terms.

getParentLicenseTerms

function getParentLicenseTerms(
    address childIpId,
    address parentIpId
) external view returns (address licenseTemplate, uint256 licenseTermsId)

Returns the license terms through which a child IP links to a parent IP.

Parameters:

  • childIpId: The address of the child IP.
  • parentIpId: The address of the parent IP.

Returns:

  • licenseTemplate: The address of the license template.
  • licenseTermsId: The ID of the license terms.

getRoyaltyPercent

function getRoyaltyPercent(
    address ipId,
    address licenseTemplate,
    uint256 licenseTermsId
) external view returns (uint32 royaltyPercent)

Return the Royalty percentage of the license terms of the IP.

Parameters:

  • ipId: The address of the IP.
  • licenseTemplate: The address of the license template where the license terms are defined.
  • licenseTermsId: The ID of the license terms.

Returns:

  • royaltyPercent: The Royalty percentage 100% is 100_000_000.