> For the complete documentation index, see [llms.txt](https://1hive.gitbook.io/celeste/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://1hive.gitbook.io/celeste/developers/documentation/disputable-api.md).

# Disputable API

&#x20;The `Disputable` parent contract is a contract which enables its children to easily interact with Celeste. It does this by packaging common patterns into internal methods which can be used by your contracts.

Inheriting from `Disputable` will allow you to easily create disputes and query their rulings while automatically syncing with Celeste's Manifest.&#x20;

## Constructor

{% tabs %}
{% tab title="constructor" %}

### `constructor(address, address)`

#### Parameters:

* **`address _arbitrator`**: address of the Celeste `AragonCourt` instance. Not hard coded for test purposes. This allows the instance to be initialized with the address of the mock during testing
* **`address _arbitratorManifest`**: address of the Celeste `CourtManifest` instance.

#### Emitted events:

The constructor does not emit any events.

#### General function

Initializes instance.
{% endtab %}
{% endtabs %}

## Properties

{% tabs %}
{% tab title="celeste court (arbitrator)" %}

#### `IArbitrator immutable public arbitrator`

Celeste `AragonCourt` instance as specified during initialization. Can be used if your contract wants to directly interact with Celeste.
{% endtab %}

{% tab title="manifest" %}

#### `IArbitratorManifest immutable public arbitratorManifest`

Celeste `ArbitratorManifest` instance as specified during initialization. Can be used if your contract wants to directly interact with Celests's representative manifest.

{% hint style="info" %}
Check the [Manifest](/celeste/developers/documentation/celeste-manifest.md) section to learn more about how the `ArbitratorManifest` works and methods it has.
{% endhint %}
{% endtab %}

{% tab title="ruling constants" %}

#### `uint256 internal constant RULING_REFUSED = 2`

#### `uint256 internal constant RULING_AGAINST_ACTION = 3`

#### `uint256 internal constant RULING_FOR_ACTION = 4`

Simple constants which give human readable names to the 3 possible rulings.

{% hint style="info" %}
Use the constants in your contract's logic whenever you interpret Celeste final rulings. It'll make your code easier to read.
{% endhint %}
{% endtab %}
{% endtabs %}

## Methods

{% tabs %}
{% tab title="submitting evidence" %}

### **`external submitEvidenceFor(uint256, bytes) -> ()`**

#### **Parameters:**

* **`uint256 _disputeId`**:\
  The dispute ID for which evidence is to be submitted
* **`bytes calldata _evidence`**:\
  Evidence to be evaluated by the jurors in the form of plain text.&#x20;

#### Emitted Events:

This method does not directly emit any events but may indirectly trigger events in the DisputeManager. (view step 2. "Submitting Evidence" [here](/celeste/developers/documentation/aragon-court.md) for more info).

#### General function

Will submit evidence for the case. Will submit evidence on behalf of the defendant or challenger depending on the caller. Will revert if the caller not a participating party or is a representative for both or neither parties.&#x20;
{% endtab %}

{% tab title="managing celeste's dispute fee" %}

### **`internal _prepareDisputeFee() -> (IERC20, uint256)`**

#### **Return values:**

* **`IERC20 feeToken`**:\
  ERC20 token in which the fee is denominated in
* **`uint256 feeAmount`**:\
  Amount of fee in `feeToken`

#### Emitted Events:

Doesn't directly emit any events besides an `ERC20.Approval` event approving the necessary Celeste dispute fee receiver.

#### General function

Prepares the dispute fee for the creation of a dispute. Useful if you want to ensure necessary approval but want to fund the fee with some custom mechanism.&#x20;

### `_prepareAndPullDisputeFeeFrom(address) -> ()`

#### Parameters:

* **`address _feePayer`**:\
  address from which to pull the necessary dispute fee. Requires the address to have approved the disputable contract to spend the fee token.

#### Emitted Events:

Doesn't directly emit any events besides an `ERC20.Approval` event approving the necessary Celeste dispute fee receiver and an `ERC20.Transfer`event denoting the transfer of the fee from the `feePayer` to the disputable contract.

#### General function

Pulls the necessary dispute fee from the specified address. If a call to this internal method does not revert it means that the fee requirements will be for the creation of a single dispute.

{% endtab %}

{% tab title="getting a ruling" %}

### **`internal _getRulingOf(uint256) -> (uint256)`**

#### **Parameters:**

* **`uint256 _disputeId`**:\
  The disputeId for which the ruling is to be queried

#### **Return values:**

* **`uint256 ruling`**:\
  Ruling of dispute. Can be checked in a human readable way via the `RULING_{...}` constants detailed above.

#### Emitted Events:

May indirectly trigger multiple events within the DisputeManager if a ruling is computed for the first time. No events are directly emitted from the disputable contract.

#### General function

Reverts if no ruling is available. Otherwise it retrieves the existing ruling or computes it if it's available but hasn't been directly computed yet.
{% endtab %}

{% tab title="creating a dispute" %}

### **`internal _createDisputeAgainst(address, address, bytes)  -> (uint256)`**

#### **Parameters:**

* **`address _defendant`**:\
  Defendant to be set for dispute. Only direct effect is limiting who can submit evidence for that dispute.
* **`address _challenger`**:\
  Challenger to be set for dispute. Only direct effect is limiting who can submit evidence for that dispute. Should generally be the `msg.sender`
* **`bytes memory _metadata`**:\
  Metadata for the dispute in the form of the metadata format described [here (Creating and managing a dispute > 1. Initializing a dispute > Metadata format)](/celeste/developers/documentation/aragon-court.md)

#### Return values:

* **`uint256 disputeId`**:\
  Dispute ID of the newly created dispute.

#### Emitted events:

* **`PartiesSet(uint256 indexed disputeId, address indexed defendant, address indexed challenger)`**&#x45;mitted from the ArbitratorManifest

Other events are emitted from within the DisputeManager as the dispute is created.&#x20;

#### General function

Transfers Celeste's dispute fee from the disputable contract to the necessary recipient, creates a dispute and updates the manifest.&#x20;
{% endtab %}
{% endtabs %}
