Skip to main content

Completed Code

All of this page is covered in this working code example.
This section demonstrates how to dispute an IP on Story. There are many instances where you may want to dispute an IP - whether that IP is or is not owned by you. Disputing IP on Story is easy thanks to our Dispute Module and the UMA Arbitration Policy. Let’s say you register a drawing, and then someone else registers that drawing with 1 pixel off. You can dispute it along a IMPROPER_REGISTRATION tag, which communicates potential plagiarism. In this tutorial, you will simply learn how to flag an IP as being disputed.

Prerequisites

There are a few steps you have to complete before you can start the tutorial.
  1. Complete the TypeScript SDK Setup
  2. Have a basic understanding of the Dispute Module

1. Dispute an IP

To dispute an IP Asset, you will need:
  • The targetIpId of the IP Asset you are disputing (we use a test one below)
  • The targetTag that you are applying to the dispute. Only whitelisted tags can be applied.
  • A cid (Content Identifier) is a unique identifier in IPFS that represents the dispute evidence you must provide, as described here (we use a test one below).
Note you can only provide a CID one time. After it is used, it can’t be used as evidence again.
Create a main.ts file and add the code below:
main.ts
import { client } from "./utils";
import { parseEther } from "viem";
import { DisputeTargetTag } from "@story-protocol/core-sdk";

async function main() {
  const disputeResponse = await client.dispute.raiseDispute({
    targetIpId: "0x6b42d065aDCDA6fA83B59ad731841360dC5321fB",
    // NOTE: you must use your own CID here, because every time it is used,
    // the protocol does not allow you to use it again
    cid: "QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR",
    // you must pick from one of the whitelisted tags here: https://docs.story.foundation/concepts/dispute-module#dispute-tags
    targetTag: DisputeTargetTag.IMPROPER_REGISTRATION,
    bond: parseEther("0.1"), // minimum of 0.1
    liveness: 2592000,
  });
  console.log(
    `Dispute raised at transaction hash ${disputeResponse.txHash}, Dispute ID: ${disputeResponse.disputeId}`
  );
}

main();

2. View Completed Code

Completed Code

See a completed, working example disputing an IP.