{
  "openapi": "3.1.0",
  "info": {
    "title": "x402 Earn Account",
    "version": "1.0.0",
    "description": "A savings account for AI agents. One x402 payment deposits USDC into a live, market-tested yield vault ($30M+ TVL); another withdraws it back out — no gas, no contracts to call, no manual transactions. Just earning dollars. The first source is Veda's Kraken Boosted USDC vault on Ink (built on veda.tech infrastructure, part of Kraken's Earn program); more sources will be added under their own path prefix over time.",
    "x-guidance": "Call GET /api/veda-kraken-boosted/vault first (free) to read the live share price, TVL, and APY. To deposit, make an x402-paid GET /api/veda-kraken-boosted/deposit?wallet=<address>&amount=<usdc> call — the request returns immediately with a requestId; poll GET /api/veda-kraken-boosted/deposit/{id} until status is 'complete'. To withdraw, sign a free, gasless EIP-2612 permit for the vault contract (address from GET /api/veda-kraken-boosted/vault, used as verifyingContract; spender is the operator address also returned there; value=shareAmount; nonce from vault.nonces(wallet) on Ink, chainId 57073) and POST it with an x402 payment to /api/veda-kraken-boosted/withdraw; poll GET /api/veda-kraken-boosted/withdraw/{id} until status is 'complete'. Check any wallet's confirmed vault balance plus all pending activity at GET /api/veda-kraken-boosted/balance/{wallet} — no payment required for any status or read endpoint. Every paid route is scoped under /api/<source>/ so additional yield sources can be added later without changing this one."
  },
  "servers": [{ "url": "https://x402-vault-service.vercel.app" }],
  "paths": {
    "/api/veda-kraken-boosted/vault": {
      "get": {
        "operationId": "getVedaKrakenBoostedVault",
        "summary": "Live vault metadata, share price, TVL, and APY breakdown",
        "description": "Free. Static contract addresses plus a live on-chain read of totalSupply merged with the vault's off-chain performance feed (share price, TVL, APY, per-strategy breakdown).",
        "parameters": [
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "enum": ["7", "14", "30"], "default": "7" },
            "description": "APY lookback window in days"
          },
          {
            "name": "history",
            "in": "query",
            "required": false,
            "schema": { "type": "boolean", "default": false },
            "description": "Include 30 days of daily share-price/TVL/APY history"
          }
        ],
        "responses": {
          "200": {
            "description": "Vault metadata and live performance",
            "content": {
              "application/json": {
                "example": {
                  "source": "veda-kraken-boosted",
                  "address": "0xcaae49fb7f74cCFBE8A05E6104b01c097a78789f",
                  "name": "Balanced Yield USDC",
                  "symbol": "balancedUSDC",
                  "decimals": 6,
                  "chain": { "name": "ink", "chainId": 57073 },
                  "teller": "0xC151E263d5c890FD0Bceb33a6525F1A76a8329fC",
                  "accountant": "0x0C4dF79d9e35E5C4876BC1aE4663E834312DDc67",
                  "depositAsset": "0x2D270e6886d130D724215A266106e6832161EAEd",
                  "operator": "0x3e6ce487f82beF79D699932d31Ed87a5ce7C1852",
                  "shareLockPeriodSeconds": 60,
                  "totalSupply": "30041187486220",
                  "sharePrice": 1.0204,
                  "tvlUsd": 30810499.82,
                  "apy": 0.0417,
                  "apyBreakdown": { "fee": 0.0139, "maturity_apy": 0, "real_apy": 0.0417 },
                  "chainAllocation": { "ethereum": 0.8855, "ink": 0.1145 },
                  "strategyBreakdown": [
                    { "allocation": 0.8737, "apy": 0.0607, "apy_net": 0.0456, "chain": "ethereum", "protocol": "morpho" },
                    { "allocation": 0.1144, "apy": 0.0414, "apy_net": 0.031, "chain": "ink", "protocol": "aavev3" }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/veda-kraken-boosted/deposit": {
      "get": {
        "operationId": "depositVedaKrakenBoosted",
        "summary": "Deposit USDC into Veda's Kraken Boosted USDC vault",
        "description": "x402-gated with dynamic pricing: charges amount + $0.01 flat fee, in USDC on Base (eip155:8453). ~$1 practical minimum (a floor from the underlying cross-chain bridge, not a fixed rule). Settlement happens asynchronously after payment; an amount below the floor is rejected before anything is bridged, but the x402 payment itself is still captured — there's no pre-payment amount check yet.",
        "parameters": [
          {
            "name": "wallet",
            "in": "query",
            "required": true,
            "schema": { "type": "string" },
            "description": "EVM address that should receive the minted vault shares"
          },
          {
            "name": "amount",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "default": "1" },
            "description": "Net USDC to deposit, before the flat $0.01 fee. No fixed minimum from this service, but amounts that can't clear the underlying bridge's floor (~$1 in practice) will be rejected after payment, before bridging."
          }
        ],
        "responses": {
          "200": {
            "description": "Deposit request accepted and queued",
            "content": {
              "application/json": {
                "example": {
                  "requestId": "8cc94eb0-9e2a-4c1a-9a1e-2f7a0a0b1c2d",
                  "wallet": "0x4dA9c4289eFfA093Ac8c133770816f3e4BA0eE18",
                  "netAmount": 10,
                  "fee": 0.01,
                  "totalCharged": 10.01,
                  "status": "queued",
                  "statusUrl": "/api/veda-kraken-boosted/deposit/8cc94eb0-9e2a-4c1a-9a1e-2f7a0a0b1c2d"
                }
              }
            }
          },
          "402": {
            "description": "Payment required — pay via the x402 exact scheme on eip155:8453 (Base) in USDC",
            "content": { "application/json": {} }
          }
        },
        "x-payment-info": {
          "price": { "mode": "dynamic", "currency": "USD", "min": "1.00", "max": "1000000.00" },
          "protocols": ["x402"]
        }
      }
    },
    "/api/veda-kraken-boosted/deposit/{id}": {
      "get": {
        "operationId": "getVedaKrakenBoostedDepositStatus",
        "summary": "Poll a deposit job's status and per-step transaction trail",
        "description": "Free. Status progresses queued -> bridging -> depositing -> share_locked -> complete (or failed at any step, see failReason).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" },
            "description": "requestId returned by GET /api/veda-kraken-boosted/deposit"
          }
        ],
        "responses": {
          "200": {
            "description": "Deposit job status",
            "content": {
              "application/json": {
                "example": {
                  "id": "8cc94eb0-9e2a-4c1a-9a1e-2f7a0a0b1c2d",
                  "source": "veda-kraken-boosted",
                  "wallet": "0x4dA9c4289eFfA093Ac8c133770816f3e4BA0eE18",
                  "netAmount": 1,
                  "fee": 0.01,
                  "status": "complete",
                  "sharesMinted": 979325,
                  "failReason": null,
                  "retryCount": 0,
                  "createdAt": "2026-09-20T12:00:00.000Z",
                  "updatedAt": "2026-09-20T12:03:18.000Z",
                  "transactions": [
                    {
                      "tx_kind": "fee_transfer",
                      "chain": "base",
                      "tx_hash": "0x...",
                      "status": "confirmed",
                      "submitted_at": "2026-09-20T12:00:01.000Z",
                      "confirmed_at": "2026-09-20T12:00:05.000Z",
                      "error": null
                    }
                  ]
                }
              }
            }
          },
          "404": { "description": "No deposit request with that id" }
        }
      }
    },
    "/api/veda-kraken-boosted/withdraw": {
      "post": {
        "operationId": "withdrawVedaKrakenBoosted",
        "summary": "Withdraw Veda Kraken Boosted vault shares back to USDC",
        "description": "x402-gated, flat $0.01 fee in USDC on Base (eip155:8453). Requires a gasless EIP-2612 permit authorizing the operator to pull shareAmount shares — no on-chain approve() transaction or native gas token needed from the caller.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "wallet": { "type": "string", "description": "EVM address that owns the vault shares" },
                  "shareAmount": { "type": "string", "description": "Vault shares to redeem. No fixed minimum from this service, but the redeemed USDC must clear the underlying bridge's floor (~$1 in practice) — checked, and rejected cleanly, before shares are pulled." },
                  "payoutAddress": {
                    "type": "string",
                    "description": "Base address the resulting USDC should land in. Defaults to wallet."
                  },
                  "payoutChain": {
                    "type": "string",
                    "enum": ["base"],
                    "description": "Payout chain; only 'base' is supported today"
                  },
                  "permit": {
                    "type": "object",
                    "description": "EIP-2612 permit signature for the vault contract (GET /api/veda-kraken-boosted/vault for its address, used as verifyingContract). Sign Permit(owner=wallet, spender=<operator address from GET /api/veda-kraken-boosted/vault>, value=shareAmount, nonce=<vault.nonces(wallet) on Ink, chainId 57073>, deadline).",
                    "properties": {
                      "deadline": { "type": "integer", "description": "Unix timestamp the permit expires at" },
                      "v": { "type": "integer" },
                      "r": { "type": "string" },
                      "s": { "type": "string" }
                    },
                    "required": ["deadline", "v", "r", "s"]
                  }
                },
                "required": ["wallet", "shareAmount", "permit"]
              },
              "example": {
                "wallet": "0x4dA9c4289eFfA093Ac8c133770816f3e4BA0eE18",
                "shareAmount": "0.5",
                "payoutAddress": "0x4dA9c4289eFfA093Ac8c133770816f3e4BA0eE18",
                "payoutChain": "base",
                "permit": { "deadline": 1790000000, "v": 27, "r": "0x...", "s": "0x..." }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Withdrawal request accepted and queued",
            "content": {
              "application/json": {
                "example": {
                  "requestId": "467cd22b-1a2b-4c3d-9e0f-1a2b3c4d5e6f",
                  "wallet": "0x4dA9c4289eFfA093Ac8c133770816f3e4BA0eE18",
                  "shareAmount": 0.5,
                  "fee": 0.01,
                  "status": "awaiting_pull",
                  "statusUrl": "/api/veda-kraken-boosted/withdraw/467cd22b-1a2b-4c3d-9e0f-1a2b3c4d5e6f"
                }
              }
            }
          },
          "400": { "description": "Missing/invalid params or an invalid, missing, or expired permit" },
          "402": {
            "description": "Payment required — pay via the x402 exact scheme on eip155:8453 (Base) in USDC",
            "content": { "application/json": {} }
          }
        },
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.01" },
          "protocols": ["x402"]
        }
      }
    },
    "/api/veda-kraken-boosted/withdraw/{id}": {
      "get": {
        "operationId": "getVedaKrakenBoostedWithdrawStatus",
        "summary": "Poll a withdrawal job's status and per-step transaction trail",
        "description": "Free. Status progresses awaiting_pull -> withdrawing -> bridging -> complete (or failed at any step, see failReason).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" },
            "description": "requestId returned by POST /api/veda-kraken-boosted/withdraw"
          }
        ],
        "responses": {
          "200": {
            "description": "Withdraw job status",
            "content": {
              "application/json": {
                "example": {
                  "id": "467cd22b-1a2b-4c3d-9e0f-1a2b3c4d5e6f",
                  "source": "veda-kraken-boosted",
                  "wallet": "0x4dA9c4289eFfA093Ac8c133770816f3e4BA0eE18",
                  "shareAmount": 0.5,
                  "fee": 0.01,
                  "payoutAddress": "0x4dA9c4289eFfA093Ac8c133770816f3e4BA0eE18",
                  "payoutChain": "base",
                  "status": "complete",
                  "failReason": null,
                  "retryCount": 0,
                  "createdAt": "2026-09-20T12:00:00.000Z",
                  "updatedAt": "2026-09-20T12:01:12.000Z",
                  "transactions": []
                }
              }
            }
          },
          "404": { "description": "No withdraw request with that id" }
        }
      }
    },
    "/api/veda-kraken-boosted/balance/{wallet}": {
      "get": {
        "operationId": "getVedaKrakenBoostedBalance",
        "summary": "Confirmed vault position plus all pending deposit/withdraw activity for a wallet",
        "description": "Free. Confirmed shares are read live on-chain; pending deposits/withdrawals each include a full step-by-step transaction trail.",
        "parameters": [
          {
            "name": "wallet",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "EVM address to look up"
          }
        ],
        "responses": {
          "200": {
            "description": "Balance and pending activity",
            "content": {
              "application/json": {
                "example": {
                  "wallet": "0x4dA9c4289eFfA093Ac8c133770816f3e4BA0eE18",
                  "confirmed": {
                    "shares": "978825000",
                    "sharesFormatted": 978.825,
                    "sharePrice": 1.0204,
                    "usdcValue": 998.87
                  },
                  "pending": { "deposits": [], "withdrawals": [] },
                  "pendingDepositUsdc": 0,
                  "pendingWithdrawUsdc": 0
                }
              }
            }
          },
          "400": { "description": "Invalid wallet address" }
        }
      }
    }
  }
}
