Agent credit lines on SohoPay are backed by collateral held in smart contract vaults. This guide covers how to deposit collateral, how withdrawals are gated by outstanding debt, how to monitor your balance, and how idle collateral earns yield.

The vault architecture in one minute

The SohoPay vault is an ERC-4626 tokenized yield vault deployed on Base. When you deposit USDC, the vault issues non-transferable accounting shares that track your collateral position.

Key principles

  1. Vault balance = borrowing capacity: The sum of all active agent credit lines provisioned under your account cannot exceed what your vault collateral backs.
  2. Earn LP yield: While your collateral sits in the vault, it earns passive yield. The 3% LP slice of the 5% transaction fee is distributed directly to vault depositors.
  3. Non-custodial design: The SohoPay API never holds or takes custody of your funds. The API prepares the transaction calldata, and you sign and broadcast the deposit from your own wallet.
Do I need to fund a vault?
  • Individual AI Agent Builders (MCP): No. Sandbox accounts and pre-qualified borrowers in the Borrower Portal are provided with pre-loaded credit facilities.
  • Platform Operators & Fleets: Yes. If you operate custom multi-agent backends or wish to expand programmatic credit limits, deposit USDC collateral into your vault.

Supported networks & USDC contracts


Deposit USDC collateral

Depositing is a two-step flow: prepare the transaction via API, then submit it on-chain from your operator wallet.

Step 1: Prepare the deposit calldata

POST /api/v1/vault/deposit generates the required contract parameters:

Response (200 OK):

Step 2: Broadcast on-chain

Submit the transaction from your connected wallet (e.g. using Viem or MetaMask). Ensure your wallet has approved the vault address to spend the required USDC. Once confirmed on Base (~1s), your borrowing capacity expands immediately.

Withdraw USDC & gating rules

Withdrawals follow the same prepare-and-submit pattern via POST /api/v1/vault/withdraw. However, withdrawals are strictly gated by outstanding agent debt: you can only withdraw collateral that is not currently backing unsettled agent balances.

Gated withdrawal error (409 Conflict)

If you attempt to withdraw more than your unencumbered balance, the gateway rejects the request:

How to unwind collateral before withdrawal:

  1. Pause active agents: Call POST /api/v1/agents/{id}/pause to prevent new payments from drawing on credit.
  2. Settle balances: Allow in-flight orders to finalize and execute repayment.
  3. Check withdrawable funds: Verify that withdrawable equals the desired amount.
  4. Initiate withdrawal: Submit the withdrawal transaction.

Check vault balance & health

Poll GET /api/v1/vault/balance/{merchant_id} to inspect your current collateral utilization:

Response (200 OK):

  • vault_balance — Total collateral deposited (sets total credit ceiling).
  • credit_in_use — Amount actively backing outstanding agent balances.
  • withdrawable — Collateral free to be withdrawn immediately (vault_balance - credit_in_use).
Set automated monitoring alerts when withdrawable drops below 10%. If available collateral is exhausted, subsequent agent payment authorizations will fail with 402 INSUFFICIENT_CREDIT.

Sandbox testing

In the staging environment (Base Sepolia), test accounts include pre-allocated sandbox collateral. You can test agent creation and x402 payments without depositing any funds. If you want to test the full on-chain deposit flow in the sandbox:
  1. Claim test USDC from faucet.circle.com on Base Sepolia.
  2. Run POST /api/v1/vault/deposit with your test key.
  3. Submit the deposit transaction on Base Sepolia.

Next steps

ERC-4626 Vault Protocol

Explore share accounting formulas, liquidity pools, and yield logic.

Agent Setup

Provision operational agents backed by your vault collateral.

Payment Flow

Learn how payments sign, authorize, and settle against your credit lines.