# x402 Earn Account

## A savings account for AI agents.

One x402 transaction in, one x402 transaction out. In between, idle USDC earns real yield in a live, $30.8M+ vault — no gas, no contracts to call, no manual transactions. Just earning dollars.

$30.8M+ TVL · ~4.2% APY (live, floats with strategy) · $0.01 flat fee either direction · ~$1 practical minimum · real-time deposits & withdraws

## Benefits

- **Yield without idle capital.** Balances sitting between jobs earn ~4.2% instead of sitting flat.
- **No gas, ever.** Withdrawals are authorized with a signed permit, not an on-chain approval — agents never touch native gas on the vault's chain.
- **~$1 practical minimum.** No account minimum — the floor comes from the underlying cross-chain bridge, not from us.
- **Predictable cost.** $0.01 flat, either direction — no percentage skim, no surprise slippage.

## Features

- **Two endpoints per source.** `GET /api/veda-kraken-boosted/deposit`, `POST /api/veda-kraken-boosted/withdraw` — both x402-gated, nothing else to integrate.
- **Full status tracking.** Every deposit and withdrawal exposes a step-by-step status endpoint, down to the transaction hash.
- **Automatic retries.** Transient failures at any step retry on their own; nothing silently stalls.
- **Agent-native.** Built entirely on x402 — no API keys, no signup, no dashboard login.
- **Diversified yield.** Capital is spread across multiple strategies (Morpho, Aave v3), not one point of failure.

## Yield sources

This service can host more than one yield source over time; each gets its own path prefix so adding one never changes another. Today there's one:

### `veda-kraken-boosted`

**Veda's Kraken Boosted USDC vault** (`balancedUSDC`) — a [Veda](https://veda.tech) BoringVault deployed on [Ink](https://inkonchain.com), Kraken's L2, as part of Kraken's Earn program. Deposits and withdrawals are x402-gated HTTP calls; status and balance reads are free.

| | |
|---|---|
| Payment asset | USDC on Base (`eip155:8453`), x402 `exact` scheme |
| Vault chain | Ink (`chainId 57073`) |
| Deposit fee | $0.01 flat, on top of the deposit amount |
| Withdraw fee | $0.01 flat |
| Minimum | ~$1 practical floor, on either side — enforced by the cross-chain bridge, not a fixed rule (requests below it are rejected before anything moves) |

Call `GET /api/veda-kraken-boosted/vault` any time for the current vault address, Teller, Accountant, share price, TVL, and APY breakdown — all fields below marked "live" come from that endpoint.

## Deposit

```
GET /api/veda-kraken-boosted/deposit?wallet=<address>&amount=<usdc>
```

x402-gated. Charges `amount + $0.01` in USDC on Base. `amount` defaults to `1` if omitted. Returns immediately with a `requestId` — deposit and vault-entry happen asynchronously.

```bash
# using the x402-fetch client (or any x402-aware HTTP client)
curl -i "https://x402-vault-service.vercel.app/api/veda-kraken-boosted/deposit?wallet=0xYourAddress&amount=10"
# -> 402 Payment Required, with an x402 payment challenge in the response
# an x402 client signs and retries automatically; see https://x402.org for client libraries
```

```json
{
  "requestId": "8cc94eb0-9e2a-4c1a-9a1e-2f7a0a0b1c2d",
  "wallet": "0xYourAddress",
  "netAmount": 10,
  "fee": 0.01,
  "totalCharged": 10.01,
  "status": "queued",
  "statusUrl": "/api/veda-kraken-boosted/deposit/8cc94eb0-9e2a-4c1a-9a1e-2f7a0a0b1c2d"
}
```

Poll `GET /api/veda-kraken-boosted/deposit/{requestId}` until `status` is `complete`; `sharesMinted` shows how many vault shares landed in `wallet`. Status moves through `queued -> bridging -> depositing -> share_locked -> complete` (or `failed`, with `failReason`).

## Withdraw

```
POST /api/veda-kraken-boosted/withdraw
```

x402-gated, flat $0.01 fee. Requires a **gasless EIP-2612 permit** authorizing the operator address to pull your shares — no on-chain `approve()` transaction, no native gas token needed.

To build the permit: sign an EIP-712 `Permit` message —

- `verifyingContract` — the vault address (from `GET /api/veda-kraken-boosted/vault`)
- `owner` — your wallet
- `spender` — the operator address (also from `GET /api/veda-kraken-boosted/vault`)
- `value` — the share amount you're withdrawing, in atomic units
- `nonce` — read live via `nonces(owner)` on the vault contract, on Ink (chain id `57073`)
- `deadline` — a future Unix timestamp

then split the resulting signature into `{ v, r, s }`.

```bash
curl -i -X POST https://x402-vault-service.vercel.app/api/veda-kraken-boosted/withdraw \
  -H "Content-Type: application/json" \
  -d '{
    "wallet": "0xYourAddress",
    "shareAmount": "0.5",
    "permit": { "deadline": 1790000000, "v": 27, "r": "0x...", "s": "0x..." }
  }'
# -> 402 Payment Required, same as deposit
```

```json
{
  "requestId": "467cd22b-1a2b-4c3d-9e0f-1a2b3c4d5e6f",
  "wallet": "0xYourAddress",
  "shareAmount": 0.5,
  "fee": 0.01,
  "status": "awaiting_pull",
  "statusUrl": "/api/veda-kraken-boosted/withdraw/467cd22b-1a2b-4c3d-9e0f-1a2b3c4d5e6f"
}
```

`payoutAddress` defaults to `wallet`; `payoutChain` currently only supports `"base"`. Poll `GET /api/veda-kraken-boosted/withdraw/{requestId}` until `status` is `complete` — USDC lands at `payoutAddress` on Base. Status moves through `awaiting_pull -> withdrawing -> bridging -> complete` (or `failed`; `failReason: "not_approved"` means the permit was missing, malformed, or expired).

## Check balance & pending activity

```
GET /api/veda-kraken-boosted/balance/{wallet}
```

Free. Returns your confirmed on-chain share balance plus every pending deposit/withdrawal, each with its own step-by-step transaction trail (chain, tx hash, confirmation status).

## Errors

- `400` — invalid or missing parameters (bad address, non-positive amount, missing/expired permit).
- `402` — payment required; retry with a valid x402 payment.
- `404` — unknown `requestId` on a status lookup.
- A queued job's `failReason` explains any failure after payment (e.g. a bridge fill expiring); each step retries automatically up to a small bound before the job is marked `failed`.

## Full machine-readable spec

See [`/openapi.json`](/openapi.json) for the complete OpenAPI document, including x402 payment metadata on every paid route, or [`/llms.txt`](/llms.txt) for a condensed agent-oriented summary.
