Skip to main content
The deposit contract (DepositVault) holds every deposited token and is the only contract that moves user funds onchain. Deposits credit the user’s Funding account, settlements swap one token it holds for another through an approved settler, and withdrawals release funds back to the user. Settlements and withdrawals are approved offchain by the clearing engine and verified onchain by the deposit contract. One deployment per chain; read addresses from GET /registry/vaults. Amounts are chain amounts, in each token’s own onchain decimals. The deposit contract normalizes to the clearing engine’s 18-decimal internal units. user is the 32-byte Tplus user id (the same key as the User-Id header); account is the sub-account index.

Deposits

First-time depositors can use the overload that also registers the initial account multisig configuration:
Each SignerConfig registers a co-signer: key with keyType/keyPrefix identifies the key and its scheme (Ed25519, secp256k1, P-256, or WebAuthn), weight counts toward the per-action signing thresholds, and expiresAtNs/maxSigningWindowNs bound when it may sign. See signing. Deposits emit Deposited (or DepositedWithConfig) and increment depositCounts(user). The clearing engine credits the Funding account after the chain’s confirmation policy is met. Only approved depositors can call deposit today. Check canDeposit(address) -> bool before depositing. This restriction will be removed before production.

Settlement

Settlement deploys balances held in Tplus into onchain venues without a withdrawal. One asset leaves the deposit contract (tokenOut / amountOut) and another returns (tokenIn / amountIn) in a single transaction executed by an approved settler. Clients never call the deposit contract directly: initiate with POST /settlement/init, then the settler executes onchain. Flow, locks, and approval delivery: Settlement.
The clearing engine signs an approval digest, not standard EIP-712. There is no \x19\x01 envelope. For executeAtomicSettlement, the digest is keccak256(bytes.concat(...)) over SETTLEMENT_TYPEHASH() (keccak256("SettlementApprovalV2")), the deposit contract domain separator, tokenOut, amountOut, tokenIn, amountIn, mode, user, account, nonce, validUntil, and settler. The settler executes it:
The caller must be the executor registered for settler. The deposit contract verifies expiry, settler approval, executor authorization, nonce, and signature, then calls the executor at msg.sender. The data argument is not decoded by the deposit contract; the executor defines its own ABI for it (router calldata, swap path, minimum-out policy). The executor must implement the callback:
The deposit contract sends amountOut to the executor before the callback.
Revert reasons: Expired, SettlerNotApproved, NotExecutor, InvalidNonce(expected, given), InvalidSignature, TransferFailed, TransferFromFailed, InsufficientAmountFromExecutor.

Approved settlers

Only settlers registered on the deposit contract may execute settlements; each is bound to an executor address.
For a batch settlement, the executor calls executeBatchSettlements(SignedSettlement[] requests, bytes[] data, bytes32 settler) with several approved settlements. Each request pairs a settlement with the same approval signature executeAtomicSettlement takes. The deposit contract checks each one, nets the transfers per token, and calls onAtomicSettlement once per settlement with its data entry.

Withdrawals

A chain withdrawal returns tokens to the user against a node quorum of clearing-engine approval signatures bound to an epoch hash. Clients first move trading balances to the Funding account with a Funding account transfer, initiate with POST /withdrawal/init, and read GET /withdrawal/status/{user_id} after signature hints. Only the unfilled remainder of a queued transfer can be cancelled, through POST /account/transfer/cancel. Withdrawal locks, rebalancing fees, and approval expiry: Withdrawals.
The clearing engine signs an approval digest using keccak256("WithdrawalApprovalV1") as its type tag; it is not standard EIP-712. signatures must meet the deposit contract’s withdrawalQuorum, epochHash is the epoch hash that identifies the clearing-engine state the approval was made against, and withdrawalCounts(user) is the per-user withdrawal nonce. Revert reasons: Expired, InvalidNonce(expected, given), InvalidSignature, MissedQuorum(provided, required), TransferFailed.

Events

Nonce views