Integration model
Use a push model:- Your arbitrable contract owns escrowed funds, locked positions, or claimable balances.
- Your contract opens a dispute in Justly when an edge case appears.
- Justly runs the dispute lifecycle and returns
rule(disputeId, ruling). - Your contract executes the ruling by releasing, refunding, or reallocating funds.
Minimal interfaces
Define and depend on interfaces, not concrete implementations, so your integration remains stable if internal protocol contracts evolve.End-to-end flow
- Open dispute from your contract
Create a protocol case, lock relevant assets, then call
createDispute(...). - Fund dispute
The claimer and defender can each call
payDispute(disputeId). Your arbitrable contract can also fund both sides when your product model requires single-transaction UX. - Submit evidence
Parties submit evidence references through
submitEvidence(disputeId, ipfsHash). - Wait for ruling Justly handles juror assignment, voting, reveal, and settlement internally.
- Receive callback and enforce
Justly calls
rule(disputeId, ruling)on your contract. Your contract applies deterministic enforcement logic.
Ruling semantics
At the integration layer, treat the ruling as binary:0: defender wins1: claimer wins
- release escrow to one side,
- split according to pre-defined terms,
- or cancel and refund.
Evidence strategy
Store only compact references on-chain. Recommended approach:- put the root case file in
createDispute(..., ipfsHash, ...), - append additional evidence over time with
submitEvidence(...), - keep your own case metadata keyed by
disputeIdin your contract or indexer.
Security and implementation checklist
- Restrict
rule(...)so only the Justly arbitrator address can call it. - Make ruling execution idempotent. A dispute should not settle twice.
- Track
protocolCaseId -> disputeIdanddisputeId -> protocolCaseIdmappings. - Lock disputed assets before opening a dispute.
- Validate party roles before forwarding calls to
payDispute(...)andsubmitEvidence(...). - Emit protocol-level events for dispute opened, funded, evidence submitted, and ruling applied.
Practical integration pattern
A production integration usually keeps three layers:- Protocol contract: escrow and final enforcement.
- Arbitration adapter: thin wrapper that talks to Justly interfaces.
- Indexer/back end: evidence UX, timeline, notifications, and analytics.
What to version-pin
To protect your integration from contract changes:- pin the deployed arbitrator address per chain,
- pin the ABI version your adapter uses,
- keep interfaces in your repo and upgrade through explicit release steps.