Use this file to discover all available pages before exploring further.
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.
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.
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 AddressesWe 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/1_LicenseTerms.t.sol
// SPDX-License-Identifier: UNLICENSEDpragma solidity ^0.8.26;import { Test } from "forge-std/Test.sol";import { IPILicenseTemplate } from "@storyprotocol/core/interfaces/modules/licensing/IPILicenseTemplate.sol";import { PILTerms } from "@storyprotocol/core/interfaces/modules/licensing/IPILicenseTemplate.sol";// Run this test:// forge test --fork-url https://aeneid.storyrpc.io/ --match-path test/1_LicenseTerms.t.solcontract LicenseTermsTest is Test { address internal alice = address(0xa11ce); // For addresses, see https://docs.story.foundation/developers/deployed-smart-contracts // Protocol Core - PILicenseTemplate IPILicenseTemplate internal PIL_TEMPLATE = IPILicenseTemplate(0x2E896b0b2Fdb7457499B56AAaA4AE55BCB4Cd316); // Protocol Core - RoyaltyPolicyLAP address internal ROYALTY_POLICY_LAP = 0xBe54FB168b3c982b7AaE60dB6CF75Bd8447b390E; // Revenue Token - MERC20 address internal MERC20 = 0xF2104833d386a2734a4eB3B8ad6FC6812F29E38E; function setUp() public {} /// @notice Registers new PIL Terms. Anyone can register PIL Terms. function test_registerPILTerms() public { PILTerms memory pilTerms = PILTerms({ transferable: true, royaltyPolicy: ROYALTY_POLICY_LAP, defaultMintingFee: 0, expiration: 0, commercialUse: true, commercialAttribution: true, commercializerChecker: address(0), commercializerCheckerData: "", commercialRevShare: 0, commercialRevCeiling: 0, derivativesAllowed: true, derivativesAttribution: true, derivativesApproval: true, derivativesReciprocal: true, derivativeRevCeiling: 0, currency: MERC20, uri: "" }); uint256 licenseTermsId = PIL_TEMPLATE.registerLicenseTerms(pilTerms); uint256 selectedLicenseTermsId = PIL_TEMPLATE.getLicenseTermsId(pilTerms); assertEq(licenseTermsId, selectedLicenseTermsId); }}
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.
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.