Skip to content

chore(thorchain,mayachain): remove affiliate fee indexers - #1285

Merged
kaladinlight merged 1 commit into
developfrom
remove-affiliate-indexers
Jul 31, 2026
Merged

chore(thorchain,mayachain): remove affiliate fee indexers#1285
kaladinlight merged 1 commit into
developfrom
remove-affiliate-indexers

Conversation

@kaladinlight

@kaladinlight kaladinlight commented Jul 31, 2026

Copy link
Copy Markdown
Member

Description

Removes the affiliate fee indexers and their /api/v1/affiliate/* routes from the thorchain and mayachain coinstacks, along with the thorchain V1 node client that existed solely for the indexer's pre-hardfork block search.

Motivation

The indexers systematically underreported affiliate fees (mayachain: 124 fees all-time vs 379 actually on-chain):

  • A fee was only recorded when the affiliate outbound event and the memo-matched swap event landed in the same block — streaming swaps frequently pay the affiliate in a later block and were silently dropped.
  • Startup sync used CometBFT BlockSearch, capped by the node's event index (ours only reaches back to ~2025-07-04, after the first ssmaya swaps).
  • Live fees came from the websocket subscription with no backfill on disconnect/restart.
  • Memo parsing was an exact lowercase positional match (parts[4] == "ssmaya").

The revenue dashboard now sources affiliate fees directly from Midgard (shapeshift/revenue-dashboard), which has none of these gaps. With that deployed, nothing consumes these routes — verified by sweeping all shapeshift repos for /affiliate/fees, /affiliate/revenue, and the generated unchained-client methods.

Changes

  • Delete go/pkg/thorchain/affiliateFees.go and go/pkg/mayachain/affiliateFees.go
  • Remove affiliate routes, handlers, swagger docs/params from both coinstacks' api packages
  • Remove the indexer parameter from api.New and the Handler structs
  • Remove indexer creation + Sync() from both cmd/main.go
  • Remove affiliate paths/definitions from both swagger.json (removal-only, byte-parity with generator)
  • thorchain: remove cfgV1/httpClientV1 and LCD_V1_*/RPC_V1_* config + sample.env entries (verified indexer-only: tx history and all other paths use the main client)

Follow-ups

  • Deployed thorchain env can drop LCD_V1_URL/RPC_V1_URL and their API keys from secrets
  • web's generated unchained-client loses the AffiliateRevenue/AffiliateFees models on next codegen

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Breaking Changes
    • Removed affiliate fee and affiliate revenue API endpoints for THORChain and MayaChain.
    • Affiliate fee and revenue data are no longer available through the API.
    • Removed legacy V1 LCD/RPC configuration settings.
  • Configuration
    • Updated environment variable naming to use LCD_API_KEY.
    • Added support for configuring the websocket URL in the sample environment file.
  • Unchanged
    • Existing transaction, account, proxy, and chain information endpoints continue to operate.

The affiliate fee indexers underreported fees (same-block memo matching
missed streaming swaps, block-search history capped by the node's event
index, websocket gaps had no backfill). The revenue dashboard now sources
affiliate fees directly from midgard, so the indexers and their
/api/v1/affiliate routes are no longer consumed by anything.

Also removes the thorchain V1 node client, which existed solely for the
indexer's pre-hardfork block search.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kaladinlight
kaladinlight requested a review from a team as a code owner July 31, 2026 20:26
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a959a722-0c48-4680-8ad3-030f9f38b4bb

📥 Commits

Reviewing files that changed from the base of the PR and between 095276f and 088e22f.

📒 Files selected for processing (11)
  • go/coinstacks/mayachain/api/api.go
  • go/coinstacks/mayachain/api/handler.go
  • go/coinstacks/mayachain/api/swagger.json
  • go/coinstacks/mayachain/cmd/main.go
  • go/coinstacks/thorchain/api/api.go
  • go/coinstacks/thorchain/api/handler.go
  • go/coinstacks/thorchain/api/swagger.json
  • go/coinstacks/thorchain/cmd/main.go
  • go/coinstacks/thorchain/sample.env
  • go/pkg/mayachain/affiliateFees.go
  • go/pkg/thorchain/affiliateFees.go
💤 Files with no reviewable changes (6)
  • go/coinstacks/mayachain/api/swagger.json
  • go/pkg/mayachain/affiliateFees.go
  • go/pkg/thorchain/affiliateFees.go
  • go/coinstacks/thorchain/api/swagger.json
  • go/coinstacks/mayachain/api/handler.go
  • go/coinstacks/thorchain/api/handler.go

📝 Walkthrough

Walkthrough

The change removes affiliate fee indexing and related API surfaces from MayaChain and THORChain. It also removes THORChain V1 endpoint configuration and updates startup wiring and the sample environment file.

Changes

Affiliate functionality removal

Layer / File(s) Summary
Remove affiliate API surfaces
go/coinstacks/mayachain/api/*, go/coinstacks/thorchain/api/*
Affiliate routes, handler methods, response models, indexer fields, and Swagger definitions were removed.
Remove startup and legacy configuration
go/coinstacks/mayachain/cmd/main.go, go/coinstacks/thorchain/cmd/main.go, go/coinstacks/thorchain/sample.env
Startup no longer creates or synchronizes affiliate fee indexers. THORChain V1 endpoint settings were removed and the sample environment configuration was updated.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • shapeshift/unchained#1227: Introduced the THORChain affiliate-fees endpoint, handlers, models, and indexer removed by this change.

Suggested reviewers: 0xapotheosis

Poem

A rabbit checks the routes at dawn,
Affiliate paths are neatly gone.
The indexers rest, the configs clear,
V1 settings disappear.
Hop by hop, the stack is bright.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the removal of affiliate fee indexers from both Thorchain and Mayachain.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch remove-affiliate-indexers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kaladinlight
kaladinlight merged commit 4c0b8fa into develop Jul 31, 2026
3 checks passed
@kaladinlight
kaladinlight deleted the remove-affiliate-indexers branch July 31, 2026 20:32
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.

1 participant