Docs / Integrate

Integrate

Make any contract disputable by the jury in two steps: open a dispute with createDispute, and implement the rule() callback. Jury Escrow is the reference implementation.

Any contract can become disputable by the jury in two steps: open a dispute, and implement the ruling callback. There’s no oracle to run and no off-chain service, just Solidity.

The interface

Your contract implements one function:

interface IArbitrable {
    function rule(uint256 disputeId, uint8 outcome) external;
}

1. Open a dispute

When your app hits a disagreement, open a dispute and store the id:

uint256 disputeId = jury.createDispute(
    address(this),               // the arbitrable: your contract
    PolicyKind.Sortition,        // random panel; or PolicyKind.Open
    "Did the seller deliver order #4821?",
    ""                           // optional longer description
);

Approve the USDC fee token for the protocol first; createDispute charges the policy’s fee and reserves the JURY juror reward.

2. Implement the ruling callback

resolve() calls rule() back on your contract with the verdict. Guard it, and map the outcome to your business logic:

function rule(uint256 disputeId, uint8 outcome) external {
    require(msg.sender == address(jury));   // only the protocol may call
    require(disputeId == storedDisputeId);  // the dispute you opened

    if (outcome == 1)      _payClaimant();  // P1
    else if (outcome == 2) _refund();       // P2
    else if (outcome == 3) _split();        // P3
    // P4 (4) or anything else: undecided, reopen or no-op
}
Keep rule() cheap and non-reverting for valid outcomes. A revert just rolls the dispute back to Resolved so it can be retried with execute(disputeId); it can’t block the jury from resolving.

Outcomes

ValueOutcomeTypical meaning
1P1Find for the first party
2P2Find for the second party
3P3Split / partial
4P4Undecided (also the result of a tie)

Reference implementation

JuryEscrow.sol is a complete, working arbitrable: it opens a dispute in raiseDispute() and implements a rule() that pays the payee, refunds the depositor, splits, or reopens. Walk through it in the escrow lifecycle.

Prefer not to write a contract? The hosted Jury Escrow app already routes disagreements to the jury out of the box.