Skip to content

added affiliate id and bps envs#163

Merged
webpiratt merged 5 commits intomainfrom
vultisig/488-affiliate-id
Feb 17, 2026
Merged

added affiliate id and bps envs#163
webpiratt merged 5 commits intomainfrom
vultisig/488-affiliate-id

Conversation

@evgensheff
Copy link
Contributor

@evgensheff evgensheff commented Feb 16, 2026

Closes vultisig/recipes#488

Summary by CodeRabbit

Release Notes

  • New Features

    • Added affiliate tracking and configuration support across all blockchain providers (EVM, Bitcoin, XRP, Litecoin, Dogecoin, Bitcoin Cash, Tron, Cosmos, and Rune).
    • Configuration now supports affiliate ID and basis points parameters for enhanced transaction management.
  • Chores

    • Updated deployment configuration files to support new affiliate settings.

@evgensheff evgensheff requested a review from webpiratt February 16, 2026 17:56
@coderabbitai
Copy link

coderabbitai bot commented Feb 16, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

Adds affiliate tracking configuration (AffiliateID and AffiliateBps) to THORChain providers. Configuration is sourced from environment variables and Kubernetes ConfigMaps, then propagated through provider constructors to quote requests for all supported blockchain networks.

Changes

Cohort / File(s) Summary
THORChain Configuration
cmd/worker/main.go, deploy/01_worker.yaml, deploy/dev/01_thorchain.yaml, deploy/prod/01_thorchain.yaml
Extended THORChain config struct with AffiliateID and AffiliateBps fields; added corresponding environment variables and ConfigMap data entries.
Provider Implementations
internal/thorchain/provider_evm.go, internal/thorchain/provider_btc.go, internal/thorchain/provider_bch.go, internal/thorchain/provider_doge.go, internal/thorchain/provider_ltc.go, internal/thorchain/provider_xrp.go, internal/thorchain/provider_tron.go, internal/thorchain/provider_cosmos.go, internal/thorchain/provider_rune.go
Added affiliateID and affiliateBps fields to all provider structs; updated all constructors to accept these parameters and propagate affiliate data into THORChain quote requests.
Tests
internal/thorchain/provider_rune_test.go
Updated test cases to pass new affiliateID and affiliateBps parameters to NewProviderRune constructor calls.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 61.54% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'added affiliate id and bps envs' directly and clearly summarizes the main change: adding affiliate ID and BPS environment variables to the codebase.
Linked Issues check ✅ Passed The PR fully implements issue #488 requirements: introduces ThorChain affiliate ID (with 0 bps default) and propagates it across all provider implementations to enable affiliate tracking for the revenue dashboard.
Out of Scope Changes check ✅ Passed All changes directly support the objective of adding ThorChain affiliate ID and BPS tracking. Configuration additions, provider constructor updates, and deployment manifests are all tightly scoped to affiliate integration.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch vultisig/488-affiliate-id

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@cmd/server/main.go`:
- Around line 173-174: The config struct fields ThorChainAffiliateID and
ThorChainAffiliateBps are defined but never used; either remove these two fields
from the config in cmd/server/main.go, or if they are intended for future
plumbing, keep them but add a clear TODO comment next to ThorChainAffiliateID
and ThorChainAffiliateBps stating they must be wired into thorClient and
NewSwapSpec (or whichever component will consume them) and create a small TODO
ticket reference; ensure any kept fields are clearly marked and not left
silently unused.

In `@cmd/worker/main.go`:
- Around line 501-505: The struct tags `mapstructure:"..."` are ineffective
because config is loaded with envconfig.Process, so remove those tags from the
affected structs: update type thorChainConfig (remove `mapstructure` tags on
AffiliateID and AffiliateBps) and the verifier struct (remove `mapstructure`
tags on URL, SendToken, SwapToken, PartyPrefix) so envvar resolution relies only
on envconfig field names; keep field names intact and ensure no other
mapstructure tags remain in related config types referenced by
envconfig.Process.

In `@deploy/base/server/server.yaml`:
- Around line 101-104: The deployment currently sets THORCHAINAFFILIATEID and
THORCHAINAFFILIATEBPS (no underscores), but the server config struct expects
THORCHAIN_AFFILIATE_ID and THORCHAIN_AFFILIATE_BPS so envconfig ignores them and
defaults are used; fix by either renaming the env vars in the server deployment
to THORCHAIN_AFFILIATE_ID and THORCHAIN_AFFILIATE_BPS to match the config
struct, or (preferred) remove the hardcoded env entries and source these keys
from the existing thorchain ConfigMap the worker uses so both deployments share
the same single source of truth.
🧹 Nitpick comments (1)
internal/thorchain/provider_tron.go (1)

160-160: Pre-existing debug fmt.Printf statements should be cleaned up.

Lines 160 and 197 contain fmt.Printf debug statements ([TRON PROVIDER DEBUG], [TRON TX BUILDER DEBUG]) that will write to stdout in production. Consider replacing these with structured logger calls at debug level, or removing them entirely, in a follow-up. As per coding guidelines, structured logging with configurable levels should be used.

name: thorchain
data:
url: "https://thornode.ninerealms.com"
affiliate-id: "vultisig"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make it vult, it needs to be short to always fit in memo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, but according to the docs, we can even pass the address there

@webpiratt webpiratt merged commit b851419 into main Feb 17, 2026
1 of 2 checks passed
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.

Add ThorChain affiliate id for Recurring Swaps / Sends

3 participants