IPAsset

Methods

  • register
  • register_derivative
  • register_derivative_with_license_tokens
  • mint_and_register_ip_asset_with_pil_terms

Because there are a lot of functions to interact with the 📜 Licensing Module, we have broken them down into a helpful chart so you can identify what you’re looking for, and then find the associated docs.

FunctionMint an NFTRegister IPACreate License TermsAttach License TermsMint License TokenRegister as Derivative
register
mint_and_register_ip_asset_with_pil_terms
register_derivative
register_derivative_with_license_tokens
register_pil_terms
attach_license_terms
mint_license_tokens

register

Registers an NFT as IP, creating a corresponding 🧩 IP Asset. If the given NFT was already registered, this function will return the existing ipId.

Note that this function will also set the underlying NFT’s tokenUri to whatever is passed under ipMetadata.nftMetadataURI.

Method
register

Parameters:

  • nft_contract: The address of the NFT.
  • token_id: The token identifier of the NFT.
  • ip_metadata: [Optional] The desired metadata for the newly minted NFT and newly registered IP.
    • ip_metadata['ip_metadata_uri']: [Optional] The URI of the metadata for the IP.
    • ip_metadata['ip_metadata_hash']: [Optional] The hash of the metadata for the IP.
    • ip_metadata['nft_metadata_uri']: [Optional] The URI of the metadata for the NFT.
    • ip_metadata['nft_metadata_hash']: [Optional] The hash of the metadata for the IP NFT.
  • deadline: [Optional] The deadline for the signature in milliseconds.
  • tx_options: [Optional] Transaction options dictionary.
metadata = {
  'ip_metadata_uri': "test-uri",
  'ip_metadata_hash': web3.to_hex(web3.keccak(text="test-ip-metadata-hash")),
  'nft_metadata_uri': "test-uri",
  'nft_metadata_hash': web3.to_hex(web3.keccak(text="test-nft-metadata-hash"))
}

response = story_client.IPAsset.register(
  nft_contract="0x041B4F29183317Fd352AE57e331154b73F8a1D73",
  token_id="12",
  ip_metadata=metadata
)

register_derivative

Registers a derivative directly with parent IP’s license terms, without needing license tokens, and attaches the license terms of the parent IPs to the derivative IP.

The license terms must be attached to the parent IP before calling this function.

All IPs attached default license terms by default.

The derivative IP owner must be the caller or an authorized operator.

Method
register_derivative

Parameters:

  • child_ip_id: The derivative IP ID.
  • parent_ip_ids: The parent IP IDs.
  • license_terms_ids: The IDs of the license terms that the parent IP supports.
  • max_minting_fee: [Optional] The maximum minting fee that the caller is willing to pay. If set to 0, then there is no limit. Default: 0
  • max_revenue_share: [Optional] The maximum revenue share percentage agreed upon between a child and parent when a child is registering as derivative. Must be between 0 and 100. Default: 100
  • max_rts: [Optional] The maximum number of royalty tokens that can be distributed to the external royalty policies. Must be between 0 and 100,000,000. Default: 100_000_000
  • tx_options: [Optional] Transaction options dictionary.
response = story_client.IPAsset.register_derivative(
  child_ip_id="0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
  parent_ip_ids=["0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba"],
  license_terms_ids=["5"],
  max_minting_fee=0, # disabled
  max_rts=100_000_000, # default
  max_revenue_share=100 # default
)

register_derivative_with_license_tokens

Registers a derivative with license tokens.

The derivative IP is registered with license tokens minted from the parent IP’s license terms.

The license terms of the parent IPs issued with license tokens are attached to the derivative IP.

The caller must be the derivative IP owner or an authorized operator.

Method
register_derivative_with_license_tokens

Parameters:

  • child_ip_id: The derivative IP ID.
  • license_token_ids: The IDs of the license tokens.
  • max_rts: The maximum number of royalty tokens that can be distributed to the external royalty policies. Must be between 0 and 100,000,000. Recommended for simplicity: 100_000_000
  • tx_options: [Optional] Transaction options dictionary.
response = story_client.IPAsset.register_derivative_with_license_tokens(
  child_ip_id="0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
  license_token_ids=["5"],
  max_rts=100_000_000 # default
)

mint_and_register_ip_asset_with_pil_terms

Mint an NFT from a collection, register it as an IP, attach metadata to the IP, and attach License Terms to the IP all in one function.

Note that this function will also set the underlying NFT’s tokenUri to whatever is passed under ipMetadata.nftMetadataURI.

Method
mint_and_register_ip_asset_with_pil_terms

Parameters:

  • spg_nft_contract: The address of the NFT collection.
  • terms: The array of license terms to be attached. ⚠️ This function will fail if you pass in an empty array.
    • terms[].terms: The license terms data. See the Python example below for the structure.
    • terms[].licensing_config: [Optional] The licensing configuration. See the Python example below for the structure.
  • allow_duplicates: [Optional] Set to true to allow minting IPs with the same NFT metadata. Default: True
  • ip_metadata: [Optional] The desired metadata for the newly minted NFT and newly registered IP.
    • ip_metadata['ip_metadata_uri']: [Optional] The URI of the metadata for the IP.
    • ip_metadata['ip_metadata_hash']: [Optional] The hash of the metadata for the IP.
    • ip_metadata['nft_metadata_uri']: [Optional] The URI of the metadata for the NFT.
    • ip_metadata['nft_metadata_hash']: [Optional] The hash of the metadata for the IP NFT.
  • recipient: [Optional] The address of the recipient of the minted NFT.
  • tx_options: [Optional] Transaction options dictionary.
commercial_remix_terms = {
  "transferable": True,
  "royalty_policy": "0xBe54FB168b3c982b7AaE60dB6CF75Bd8447b390E", # RoyaltyPolicyLAP address from https://docs.story.foundation/docs/deployed-smart-contracts
  "default_minting_fee": 0,
  "expiration": 0,
  "commercial_use": True,
  "commercial_attribution": True,
  "commercializer_checker": "0x0000000000000000000000000000000000000000",
  "commercializer_checker_data": "0x0000000000000000000000000000000000000000",
  "commercial_rev_share": 50,
  "commercial_rev_ceiling": 0,
  "derivatives_allowed": True,
  "derivatives_attribution": True,
  "derivatives_approval": False,
  "derivatives_reciprocal": True,
  "derivative_rev_ceiling": 0,
  "currency": "0x1514000000000000000000000000000000000000", # $WIP address from https://docs.story.foundation/docs/deployed-smart-contracts
  "uri": "",
}

licensing_config = {
  "is_set": False,
  "minting_fee": 0,
  "licensing_hook": "0x0000000000000000000000000000000000000000",
  "hook_data": "0x0000000000000000000000000000000000000000",
  "commercial_rev_share": 0,
  "disabled": False,
  "expect_minimum_group_reward_share": 0,
  "expect_group_reward_pool": "0x0000000000000000000000000000000000000000",
}

metadata = {
  'ip_metadata_uri': "test-uri",
  'ip_metadata_hash': web3.to_hex(web3.keccak(text="test-ip-metadata-hash")),
  'nft_metadata_uri': "test-uri",
  'nft_metadata_hash': web3.to_hex(web3.keccak(text="test-nft-metadata-hash"))
}

response = story_client.IPAsset.mint_and_register_ip_asset_with_pil_terms(
  spg_nft_contract="0xfE265a91dBe911db06999019228a678b86C04959",
  terms=[{
    "terms": commercial_remix_terms,
    "licensing_config": licensing_config
  }],
  allow_duplicates=True,
  ip_metadata=metadata
)