IIPAsset

Git Source

Title: IIPAsset

Interface for IP Asset NFT contract representing intellectual property ownership

ERC-721 upgradeable contract with metadata versioning and license management

Functions

initialize

Initializes the IPAsset contract (proxy pattern)

Sets up ERC721, AccessControl, Pausable, and UUPS upgradeable patterns

function initialize(
    string memory name,
    string memory symbol,
    address admin,
    address licenseToken,
    address arbitrator
) external;

Parameters

NameTypeDescription
namestringThe name for the ERC721 token
symbolstringThe symbol for the ERC721 token
adminaddressAddress to receive all initial admin roles (DEFAULT_ADMIN, PAUSER, UPGRADER)
licenseTokenaddressAddress of the LicenseToken contract
arbitratoraddressAddress of the GovernanceArbitrator contract

mintIP

Mints a new IP asset NFT

Creates a token with auto-incrementing ID and stores initial metadata

function mintIP(address to, string memory metadataURI) external returns (uint256 tokenId);

Parameters

NameTypeDescription
toaddressAddress to receive the newly minted IP asset
metadataURIstringIPFS or HTTP URI pointing to IP metadata

Returns

NameTypeDescription
tokenIduint256The ID of the newly minted token

mintLicense

Creates a new license for an IP asset

Delegates to LicenseToken contract to mint the license. Only the IP asset owner can mint licenses. Emits LicenseRegistered event for off-chain tracking.

function mintLicense(
    uint256 ipTokenId,
    address licensee,
    uint256 supply,
    string memory publicMetadataURI,
    string memory privateMetadataURI,
    uint256 expiryTime,
    string memory terms,
    bool isExclusive,
    uint256 paymentInterval
) external returns (uint256 licenseId);

Parameters

NameTypeDescription
ipTokenIduint256The IP asset to create a license for
licenseeaddressAddress to receive the license
supplyuint256Number of license tokens to mint (ERC-1155 supply)
publicMetadataURIstringPublicly visible license metadata URI
privateMetadataURIstringPrivate license terms URI (access controlled)
expiryTimeuint256Unix timestamp when license expires
termsstringHuman-readable license terms
isExclusiveboolWhether this is an exclusive license
paymentIntervaluint256Payment interval in seconds (0 = one-time, >0 = recurring)

Returns

NameTypeDescription
licenseIduint256The ID of the newly created license

updateMetadata

Updates the metadata URI for an IP asset

Only the token owner can update. Creates a new version in history.

function updateMetadata(uint256 tokenId, string memory newURI) external;

Parameters

NameTypeDescription
tokenIduint256The IP asset token ID
newURIstringThe new metadata URI

configureRevenueSplit

Configures revenue split for an IP asset

Only the token owner can configure. Delegates to RevenueDistributor.

function configureRevenueSplit(uint256 tokenId, address[] memory recipients, uint256[] memory shares) external;

Parameters

NameTypeDescription
tokenIduint256The IP asset token ID
recipientsaddress[]Array of addresses to receive revenue shares
sharesuint256[]Array of share amounts in basis points (must sum to 10000)

setRoyaltyRate

Sets the royalty rate for an IP asset

Only the token owner can set. Delegates to RevenueDistributor.

function setRoyaltyRate(uint256 tokenId, uint256 basisPoints) external;

Parameters

NameTypeDescription
tokenIduint256The IP asset token ID
basisPointsuint256Royalty rate in basis points (e.g., 1000 = 10%)

burn

Burns an IP asset NFT

Only owner can burn. Blocked if active licenses exist or dispute is active.

function burn(uint256 tokenId) external;

Parameters

NameTypeDescription
tokenIduint256The IP asset token ID to burn

setDisputeStatus

Sets the dispute status for an IP asset

Only callable by ARBITRATOR_ROLE (GovernanceArbitrator contract)

function setDisputeStatus(uint256 tokenId, bool hasDispute) external;

Parameters

NameTypeDescription
tokenIduint256The IP asset token ID
hasDisputeboolWhether there is an active dispute

setLicenseTokenContract

Updates the LicenseToken contract address

Only callable by admin

function setLicenseTokenContract(address licenseToken) external;

Parameters

NameTypeDescription
licenseTokenaddressNew LicenseToken contract address

setArbitratorContract

Updates the GovernanceArbitrator contract address

Only callable by admin

function setArbitratorContract(address arbitrator) external;

Parameters

NameTypeDescription
arbitratoraddressNew GovernanceArbitrator contract address

setRevenueDistributorContract

Updates the RevenueDistributor contract address

Only callable by admin

function setRevenueDistributorContract(address distributor) external;

Parameters

NameTypeDescription
distributoraddressNew RevenueDistributor contract address

updateActiveLicenseCount

Updates the active license count for an IP asset

Only callable by LICENSE_MANAGER_ROLE (LicenseToken contract)

function updateActiveLicenseCount(uint256 tokenId, int256 delta) external;

Parameters

NameTypeDescription
tokenIduint256The IP asset token ID
deltaint256Change in license count (positive or negative)

hasActiveDispute

Checks if an IP asset has an active dispute

function hasActiveDispute(uint256 tokenId) external view returns (bool hasDispute);

Parameters

NameTypeDescription
tokenIduint256The IP asset token ID

Returns

NameTypeDescription
hasDisputeboolWhether there is an active dispute

pause

Pauses all state-changing operations

Only callable by DEFAULT_ADMIN_ROLE

function pause() external;

unpause

Unpauses all state-changing operations

Only callable by DEFAULT_ADMIN_ROLE

function unpause() external;

setPrivateMetadata

Sets private metadata for an IP asset

Only the IP asset owner can set private metadata

function setPrivateMetadata(uint256 tokenId, string memory metadata) external;

Parameters

NameTypeDescription
tokenIduint256The ID of the IP asset
metadatastringThe private metadata URI (IPFS, HTTP, etc.)

getPrivateMetadata

Gets private metadata for an IP asset

Only the IP asset owner can read private metadata

function getPrivateMetadata(uint256 tokenId) external view returns (string memory);

Parameters

NameTypeDescription
tokenIduint256The ID of the IP asset

Returns

NameTypeDescription
<none>stringmetadata The private metadata URI

wrapNFT

Wraps an external NFT into an IPAsset

Transfers the NFT to this contract and mints a new IPAsset token representing it. Only the NFT owner can wrap it. One NFT can only be wrapped once. Use setPrivateMetadata() after wrapping to add private metadata if needed.

function wrapNFT(address nftContract, uint256 nftTokenId, string memory metadataURI)
    external
    returns (uint256 ipTokenId);

Parameters

NameTypeDescription
nftContractaddressThe address of the ERC721 contract
nftTokenIduint256The token ID of the NFT to wrap
metadataURIstringThe metadata URI for the new IPAsset

Returns

NameTypeDescription
ipTokenIduint256The ID of the newly minted IPAsset token

unwrapNFT

Unwraps an IPAsset to retrieve the original NFT

Burns the IPAsset token and returns the original NFT to the caller. Only the IPAsset owner can unwrap. Cannot unwrap if active licenses or disputes exist.

function unwrapNFT(uint256 tokenId) external;

Parameters

NameTypeDescription
tokenIduint256The IPAsset token ID to unwrap

isWrapped

Checks if an IPAsset is wrapping an external NFT

function isWrapped(uint256 tokenId) external view returns (bool);

Parameters

NameTypeDescription
tokenIduint256The IPAsset token ID

Returns

NameTypeDescription
<none>boolTrue if the IPAsset wraps an NFT, false if it's a native IPAsset

getWrappedNFT

Gets the wrapped NFT details for an IPAsset

function getWrappedNFT(uint256 tokenId) external view returns (address nftContract, uint256 nftTokenId);

Parameters

NameTypeDescription
tokenIduint256The IPAsset token ID

Returns

NameTypeDescription
nftContractaddressThe wrapped NFT contract address (zero address if not wrapped)
nftTokenIduint256The wrapped NFT token ID (zero if not wrapped)

Events

IPMinted

Emitted when a new IP asset is minted

event IPMinted(uint256 indexed tokenId, address indexed owner, string metadataURI);

Parameters

NameTypeDescription
tokenIduint256The ID of the newly minted token
owneraddressThe address that owns the new IP asset
metadataURIstringThe URI pointing to the IP metadata

MetadataUpdated

Emitted when IP metadata is updated

Includes old and new URIs for complete off-chain indexing without state tracking

event MetadataUpdated(uint256 indexed tokenId, string oldURI, string newURI, uint256 timestamp);

Parameters

NameTypeDescription
tokenIduint256The ID of the token being updated
oldURIstringThe previous metadata URI
newURIstringThe new metadata URI
timestampuint256The block timestamp when update occurred

LicenseMinted

Emitted when a license is minted for an IP asset

event LicenseMinted(uint256 indexed ipTokenId, uint256 indexed licenseId);

Parameters

NameTypeDescription
ipTokenIduint256The IP asset token ID
licenseIduint256The newly created license ID

LicenseRegistered

Emitted when a license is registered for an IP asset

This event provides complete license context for off-chain indexing without requiring array storage. Indexers can build complete license lists by filtering this event by ipTokenId. This replaces the need for on-chain ipToLicenses[] array storage (gas optimization).

event LicenseRegistered(
    uint256 indexed ipTokenId, uint256 indexed licenseId, address indexed licensee, uint256 supply, bool isExclusive
);

Parameters

NameTypeDescription
ipTokenIduint256The IP asset token ID this license is for
licenseIduint256The ID of the newly registered license
licenseeaddressThe address receiving the license
supplyuint256Number of license tokens minted (ERC-1155 supply)
isExclusiveboolWhether this is an exclusive license

RevenueSplitConfigured

Emitted when revenue split is configured for an IP asset

event RevenueSplitConfigured(uint256 indexed tokenId, address[] recipients, uint256[] shares);

Parameters

NameTypeDescription
tokenIduint256The IP asset token ID
recipientsaddress[]Array of recipient addresses
sharesuint256[]Array of share percentages (must sum to 10000 basis points)

RoyaltyRateSet

Emitted when royalty rate is set for an IP asset

event RoyaltyRateSet(uint256 indexed tokenId, uint256 basisPoints);

Parameters

NameTypeDescription
tokenIduint256The IP asset token ID
basisPointsuint256Royalty rate in basis points (e.g., 1000 = 10%)

DisputeStatusChanged

Emitted when an IP asset's dispute status changes

event DisputeStatusChanged(uint256 indexed tokenId, bool hasDispute);

Parameters

NameTypeDescription
tokenIduint256The IP asset token ID
hasDisputeboolWhether the asset now has an active dispute

LicenseTokenContractSet

Emitted when the LicenseToken contract address is updated

event LicenseTokenContractSet(address indexed newContract);

Parameters

NameTypeDescription
newContractaddressThe new LicenseToken contract address

ArbitratorContractSet

Emitted when the GovernanceArbitrator contract address is updated

event ArbitratorContractSet(address indexed newContract);

Parameters

NameTypeDescription
newContractaddressThe new GovernanceArbitrator contract address

RevenueDistributorSet

Emitted when the RevenueDistributor contract address is updated

event RevenueDistributorSet(address indexed newContract);

Parameters

NameTypeDescription
newContractaddressThe new RevenueDistributor contract address

PrivateMetadataUpdated

Emitted when private metadata is updated for an IP asset

The metadata content is not included in the event for privacy

event PrivateMetadataUpdated(uint256 indexed tokenId);

Parameters

NameTypeDescription
tokenIduint256The ID of the IP asset

NFTWrapped

Emitted when an NFT is wrapped into an IPAsset

event NFTWrapped(
    uint256 indexed ipTokenId, address indexed nftContract, uint256 indexed nftTokenId, address wrapper
);

Parameters

NameTypeDescription
ipTokenIduint256The newly created IPAsset ID
nftContractaddressThe wrapped NFT contract address
nftTokenIduint256The wrapped NFT token ID
wrapperaddressThe address that wrapped the NFT

NFTUnwrapped

Emitted when an IPAsset is unwrapped to retrieve the original NFT

event NFTUnwrapped(
    uint256 indexed ipTokenId, address indexed nftContract, uint256 indexed nftTokenId, address owner
);

Parameters

NameTypeDescription
ipTokenIduint256The burned IPAsset ID
nftContractaddressThe returned NFT contract address
nftTokenIduint256The returned NFT token ID
owneraddressThe address that received the NFT

Errors

InvalidAddress

Thrown when attempting to mint to zero address

error InvalidAddress();

InvalidContractAddress

Thrown when setting a contract address to zero address

error InvalidContractAddress(address contractAddress);

Parameters

NameTypeDescription
contractAddressaddressThe invalid address that was attempted

EmptyMetadata

Thrown when metadata URI is empty

error EmptyMetadata();

NotTokenOwner

Thrown when caller is not the token owner

error NotTokenOwner();

HasActiveLicenses

Thrown when attempting to burn a token with active licenses

error HasActiveLicenses(uint256 tokenId, uint256 count);

Parameters

NameTypeDescription
tokenIduint256The IP asset token ID
countuint256Number of active licenses preventing the burn

HasActiveDispute

Thrown when attempting to burn a token with an active dispute

error HasActiveDispute(uint256 tokenId);

Parameters

NameTypeDescription
tokenIduint256The IP asset token ID

LicenseCountUnderflow

Thrown when attempting to decrement license count below zero

error LicenseCountUnderflow(uint256 tokenId, uint256 current, uint256 attempted);

Parameters

NameTypeDescription
tokenIduint256The IP asset token ID
currentuint256Current license count
attempteduint256Amount attempting to decrement

NotWrappedNFT

Thrown when attempting to unwrap a non-wrapped IPAsset

error NotWrappedNFT();

NFTAlreadyWrapped

Thrown when attempting to wrap an NFT that's already wrapped

error NFTAlreadyWrapped(uint256 existingIPAssetId);

Parameters

NameTypeDescription
existingIPAssetIduint256The IPAsset that already wraps this NFT

NFTNotOwned

Thrown when caller doesn't own the NFT being wrapped

error NFTNotOwned(address nftContract, uint256 nftTokenId, address caller);

Parameters

NameTypeDescription
nftContractaddressThe NFT contract address
nftTokenIduint256The NFT token ID
calleraddressThe address attempting to wrap

Structs

WrappedNFT

Represents a wrapped NFT within an IPAsset

struct WrappedNFT {
    address nftContract;
    uint256 nftTokenId;
}

Properties

NameTypeDescription
nftContractaddressThe address of the wrapped ERC721 contract
nftTokenIduint256The token ID of the wrapped NFT