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
}
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
| Value | Outcome | Typical meaning |
|---|---|---|
1 | P1 | Find for the first party |
2 | P2 | Find for the second party |
3 | P3 | Split / partial |
4 | P4 | Undecided (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.