TribecaDOCS

Settlement & Custody

Deposits & Withdrawals

Deposits

Tribeca accepts deposits of USDC on Base. Users transfer the asset to the Margin Vault address; once the transfer is included in a Base block (~2 seconds), the asset is credited to the user's collateral balance and immediately available for trading. Registered yield-bearing collateral assets follow the same path (Accepted Assets & Haircuts).

Deposits are confirmed on inclusion in a Base block. Base's sequencer provides fast soft finality on inclusion; the batch containing the deposit is subsequently posted to Ethereum L1 for full finality. The Margin Vault credits deposits on sequencer confirmation and re-validates on L1 posting.

Withdrawals

Users can withdraw any portion of their free collateral (collateral not locked as initial margin against open positions, and not reserved as Order Margin against open orders) at any time. Withdrawals are processed by submitting a withdrawal request that the Margin Vault validates against the user's solvency post-withdrawal: the account must remain HEALTHY after the withdrawal.

Approved withdrawals settle on Base within a block or two. There is no withdrawal queue or hold period for routine withdrawals.

WebSocket Event Trust Model

Tribeca's off-chain components emit a deterministic event stream over WebSocket: order acknowledgments, fills, position updates, funding payments, liquidations, and ADL events. This event stream is the canonical source of truth for client-side state.

WebSocket Fills are Authoritative for Trading

When the matching engine produces a fill, the fill event is emitted to both counterparties over WebSocket within milliseconds. Clients should treat the WebSocket fill event as definitive: the trade has occurred, the position has changed, the realized PnL is booked.

This is correct because:

  1. The matching engine is deterministic. Given the same sequenced inputs, it produces the same fills. The fill the client sees over WebSocket is the same fill that will be committed on-chain.
  2. Risk invariants are pre-checked. A fill that would violate solvency invariants (Risk Invariants on Every Trade) is auto-cancelled before any WebSocket event is emitted. There is no scenario where a client sees a fill event that subsequently fails to settle on-chain.
  3. Settlement cadence is short. Settlement batches commit roughly once per Base block (~2 seconds) on active markets; the gap between WebSocket fill and on-chain finality is bounded and short.

On-Chain Settlement Confirms Finality

The on-chain settlement event signals that the fill is now part of the canonical Base-anchored exchange state. This matters for:

  • Auditability. Every fill is publicly verifiable on Base.
  • Self-custody. Once settled on-chain, the position and balance changes are reflected in the Margin Vault. If the off-chain operator subsequently fails, the on-chain state at the most recent batch is the user's authoritative balance.
  • Compliance and reporting. Tax and regulatory reporting derives from on-chain records.

For trading decisions, the WebSocket event is sufficient and authoritative. For custody assurance, the on-chain event is the moment of finality.

Sequence Numbers and Gap Detection

Every WebSocket message carries a per-stream monotonically increasing sequence number. Clients should:

  • Verify sequence numbers are contiguous on each stream.
  • On gap, reconnect and request a snapshot (private streams) or a partial replay (public streams).
  • Never assume an event was missed silently; gaps always indicate transport-level issues.

Reconciliation

Tribeca publishes account-state and order-state endpoints (REST) that return the canonical position, balance, and open-order set. Production trading systems should reconcile against these endpoints periodically (default 60 seconds) to detect any divergence between local and server state. Reconciliation discrepancies are extremely rare but possible during stream reconnections; the REST endpoint always reflects the post-fill state visible to the matching engine.

Settlement Batch Structure

A settlement batch is a signed message submitted by the Settlement Submitter to the on-chain Settlement contract. Its structure:

BatchHeader
    batch_id              uint64
    parent_batch_id       uint64
    sequencer_timestamp   uint64        (engine timestamp at batch close)
    market_state_root     bytes32       (Merkle root of all market states)
    account_state_root    bytes32       (Merkle root of all account states)

BatchBody
    fills[]               list<FillRecord>
    funding_settlements[] list<FundingRecord>
    liquidations[]        list<LiquidationRecord>
    adl_events[]          list<ADLRecord>
    deposit_acks[]        list<DepositAck>
    withdrawal_reqs[]     list<WithdrawalRequest>

Signature
    submitter_signature   bytes65       (signed over BatchHeader || H(BatchBody))

The on-chain Settlement contract validates:

  1. Signature is from the authorized submitter.
  2. parent_batch_id matches the most recent finalized batch (no skips, no forks).
  3. Each individual record passes its own invariants. Fills must reference real accounts and pay correct fees; liquidations must satisfy bankruptcy bounds; withdrawals must leave the account HEALTHY.
  4. The aggregate state-root transition is consistent with the records.

If any check fails, the entire batch is rejected and resubmitted. There is no partial commit.

Cadence

Batch commit cadence is configurable per system load. On active markets during peak hours, batches commit roughly once per Base block (~2 seconds). During quiet periods, batches commit on a longer schedule to amortize gas, with a maximum interval bound (default 10 seconds) to keep client-visible finality predictable.

Reorg Handling

Base's sequencer provides soft finality on block inclusion (~2 seconds), and each batch is subsequently posted to Ethereum L1 where it becomes irreversible. Short sequencer-level reorgs are possible in principle: if a committed batch is reorged out, the Settlement Submitter re-submits it unchanged — batches are deterministic, so the re-committed state transition is identical. Client-visible finality is the on-chain settlement event; custody-critical operations (withdrawals, emergency exits) additionally wait for L1 posting.

On-Chain Records

Every settlement, liquidation, ADL event, and funding payment is recorded on-chain on Base. These records are publicly auditable and form the canonical history of the exchange.

Self-Custody Guarantees

The Margin Vault provides an emergency exit path: if the off-chain operator goes offline or becomes unresponsive past a threshold (default 24 hours), users can withdraw free collateral directly through an on-chain procedure that does not depend on the operator. This bounds the worst-case impact of operator failure to (a) inability to trade, and (b) inability to apply pending fills, neither of which can result in loss of custody. The transition into this mode and its mechanics are specified in Emergency Exit.