Skip to main content
Hooks allow developers to create custom implementations, restrictions, and functionality upon minting License Tokens or registering derivatives. There are two types of hooks:
  1. 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.
  2. 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 the 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.
View the ILicensingHook smart contract here.
ILicensingHook.sol
Note that it returns the 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:
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 DATA Foundation team.

Available Hooks

Below are available hooks deployed on our protocol that you can use.
View the deployed addresses for these hooks 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.
Licensing Hooks are ultimately a smart contract that implements the 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 registerIpAsset 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 the DATA Foundation’s protocol.
  1. 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.
  2. Fork Registered Modules Repository: Fork the registered-modules repository to your own GitHub account.
  3. Update the Module List: In your registered-modules repository, add your hook’s details to the hook-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:
    Replace YourModuleName, YourModuleAddress, and YourModuleBlockExplorerLink with your hook’s name, its address, and the link to its block explorer page, respectively. Example:
  4. 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):
  5. 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 DATA Foundation community.
We look forward to seeing your contributions and expanding the DATA Foundation module ecosystem!

Commercializer Checker Hooks

Documentation coming soon. If you have questions in the meantime, ask in the Builder’s Discord.