Add custom logic before minting license tokens or registering derivatives.
ILicensingHook
interface, which extends from IModule
.
Most importantly, a Licensing Hook implements a beforeMintLicenseTokens
function, which is a function that is called before a License Token is minted to implement custom logic and determine the final totalMintingFee
of that License Token.
ILicensingHook
smart contract
here.totalMintingFee
. You may be wondering, “I can set the minting fee in the License Terms, in the LicenseConfig
, and return a dynamic price from beforeMintLicenseTokens
. What will the final minting fee actually be?” Here is the priority:
Minting Fee | Importance |
---|---|
The totalMintingFee returned from beforeMintLicenseTokens | Highest Priority |
The mintingFee set in the LicenseConfig | ⬇️ |
The mintingFee set in the License Terms | Lowest Priority |
Hook | Description | Contract Code |
---|---|---|
LockLicenseHook | Stop the minting of license tokens or registering new derivatives. | View here ↗️ |
TotalLicenseTokenLimitHook | Set a limit on the amount of license tokens that can be minted, updatable at any time. | View here ↗️ |
ILicensingHook
interface. You can view the interface here. We have a few Licensing Hooks deployed already (view the chart above).
In order to actually use a Licensing Hook, you must set it in the Licensing Config, which is basically a set of configurations that you set on License Terms when attaching terms to an IP Asset.
Create Licensing Config
Set the Licensing Config
mintAndRegisterIpAssetWithPilTerms
method found here.Set the Limit to 1
setTotalLicenseTokenLimit
function on the hook and set the max # of licenses that can be minted to 1.writeContract
method.