Adding a Policy to an IP Asset

Policies represent permissions and licensing configurations around how an IPA may be licensed. For example, Alice may want to register their digital art as an IPA, and create a policy that stipulates that any derivatives must not impose any royalties.

By creating such a policy, Alice's IPA becomes eligible for licensing creation. Users who then wish to creative derivatives of Alice's IP may then mint licenses, which can be burned to enroll their IPs as derivative IPAs of Alice's original artwork. For a tutorial on how to create licenses, please see the Create an IPA license section.

Adding a policy to an IPA is a two-step process. First, a user must register a policy into the protocol, and then that policy must be added to an existing IPA.

Now, let's see how we can do this programmatically. In this example, we will be using the standard Story Protocol PIL Policy. For more information, please see the Programmable IP License (PIL💊) section.

import { ILicensingModule } from "@story-protocol/core/interfaces/licensing/LicensingModule.sol";
import { StoryProtocolGateway } from "@story-protocol/periphery/StoryProtocolGateway.sol";
import { PILPolicy } from "@story-protocol/core/modules/licensing/PILPolicyFrameworkManager.sol";

contract ExampleIPAPolicyCreation {
  StoryProtocolGateway public SPG;
  address public ROYALTY_POLICY;
  uint256 public MINTING_FEE;
  address public MINTING_FEE_TOKEN;
  constructor(address royaltyPolicy, uint256 mintingFee, address mintingFeeToken, address spg) {
    ROYALTY_POLICY = royaltyPolicy;
    MINTING_FEE = mintingFee;
    MINTING_FEE_TOKEN = mintingFeeToken;
    SPG = StoryProtocolGateway(spg);
  function registerPolicy(
  		PILPolicy memory pilPolicy
	) {
     spg.createPolicyPIL(pilPolicy, true, ROYALTY_POLICY, MINTING_FEE, MINTING_FEE_TOKEN);

  function addPolicyToIPA(
  	PILPolicy memory pilPolicy,
    address ipId
  ) {
      return spg.addPILPolicyToIp(pilPolicy, true, ROYALTY_POLICY, MINTING_FEE, MINTING_FEE_TOKEN, ipId);

Note that currently, we recommend all users to utilize the default PILPolicy for creating any policies.