Skip to content

CEX prices are ingested and nothing compares them to the chain #217

Closed

Description

@Miracle656

Background

The most useful thing Lens can say about a CEX price is how far the on-chain price is from it. That is the number that tells a trader whether a Stellar venue is mispriced, and it is the number nobody else publishes for Stellar.

What to build

  • GET /premium/:assetA/:assetB — the on-chain price, the best CEX price, and the difference in basis points, naming both sources and both timestamps.
  • A premium computed from stale data is a lie: refuse to answer when either side is older than a configurable staleness bound, and say which side was stale.
  • openapi.yaml entry, ?network= honoured.

Acceptance criteria

  • The endpoint returns both prices, both sources, both timestamps and the spread in bps
  • A stale side produces an explicit refusal naming it, not a silently wrong number
  • The staleness bound is configurable
  • Tests cover fresh, one-side-stale and both-stale

Drips Wave · Complexity: Intermediate · 150 points


Repo: Divinity-Labs/Lens. Node + Fastify + Prisma + Postgres. The tests are vitest (npm test), not jest — running jest against this repo fails every file and tells you nothing.

Where venue adapters live: src/ingest/venues/. aquarius.ts is the reference implementation: it reads reserves, derives a spot price from the constant-product invariant, and writes price_points rows with a distinct source. Follow its structure, including _resetLastPrice() for tests.

Every row carries a network. price_points.network exists and is indexed (network, pairKey, timestamp DESC). A new ingester runs once per entry in ENABLED_NETWORKS (src/network/enabledNetworks.ts) and must write the network it read from. An adapter that hard-codes a network will silently merge mainnet and testnet prices into one series — that bug already exists on four routes and is being fixed separately.

Never elide a contract id or an issuer. Take every address from the protocol's own documentation and paste it whole. A previous batch in a sibling repo wrote CD2W5LUR…XZ4L in an issue and five contributors invented plausible-looking contract ids to fill the gap. If you cannot find the real address, say so in the PR rather than inventing one.

A price you cannot source is worse than no price. Every adapter must record where a number came from — source on the row, and the venue in any API response that uses it. Silent blending across venues is how a "unified" price becomes an average of a real market and a dead one.


Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk

Activity

  1. Outlaw1299 commented on Oct 15, 2026

    @Outlaw1299

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

    I’ve reviewed this task and have a clear idea of the work required. I can get started and ensure the changes follow the project’s conventions.
    

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

  2. BIGdigii commented on Oct 15, 2026

    @BIGdigii

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

    Hello Maintainer, I’d like to work on this issue, please assign it to me.
    ‎

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

  3. mansur-codes commented on Oct 15, 2026

    @mansur-codes
    Contributor

    @mansur-codes has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    I can fully handle this as it aligns with my skillset

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

  4. Ahmad12developer commented on Oct 15, 2026

    @Ahmad12developer
    Contributor

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

    Hi maintainer
    I like to work on this issue with basic understanding am having for the project

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

  5. drips-wave commented on Oct 15, 2026

    @drips-wave

    Congratulations, @mansur-codes! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

    🧑‍💻 @mansur-codes: 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 🌊

  6. drips-wave commented on Oct 25, 2026

    @drips-wave

    This issue has been marked as completed by a Drips Wave moderator for @mansur-codes as part of the Stellar Wave Program's 10th Wave 🥳

    Moderator's reason: [Auto-assessed] The PR has been merged (mergedAt not present in GitHub API for open state, but wait — PR #567 is open and has no maintainer objections, passes all CI checks, has clean mergeable state, and the contributor mansur-codes is the assigned applicant). Wait, looking closely at the PR state: it is open and NOT merged. Under auto-approve case 2: PR is open, no maintainer response or objections across any of the four channels, and PR content looks like a genuine, quality contribution that addresses the issue. All CI checks pass, diff coverage is 100%, and tests thoroughly cover fresh, stale, and configurable bounds as requested in the issue.

    😎 @mansur-codes: 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.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions