Skip to content

Add an endpoint returning a full on-chain state snapshot for a key for debugging and reconciliation #840

Description

@Chucks1093

Summary

When debugging discrepancies between on-chain and database state, operators need a way to see exactly what the contract holds for a given key without writing a separate script. A GET /admin/keys/:keyId/snapshot endpoint that reads all relevant on-chain fields via the Soroban RPC and returns them alongside the corresponding database values would simplify reconciliation.

Scope

  • Add GET /admin/keys/:keyId/snapshot requiring a valid admin JWT
  • Read circulatingSupply, currentPrice, holderCount, tradingPaused, supplyCap, holderCapBps, and circuitBreakerThresholdBps from the Soroban contract
  • Read the same fields from the database key record
  • Return both sets side by side with a drift boolean per field indicating whether they match
  • Return 404 for unknown key IDs

Acceptance Criteria

  • All specified on-chain fields read and returned
  • Corresponding database fields returned alongside each on-chain value
  • drift field correctly true when values differ and false when they match
  • Non-admin JWT returns 403
  • 404 returned for unknown key ID

ETA: 12 hours


Coordinate on Telegram

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