Skip to main content

Crate scemadex_settle

Crate scemadex_settle 

Source
Expand description

§scemadex-settle — open devnet reference settler

The published scemadex_sdk ships the Conviction-Routing settlement state machine (scemadex_sdk::EscrowBondEngine) but deliberately moves no money — it carries no solana-sdk dependency. This crate closes that loop on devnet: it wraps the state machine and, when a bond is slashed, makes a real on-chain SPL-USDC transfer of the bond amount to the caller.

It exists so external developers can run the entire Conviction-Routing loop — quote → bond → execute → settle on-chain — for free, with no proprietary stack and no funds at risk. The production mainnet rail (x402 metering, fee abstraction, the trust/relay network) is a separate, closed component.

§⚠️ Devnet / test only

This is a reference implementation. It performs a plain SPL transfer of the bond on slash; it does not implement escrow custody, fee collection, x402 metering, dispute windows, or any mainnet safety. Do not point it at mainnet.

§What moves, and when

  • escrow — delegates to the inner scemadex_sdk::EscrowBondEngine: sizes a conviction-weighted bond and a guaranteed-minimum output. No transfer.
  • settle — runs the honored/slashed decision. On Slashed, transfers bond.amount micro-USDC from the agent’s USDC account to the caller’s. On Honored, nothing moves (the agent keeps its collateral).
use std::sync::Arc;
use scemadex_settle::DevnetUsdcSettler;
use solana_sdk::{pubkey::Pubkey, signature::Keypair};
let agent = Arc::new(Keypair::new());            // funded with devnet USDC + SOL
let usdc_mint = Pubkey::from_str("...")?;        // your devnet SPL mint
let beneficiary = Pubkey::from_str("...")?;      // caller's USDC token account
let settler = DevnetUsdcSettler::devnet(agent, usdc_mint, beneficiary);

Re-exports§

pub use optimistic::Beneficiaries;
pub use optimistic::OptimisticUsdcSettler;
pub use optimistic::SlashTransfer;

Modules§

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

Structs§

DevnetUsdcSettler
A devnet settler: the EscrowBondEngine state machine plus a real SPL-USDC transfer on slash. See the crate docs for the devnet-only caveat.

Constants§

DEVNET_RPC
Public Solana devnet RPC endpoint.
USDC_DECIMALS
USDC has 6 decimals on Solana; bonds are denominated in micro-USDC.