Skip to content

core: add direct Soroban read layer for on-chain state verification #85

Description

@EmeditWeb

Problem

The web app reads all protocol data through the API, including on pages whose
entire purpose is trust-minimized verification — yet Contracts.tsx displays
fabricated SHA-256 hashes (#61) and Home.tsx shows hardcoded pool stats (#60).
Users have no way to verify API-served numbers against the chain. There is no
client-side read path that queries Soroban contract state directly.

Before Starting

Read ALL of these before writing any code:

  • context/architecture-context.md
  • context/code-standards.md

What To Build

A direct Soroban read layer usable from the services tier:

  1. A contract read service using stellar-sdk / Soroban RPC
    getLedgerEntries (and simulated read-only calls) to fetch live pool
    stats, share price, reputation scores, and loan status directly from the
    deployed contracts (addresses from constants/config).
  2. A verification surface (Contracts page) that shows the real deployed WASM
    hashes and lets a user reconcile API-reported values against on-chain
    reads, flagging any mismatch.
  3. Read-only, no signing; graceful loading/error/empty states and typed
    results.

Files To Touch

  • src/services/soroban.service.ts (new)
  • src/constants/ (contract addresses / RPC config)
  • src/pages/Contracts.tsx, src/pages/Home.tsx (consume real reads)

Acceptance Criteria

  • Pool stats/share price/reputation readable directly from Soroban RPC
  • Contracts page shows real deployed WASM hashes (no fabricated values)
  • API-served values can be reconciled against on-chain reads with mismatch flag
  • Read-only path; no signing or writes
  • Loading, error, and empty states handled; tests cover the read service

Mandatory Checks Before Opening PR

  • All context/ files read and understood
  • npm run lint passes with zero errors
  • npm run build passes with zero errors
  • npm test passes — test count not decreased
  • No hardcoded hex colors; icons from lucide-react only
  • No API calls in page files
  • Tested on 375px mobile viewport
  • PR references this issue number

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions