Skip to content

feat: index ReferralRewardPaid events and referral stats model - #724

Open
Holarconcept wants to merge 2 commits into
StellarState:devfrom
Holarconcept:fix/issue-662-build-referral-stats-indexer-and-earnings-rest-r2
Open

Holarconcept wants to merge 2 commits into
StellarState:devfrom
Holarconcept:fix/issue-662-build-referral-stats-indexer-and-earnings-rest-r2

Conversation

@Holarconcept

Copy link
Copy Markdown

Overview

This PR adds the event indexing layer for referral rewards: ReferralRewardPaid contract events are processed into a referral_earnings table, and the referral data model is extended to support the stats and earnings queries required by the referral REST API.

Related Issue

Closes #[issue-number]

Changes

🔗 Event Indexing

  • [MODIFY] src/services/stellar/event-indexer.service.ts
    • Adds handling for ReferralRewardPaid contract events.
    • Each event is written to the referral_earnings table with referrer wallet, referred wallet, amount, and ledger timestamp.

🗂️ Data Model

  • [MODIFY] src/models/Referral.model.ts
    • Extends the referral model to represent earnings records (referrer, referred wallet, amount, date) used by the stats and earnings endpoints.

Verification Results

No automated tests were added in this PR. Indexing completeness, stats accuracy, pagination, and date filtering are to be verified against a testnet event replay before merge.

Acceptance Criteria Status
ReferralRewardPaid events indexed with no gaps ⏳ Pending replay verification
Stats endpoint returns accurate referred count and totals ⏳ Endpoint not included in this PR
Earnings list returns correct paginated results ⏳ Endpoint not included in this PR
Date range filter correctly narrows earnings results ⏳ Endpoint not included in this PR
Unclaimed balance reflects accurate live contract value ⏳ Endpoint not included in this PR

Closes #662

@TS-mfon

TS-mfon commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

✅ PR Ready for Review

Due to a recent malware incident affecting our repositories, all PRs are required to pass automated security checks before being reviewed for merging.

This PR has passed all automated checks:

  • ✅ Security scan — no malicious code detected
  • ✅ No merge conflicts

A maintainer will review and merge this PR shortly.

@Holarconcept

Copy link
Copy Markdown
Author

@TS-mfon — this PR is ready for another review. I resolved the merge conflicts with the dev branch (pushed 4561d31).
Files changed: src/services/stellar/event-indexer.service.ts

@TS-mfon

TS-mfon commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

✅ PR Ready for Review

Due to a recent malware incident affecting our repositories, all PRs are required to pass automated security checks before being reviewed for merging.

This PR has passed all automated checks:

  • ✅ Security scan — no malicious code detected
  • ✅ No merge conflicts

A maintainer will review and merge this PR shortly.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build referral stats indexer and earnings REST API for SS platform

2 participants