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 finalizes a ruling,
- and your contract consumes that ruling through callback handling or direct reads.
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 callcreateDispute(...). - Fund dispute
Both sides of the dispute must be covered before activation. The parties can fund their own side, and a platform or sponsor can cover one or both sides when your product model requires it. - Submit evidence
Parties submit evidence references throughsubmitEvidence(disputeId, ipfsHash)during the evidence window. - Wait for ruling
Justly handles evidence freeze, voting, reveal, and settlement internally. - Consume the ruling
Your integration can receive a callback throughrule(disputeId, ruling)or read the final ruling directly.
Ruling semantics
At the integration layer, treat the ruling as binary:0: defender wins1: claimer wins
- release escrow to one side,
- split according to predefined terms,
- or cancel and refund.
Callback and direct reads
Callback is optional from the perspective of finality. That means:- a successful callback can notify your contract immediately,
- a direct read can be used as a fallback or primary integration mode,
- and callback failure does not invalidate the ruling.
Evidence strategy
Store only compact references on-chain. Recommended approach:- put the root case file in
createDispute(..., ipfsHash, ...), - append additional evidence during the evidence window 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.