Register License Terms
Learn how to create new License Terms in Solidity.
Completed Code
Follow the completed code all the way through.
License Terms are a configurable set of values that define restrictions on licenses minted from your IP that have those terms. For example, “If you mint this license, you must share 50% of your revenue with me.” You can view the full set of terms in PIL Terms.
Prerequisites
There are a few steps you have to complete before you can start the tutorial.
- Complete the Setup Your Own Project
Before We Start
It’s important to know that if License Terms already exist for the identical set of parameters you intend to create, it is unnecessary to create it again. License Terms are protocol-wide, so you can use existing License Terms by its licenseTermsId
.
Register License Terms
You can view the full set of terms in PIL Terms.
Let’s create a test file under test/1_LicenseTerms.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
PIL Flavors
As you see above, you have to choose between a lot of terms.
We have convenience functions to help you register new terms. We have created PIL Flavors, which are pre-configured popular combinations of License Terms to help you decide what terms to use. You can view those PIL Flavors and then register terms using the following convenience functions:
Non-Commercial Social Remixing
Free remixing with attribution. No commercialization.
Commercial Use
Pay to use the license with attribution, but don’t have to share revenue.
Commercial Remix
Pay to use the license with attribution and pay % of revenue earned.
Creative Commons Attribution
Free remixing and commercial use with attribution.
For example:
Test Your Code!
Run forge build
. If everything is successful, the command should successfully compile.
Now run the test by executing the following command:
Attach Terms to Your IP
Congratulations, you created new license terms!
Completed Code
Follow the completed code all the way through.
Now that you have registered new license terms, we can attach them to an IP Asset. This will allow others to mint a license and use your IP, restricted by the terms.
We will go over this on the next page.