> ## Documentation Index
> Fetch the complete documentation index at: https://docs.story.foundation/llms.txt
> Use this file to discover all available pages before exploring further.

# DisputeModule

The Dispute Module acts as an enforcement layer for IP assets that allows raising and resolving disputes through arbitration by judges. It enables users to challenge IP assets that may violate rules or infringe on other IP rights.

## State Variables

### name

```solidity theme={null}
string public constant override name = DISPUTE_MODULE_KEY
```

Returns the name of the module.

### IN\_DISPUTE

```solidity theme={null}
bytes32 public constant IN_DISPUTE = bytes32("IN_DISPUTE")
```

Tag to represent the dispute is in dispute state waiting for judgement.

### LICENSE\_REGISTRY

```solidity theme={null}
ILicenseRegistry public immutable LICENSE_REGISTRY
```

Returns the protocol-wide license registry.

### GROUP\_IP\_ASSET\_REGISTRY

```solidity theme={null}
IGroupIPAssetRegistry public immutable GROUP_IP_ASSET_REGISTRY
```

Returns the protocol-wide group IP asset registry.

### IP\_GRAPH\_ACL

```solidity theme={null}
IPGraphACL public immutable IP_GRAPH_ACL
```

Returns the protocol-wide IP Graph Access Control List.

## Functions

### initialize

```solidity theme={null}
function initialize(address accessManager) external initializer
```

Initializer for this implementation contract.

**Parameters:**

* `accessManager`: The address of the protocol admin roles contract.

### whitelistDisputeTag

```solidity theme={null}
function whitelistDisputeTag(bytes32 tag, bool allowed) external restricted
```

Whitelists a dispute tag.

**Parameters:**

* `tag`: The dispute tag.
* `allowed`: Indicates if the dispute tag is whitelisted or not.

### whitelistArbitrationPolicy

```solidity theme={null}
function whitelistArbitrationPolicy(address arbitrationPolicy, bool allowed) external restricted
```

Whitelists an arbitration policy.

**Parameters:**

* `arbitrationPolicy`: The address of the arbitration policy.
* `allowed`: Indicates if the arbitration policy is whitelisted or not.

### setArbitrationRelayer

```solidity theme={null}
function setArbitrationRelayer(address arbitrationPolicy, address arbPolicyRelayer) external restricted
```

Sets the arbitration relayer for a given arbitration policy.

**Parameters:**

* `arbitrationPolicy`: The address of the arbitration policy.
* `arbPolicyRelayer`: The address of the arbitration relayer.

### setBaseArbitrationPolicy

```solidity theme={null}
function setBaseArbitrationPolicy(address arbitrationPolicy) external restricted
```

Sets the base arbitration policy.

**Parameters:**

* `arbitrationPolicy`: The address of the arbitration policy.

### setArbitrationPolicyCooldown

```solidity theme={null}
function setArbitrationPolicyCooldown(uint256 cooldown) external restricted
```

Sets the arbitration policy cooldown.

**Parameters:**

* `cooldown`: The cooldown in seconds.

### setArbitrationPolicy

```solidity theme={null}
function setArbitrationPolicy(
    address ipId,
    address nextArbitrationPolicy
) external whenNotPaused verifyPermission(ipId)
```

Sets the arbitration policy for an ipId.

**Parameters:**

* `ipId`: The ipId.
* `nextArbitrationPolicy`: The address of the arbitration policy.

### raiseDispute

```solidity theme={null}
function raiseDispute(
    address targetIpId,
    bytes32 disputeEvidenceHash,
    bytes32 targetTag,
    bytes calldata data
) external nonReentrant whenNotPaused returns (uint256)
```

Raises a dispute on a given ipId.

**Parameters:**

* `targetIpId`: The ipId that is the target of the dispute.
* `disputeEvidenceHash`: The hash pointing to the dispute evidence.
* `targetTag`: The target tag of the dispute.
* `data`: The data to initialize the policy.

**Returns:**

* `disputeId`: The id of the newly raised dispute.

### setDisputeJudgement

```solidity theme={null}
function setDisputeJudgement(
    uint256 disputeId,
    bool decision,
    bytes calldata data
) external nonReentrant whenNotPaused
```

Sets the dispute judgement on a given dispute. Only whitelisted arbitration relayers can call to judge.

**Parameters:**

* `disputeId`: The dispute id.
* `decision`: The decision of the dispute.
* `data`: The data to set the dispute judgement.

### cancelDispute

```solidity theme={null}
function cancelDispute(uint256 disputeId, bytes calldata data) external nonReentrant whenNotPaused
```

Cancels an ongoing dispute.

**Parameters:**

* `disputeId`: The dispute id.
* `data`: The data to cancel the dispute.

### tagIfRelatedIpInfringed

```solidity theme={null}
function tagIfRelatedIpInfringed(address ipIdToTag, uint256 infringerDisputeId) external whenNotPaused
```

Tags a derivative if a parent has been tagged with an infringement tag or a group ip if a group member has been tagged with an infringement tag.

**Parameters:**

* `ipIdToTag`: The ipId to tag.
* `infringerDisputeId`: The dispute id that tagged the related infringing ipId.

### resolveDispute

```solidity theme={null}
function resolveDispute(uint256 disputeId, bytes calldata data) external nonReentrant whenNotPaused
```

Resolves a dispute after it has been judged.

**Parameters:**

* `disputeId`: The dispute id.
* `data`: The data to resolve the dispute.

### updateActiveArbitrationPolicy

```solidity theme={null}
function updateActiveArbitrationPolicy(address ipId) external whenNotPaused returns (address arbitrationPolicy)
```

Updates the active arbitration policy for a given ipId.

**Parameters:**

* `ipId`: The ipId.

**Returns:**

* `arbitrationPolicy`: The address of the arbitration policy.

### isIpTagged

```solidity theme={null}
function isIpTagged(address ipId) external view returns (bool)
```

Returns true if the ipId is tagged with any tag (meaning at least one dispute went through).

**Parameters:**

* `ipId`: The ipId.

**Returns:**

* `isTagged`: True if the ipId is tagged.

### disputeCounter

```solidity theme={null}
function disputeCounter() external view returns (uint256)
```

Returns the dispute ID counter.

**Returns:**

* `uint256`: The current dispute counter value.

### arbitrationPolicyCooldown

```solidity theme={null}
function arbitrationPolicyCooldown() external view returns (uint256)
```

Returns the arbitration policy cooldown.

**Returns:**

* `uint256`: The cooldown in seconds.

### baseArbitrationPolicy

```solidity theme={null}
function baseArbitrationPolicy() external view returns (address)
```

Returns the address of the base arbitration policy.

**Returns:**

* `address`: The base arbitration policy address.

### disputes

```solidity theme={null}
function disputes(
    uint256 disputeId
)
    external
    view
    returns (
        address targetIpId,
        address disputeInitiator,
        uint256 disputeTimestamp,
        address arbitrationPolicy,
        bytes32 disputeEvidenceHash,
        bytes32 targetTag,
        bytes32 currentTag,
        uint256 infringerDisputeId
    )
```

Returns the dispute information for a given dispute id.

**Parameters:**

* `disputeId`: The dispute id.

**Returns:**

* `targetIpId`: The ipId that is the target of the dispute.
* `disputeInitiator`: The address of the dispute initiator.
* `disputeTimestamp`: The timestamp of the dispute.
* `arbitrationPolicy`: The address of the arbitration policy.
* `disputeEvidenceHash`: The hash pointing to the dispute evidence.
* `targetTag`: The target tag of the dispute.
* `currentTag`: The current tag of the dispute.
* `infringerDisputeId`: The infringer dispute id.

### isWhitelistedDisputeTag

```solidity theme={null}
function isWhitelistedDisputeTag(bytes32 tag) external view returns (bool allowed)
```

Indicates if a dispute tag is whitelisted.

**Parameters:**

* `tag`: The dispute tag.

**Returns:**

* `allowed`: True if the tag is whitelisted.

### isWhitelistedArbitrationPolicy

```solidity theme={null}
function isWhitelistedArbitrationPolicy(address arbitrationPolicy) external view returns (bool allowed)
```

Indicates if an arbitration policy is whitelisted.

**Parameters:**

* `arbitrationPolicy`: The address of the arbitration policy.

**Returns:**

* `allowed`: True if the policy is whitelisted.

### arbitrationRelayer

```solidity theme={null}
function arbitrationRelayer(address arbitrationPolicy) external view returns (address)
```

Returns the arbitration relayer for a given arbitration policy.

**Parameters:**

* `arbitrationPolicy`: The address of the arbitration policy.

**Returns:**

* `address`: The arbitration relayer address.

### arbitrationPolicies

```solidity theme={null}
function arbitrationPolicies(address ipId) external view returns (address policy)
```

Returns the arbitration policy for a given ipId.

**Parameters:**

* `ipId`: The ipId.

**Returns:**

* `policy`: The arbitration policy address.

### nextArbitrationPolicies

```solidity theme={null}
function nextArbitrationPolicies(address ipId) external view returns (address policy)
```

Returns the next arbitration policy for a given ipId.

**Parameters:**

* `ipId`: The ipId.

**Returns:**

* `policy`: The next arbitration policy address.

### nextArbitrationUpdateTimestamps

```solidity theme={null}
function nextArbitrationUpdateTimestamps(address ipId) external view returns (uint256 timestamp)
```

Returns the next arbitration update timestamp for a given ipId.

**Parameters:**

* `ipId`: The ipId.

**Returns:**

* `timestamp`: The update timestamp.
