- Licensing Hooks: allow you to add custom logic before minting license tokens (and registering derivatives). For example, requesting a dynamic price, limiting the amount of license tokens that can be minted, whitelists, etc. Licensing Hooks can be added / modified on a licensing config at any point.
- Commercializer Checker Hooks: similar to Licensing Hooks, however they are directly a part of the license terms and do not change. You also cannot return a custom minting fee.
Licensing Hooks
These are contracts that implement theILicensingHook
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.
View the
ILicensingHook
smart contract
here.ILicensingHook.sol
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 |
Beware of potentially malicious implementations of external license hooks.
Please first verify the code of the hook you choose because it may be not
reviewed or audited by the Story team.
Available Hooks
Below are available hooks deployed on our protocol that you can use.View the deployed addresses for these hooks here.
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 ↗️ |
Implementing the Hooks
SDK Code Example
A working TypeScript SDK code example that shows how to implement a licensing
hook. More specifically, how to limit the # of licenses that can be minted.
Solidity Code Example
A working Solidity code example that shows how to implement a licensing hook.
More specifically, how to limit the # of licenses that can be minted.
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.
1
Create Licensing Config
First you have to create a Licensing Config:
2
Set the Licensing Config
Next, we’ll set the Licensing Config on the License Terms. In the following example, we’ll show this happening upon registering the IP Asset:
This code snippet requires a bit of setup, and it meant for developers who
already understand how to setup the TypeScript SDK. If you want to learn more,
check out the working code
example.
This uses the
mintAndRegisterIpAssetWithPilTerms
method found here.3
Set the Limit to 1
Now that we have set the Licensing Config on our terms, we can call the
setTotalLicenseTokenLimit
function on the hook and set the max # of licenses that can be minted to 1.Creating a New Licensing Hook
Please follow the below process for creating a new licensing hook and getting it whitelisted into Story’s protocol.-
Develop your Hook: You may fork this template repository to bootstrap your development. It includes an example hook with tests against our Aeneid protocol, but using it is optional.
See license-caller-whitelist-hook as an example that was used to develop the
LicenseCallerWhitelistHook.sol
hook. - Fork Registered Modules Repository: Fork the registered-modules repository to your own GitHub account.
-
Update the Module List: In your
registered-modules
repository, add your hook’s details to thehook-modules.json
file. Make sure to deploy & verify on block explorer your hook on both aeneid and mainnet. Ensure that you adhere to the following JSON structure:ReplaceYourModuleName
,YourModuleAddress
, andYourModuleBlockExplorerLink
with your hook’s name, its address, and the link to its block explorer page, respectively. Example: -
Create a Pull Request (PR): Once you have added your hook, create a pull request against this repository. In your PR’s description, add the following information (replace the values with your own):
- Await Verification: After your PR is submitted, it will be reviewed. Once a security audit has been performed and completed, and the module whitelisted into the protocol, the PR will be merged. At this point your module will be officially registered and recognized as safe for use within the Story community.
Commercializer Checker Hooks
Documentation coming soon. If you have questions in the meantime, ask in the Builder’s Discord.