Skip to main content

Module optimistic

Module optimistic 

Source
Expand description

Optimistic settler — the dispute-window state machine wired to real USDC.

crate::DevnetUsdcSettler closes the loop atomically: a slash pays the caller in one transfer, with no window and no split. This module promotes that to the full Settlement v2 shape: it drives scemadex_sdk::SettlementMachine with a dispute window and, at Finalized(Slashed), disburses the bond across the four-way scemadex_sdk::SlashRouting (caller / challengers / insurance / lineage) as real on-chain SPL-USDC transfers. Honored bonds move nothing.

It is the facilitator-side driver of the money loop. The trustless custody upgrade — where the program, not the agent, holds the collateral until finality — is the scemadex-escrow Anchor program (programs/scemadex-escrow); this settler and that program are the two halves of “close the loop on mainnet.” Point the settler at devnet to exercise the whole optimistic lifecycle for free.

Generic over a Clock so the window/deadline logic is deterministic in tests (inject a scemadex_sdk::ManualClock); defaults to the wall clock.

Structs§

Beneficiaries
The four token accounts a slashed bond is split across, per scemadex_sdk::SlashRouting. Any share whose routed bps is zero simply receives nothing.
OptimisticUsdcSettler
An optimistic USDC settler: a dispute-windowed SettlementMachine plus real four-way slash disbursement on finality.
SlashTransfer
One on-chain transfer performed while settling a slash.