Overview & Background
FlowFi streams can be created using any valid Soroban token contract or Stellar Asset Contract (SAC). To display human-readable symbols (e.g. USDC, EURC, XLM), icons, decimals, and verification badges in the frontend, the backend needs a Token Registry service that indexes on-chain asset details and caches metadata.
Technical Specification & Architecture
1. Database Schema (prisma/schema.prisma)
model TokenRegistry {
id String @id @default(uuid())
contractAddress String @unique // C... or SAC address
symbol String
name String
decimals Int
iconUrl String?
issuerAddress String? // G... for Stellar classic assets
isVerified Boolean @default(false)
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
@@index([contractAddress])
@@index([symbol])
}
2. Service Implementation (backend/src/services/token-registry.service.ts)
- On-Chain Probe:
- Query Soroban token contract decimals and symbol via RPC simulation.
- If SAC, resolve asset code and issuer via Stellar Horizon.
- Caching:
- Cache token metadata in Redis with 24-hour TTL.
- API Endpoint:
GET /api/v1/tokens: List verified tokens.
GET /api/v1/tokens/:address: Fetch or resolve metadata for a specific token contract.
Target Files
backend/prisma/schema.prisma
backend/src/services/token-registry.service.ts
backend/src/controllers/token.controller.ts
backend/src/routes/v1/token.routes.ts
Acceptance Criteria
Overview & Background
FlowFi streams can be created using any valid Soroban token contract or Stellar Asset Contract (SAC). To display human-readable symbols (e.g. USDC, EURC, XLM), icons, decimals, and verification badges in the frontend, the backend needs a Token Registry service that indexes on-chain asset details and caches metadata.
Technical Specification & Architecture
1. Database Schema (
prisma/schema.prisma)2. Service Implementation (
backend/src/services/token-registry.service.ts)GET /api/v1/tokens: List verified tokens.GET /api/v1/tokens/:address: Fetch or resolve metadata for a specific token contract.Target Files
backend/prisma/schema.prismabackend/src/services/token-registry.service.tsbackend/src/controllers/token.controller.tsbackend/src/routes/v1/token.routes.tsAcceptance Criteria