Skip to content

Cryplo Bridge: Deposit (ExCoin → Cryplo USD) #57

Description

@MrCrystal2

Parent PRD

Source: plans/cryplo-bridge.md — ExSize ↔ Cryplo Bridge

What to build

Implement deposit transfers so authenticated Cryplo users can convert ExCoin to USD in Cryplo.

End-to-end: Cryplo calls POST /api/cryplo/deposit with Bearer token + amount_usd + cryplo_user_id → ExSize verifies token → checks ExBucks balance (amount_usd / 2 = excoin_amount) → deducts ExBucks → records transfer in cryplo_transfers → returns success with new balance.

Also includes GET /api/cryplo/balance for Cryplo to check a user's ExCoin balance.

This includes:

  • New cryplo_transfers table (id, exsize_user_id, type, amount_usd, excoin_amount, status, cryplo_tx_id, created_at, completed_at)
  • POST /api/cryplo/deposit — deducts ExBucks, records transfer
  • GET /api/cryplo/balance — returns current ExBucks balance
  • All endpoints require Bearer token auth (API token from Cryplo Bridge: API Token Infrastructure + SSO Verify #56)

Acceptance criteria

  • cryplo_transfers table created with proper indexes
  • POST /api/cryplo/deposit deducts ExBucks from user (1 ExCoin = 2 USD)
  • Returns 400 with insufficient_funds if balance too low
  • Transfer recorded in cryplo_transfers with status 'completed'
  • GET /api/cryplo/balance returns {excoin_balance, user_id} for authenticated user
  • All endpoints require valid API token (401 without)
  • Tests pass with uv run pytest tests/ -x

Blocked by

User stories addressed

  • Deposit transfer (ExCoin → Cryplo USD)
  • Balance check endpoint

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions