[feature] AffiliateCollector Module + Preferred Asset Swap #check-lint-warning

This MR adds a per-THORName Preferred Asset Outbound Fee Multiplier, allowing affiliates to customize the payout threshold for their preferred asset swaps.

Background

If your THORName has a "preferred asset" set, your affiliate fees get accrued in RUNE and then when the RUNE amount > multiplier * outbound_fee_of_preferred_asset, the RUNE gets swapped to your preferred asset and sent to your address specified in your THORName. Previously, the multiplier was always the global default (PreferredAssetOutboundFeeMultiplier mimir, default 200). This MR allows each THORName to override that multiplier.

Changes

  • New preferred_asset_outbound_fee_multiplier field on THORName, MsgManageTHORName, and QueryThornameResponse protobuf types
  • Memo parsing: The manage THORName memo now accepts an optional 8th parameter for the multiplier: ~:name:chain:address:?owner:?preferredAsset:?expiry:?preferredAssetOutboundFeeMultiplier
  • Custom threshold logic: When accruing affiliate fees and checking payout thresholds, the per-THORName multiplier is used if set (≥1), otherwise falls back to the global default
  • Validation: Multiplier must be between -1 and 10000. A value of -1 is a sentinel to reset the multiplier to 0 (use global default). A value of 0 means "not set" (use global default)
  • Ownership transfer reset: When a THORName's owner changes, the multiplier is reset to 0 (global default) along with preferred asset and aliases
  • Query endpoint: The /thorchain/thorname/{name} response now includes preferred_asset_outbound_fee_multiplier and correctly calculates the threshold using the custom multiplier if set
  • Documentation: Updated thorname-guide.md with the new memo parameter and examples
  • Regression tests: Added test cases for setting a custom multiplier (400x), verifying the threshold calculation, and confirming payout triggers correctly with the custom threshold

Memo Examples

Example: ~:ODIN:BTC:bc1Address:thorAddress:BTC.BTC
Example with custom multiplier: ~:ODIN:BTC:bc1Address:thorAddress:BTC.BTC::500
Edited by Huginn Ai

Merge request reports

Loading