Skip to content

Add TWAP oracle accumulation and price snapshot storage to bonding curve #1176

Closed

Description

@Chucks1093

Summary

Implement a TWAP oracle within the bonding curve contract that accumulates time-weighted price snapshots on each trade and exposes a get_twap function returning the average price over a configurable window.

Scope

  • Price snapshot stored on each trade: price and timestamp in a ring buffer of size N
  • TWAP computed as sum(price_i * delta_t_i) / total_window_time over last N snapshots
  • get_twap(window_seconds) returns TWAP for requested window clamped to available history
  • Snapshot ring buffer size configurable at initialization (default 100)
  • Emit PriceSnapshot event on each trade with price and cumulative value

Acceptance Criteria

  • TWAP computed correctly across varying time deltas between snapshots
  • Ring buffer wraps correctly and evicts oldest snapshot when full
  • get_twap returns accurate result for any window within available history
  • Window exceeding available history returns TWAP over full stored range
  • PriceSnapshot event emitted correctly on every trade

ETA

24 hours

Activity

  1. Temibell commented on Oct 21, 2026

    @Temibell

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

    Hi Maintainer, I can fix this pls assign. ETA 5hrs

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

  2. eteonninob-arch commented on Oct 21, 2026

    @eteonninob-arch

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

    Hi Maintainer, I would love to work on this pls assign

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

  3. somotochukwu-dev commented on Oct 21, 2026

    @somotochukwu-dev
    Contributor

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

    Hi
    Please assign this issue to me
    Thanks

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

  4. aduagba4133 commented on Oct 21, 2026

    @aduagba4133

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

    Kindly assign it to me

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

  5. Wittig18 commented on Oct 21, 2026

    @Wittig18

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

    hey maintainer, i would love to work on this

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

  6. Bkizzy16 commented on Oct 21, 2026

    @Bkizzy16
    Contributor

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

    Please kindly assign me this issue

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

  7. drips-wave commented on Oct 21, 2026

    @drips-wave

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

    🧑‍💻 @somotochukwu-dev: 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 🌊

  8. drips-wave commented on Nov 2, 2026

    @drips-wave

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

    Moderator's reason: Points issued via /assess-issue override (AI decision: REJECT)

    😎 @somotochukwu-dev: 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.

  9. grantfox-oss commented on Nov 8, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox!

    @somotochukwu-dev's PR #1195 was approved and merged by @Chucks1093.

    🏆 @somotochukwu-dev: You earned 40 FoxPoints for this contribution! Your current tier: Builder (1,649 total points). Track your full progress on GrantFox.

    👏 Great work, @somotochukwu-dev! Keep contributing to accesslayerorg.

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

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions