Mint a License Token
Learn how to mint a License Token from an IPA in Solidity.
Completed Code
Follow the completed code all the way through.
This section demonstrates how to mint a License Token from an IP Asset. You can only mint a License Token from an IP Asset if the IP Asset has License Terms attached to it. A License Token is minted as an ERC-721.
There are two reasons you’d mint a License Token:
- To hold the license and be able to use the underlying IP Asset as the license described (for ex. “Can use commercially as long as you provide proper attribution and share 5% of your revenue)
- Use the license token to link another IP Asset as a derivative of it. Note though that, as you’ll see later, some SDK functions don’t require you to explicitly mint a license token first in order to register a derivative, and will actually handle it for you behind the scenes.
Prerequisites
There are a few steps you have to complete before you can start the tutorial.
- Complete the Setup Your Own Project
- An IP Asset has License Terms attached to it. You can learn how to do that here
Mint License
Let’s say that IP Asset (ipId = 0x01
) has License Terms (licenseTermdId = 10
) attached to it. We want to mint 2 License Tokens with those terms to a specific wallet address (0x02
).
Paid Licenses
Be mindful that some IP Assets may have license terms attached that require the user minting the license to pay a mintingFee
.
Let’s create a test file under test/3_LicenseToken.t.sol
to see it work and verify the results:
Contract Addresses
We have filled in the addresses from the Story contracts for you. However you can also find the addresses for them here: Deployed Smart Contracts
Test Your Code!
Run forge build
. If everything is successful, the command should successfully compile.
Now run the test by executing the following command:
Register a Derivative
Completed Code
Follow the completed code all the way through.
Now that we have minted a License Token, we can hold it or use it to link an IP Asset as a derivative. We will go over that on the next page.