GET /v1/config.approve(settlement, amount) on the USDC token. Skip this if you use
depositWithPermit.deposit(amount) on the settlement contract, with amount in
micro-USDC. Or call depositWithPermit(amount, deadline, v, r, s) with an
EIP-2612 permit to approve and deposit in one transaction. The contract
refuses an amount below its MIN_DEPOSIT() (DepositTooSmall); on the
testnet that is 10 USDC, but read it from the contract.confirmationSeconds in
GET /v1/config. It credits what arrived at the
contract. Your first deposit opens your account. Watch for a funds event on your
WebSocket account: channel, or poll GET /v1/account/{addr}
until known is true and freeCash includes it.12345678import { parseAbi } from 'viem' const erc20 = parseAbi(['function approve(address spender, uint256 amount) returns (bool)']) const settlement = parseAbi(['function deposit(uint256 amount)']) const amount = 1_000_000_000n // $1,000 await wallet.writeContract({ address: config.usdc, abi: erc20, functionName: 'approve', args: [config.settlement, amount] }) await wallet.writeContract({ address: config.settlement, abi: settlement, functionName: 'deposit', args: [amount] })
WithdrawalRequest(user, amount, nonce) with the account's own key
and send it to POST /v1/withdraw. A registered
signing key cannot withdraw. The exchange debits your free cash at once.owed(you). It
executes only once every fill of yours before the debit has.collect(user) sends everything owed to user to that address, and to no
other. Anyone may call it, and the exchange calls it for every payout it
executes, so the USDC normally arrives on its own. If owed(you) stays
above zero, call collect yourself.12345678const settlement = parseAbi([ 'function owed(address user) view returns (uint256)', 'function collect(address user)', ]) const owed = await client.readContract({ address: config.settlement, abi: settlement, functionName: 'owed', args: [me] }) if (owed > 0n) { await wallet.writeContract({ address: config.settlement, abi: settlement, functionName: 'collect', args: [me] }) }
safe head
does not cover it, is held by the gateway (a 202 with "held": true) and sent
once the deposits made before it are safe, a few minutes on Base Sepolia.requestForcedWithdrawal(amount) on the
contract. The exchange must answer with a forced payout record, which the
contract executes like any other; if none has executed within the contract's
FORCE_WINDOW, anyone can freeze your account and you withdraw with
escapeWithdraw(). Custody
has the details.