flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Backend] Token Metadata & Verified Asset Registry Service

Open blurbeast opened this issue 3 months ago • 8 comments

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)

  1. On-Chain Probe:
    • Query Soroban token contract decimals and symbol via RPC simulation.
    • If SAC, resolve asset code and issuer via Stellar Horizon.
  2. Caching:
    • Cache token metadata in Redis with 24-hour TTL.
  3. 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

  • [ ] Automatically resolves decimals and symbol for any Soroban or SAC token address.
  • [ ] Caches asset metadata in database and Redis to minimize Horizon RPC traffic.
  • [ ] REST API endpoints for token listing and metadata lookup.

blurbeast avatar Aug 29 '26 22:08 blurbeast

let me work on this issue

jchinedu avatar Aug 29 '26 22:08 jchinedu

@uche102 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

Hi maintainer please i would like to work on this

ℹ️ Repo Maintainers: To accept this application, review their application or assign @uche102 to this issue.

uche102 avatar Sep 27 '26 15:09 uche102

@emmzydagreat has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

Hello Maintainer, I’ve carefully read the issue and understand the work involved. I’d like to take this opportunity to contribute and work on a dependable solution.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @emmzydagreat to this issue.

emmzydagreat avatar Sep 27 '26 15:09 emmzydagreat

@aduagba4133 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

I am a detail-oriented and reliable individual with strong skills in research, data entry, online tasks, and following instructions. I am committed to delivering accurate and high-quality work within deadlines and am available to start tasks immediately.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @aduagba4133 to this issue.

aduagba4133 avatar Sep 27 '26 15:09 aduagba4133

@Marvellous805 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

Hi maintainer I can fix this.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Marvellous805 to this issue.

Marvellous805 avatar Sep 27 '26 15:09 Marvellous805

Congratulations, @Marvellous805! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on September 30, 2026.

🧑‍💻 @Marvellous805: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Sep 27 '26 15:09 drips-wave[bot]

🎉 This issue has been marked as completed on GrantFox!

@Marvellous805's PR #1527 was approved and merged by @K1NGD4VID.

🏆 @Marvellous805: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (245 total points). Track your full progress on GrantFox.

👏 Great work, @Marvellous805! Keep contributing to LabsCrypt.

grantfox-oss[bot] avatar Oct 08 '26 06:10 grantfox-oss[bot]

This issue has been marked as completed by a Drips Wave moderator for @Marvellous805 as part of the Stellar Wave Program's 9th Wave 🥳

Moderator's reason: [Auto-assessed] The contributor's PR #1527 was merged by maintainer @K1NGD4VID on 2026-10-08 as evidenced by the mergedAt timestamp. The PR implements the token metadata and verified asset registry service specified in issue #1323, including Prisma schema updates, migrations, services, and API controllers.

😎 @Marvellous805: You earned 150 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here.

🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

ℹ️ Note: This issue was marked complete via moderation. Points were issued even though the GitHub issue remains open.

drips-wave[bot] avatar Oct 13 '26 00:10 drips-wave[bot]