Skip to content

Investigate ButterSwap Affiliate Tracking Approach #1242

@premiumjibles

Description

@premiumjibles

Context

The ShapeShift affiliate revenue API aggregates fee data from multiple swap providers. ButterSwap is a cross-chain swap provider that was included in the original Python implementation (newrfox3.0). However, there are authentication challenges preventing straightforward API integration.

Repository: shapeshift/unchained
Location: node/proxy/api/src/affiliateRevenue/

Problem

ButterSwap's API only supports session tokens for authentication. Our revenue tracking system needs a more long-lived authentication approach since it runs as a background service that periodically fetches data.

Session tokens are problematic because:

  • They expire and require re-authentication
  • They may require interactive login flows
  • Not suitable for automated background processes

Investigation Goals

Option A: Long-lived API Access

  • Contact ButterSwap team about API key or service account access
  • Research if there's a partner/affiliate API with different auth
  • Check if session tokens can be refreshed programmatically without user interaction

Option B: On-chain Indexing

If API access isn't feasible:

  • Identify which chains ButterSwap operates on
  • Determine the contract addresses for ButterSwap swaps
  • Research what affiliate fee data is available on-chain
  • Evaluate feasibility of indexing swap events directly from blockchain
  • Estimate effort to build on-chain indexer vs API integration

Deliverables

  • Document findings on ButterSwap API authentication options
  • Recommendation on best path forward (API vs on-chain)
  • If on-chain: list of chains, contracts, and events to index
  • Estimate of implementation effort for chosen approach

Reference

  • Original Python implementation may have ButterSwap code: newrfox3.0 repo
  • Main app ButterSwap integration (if exists): check packages/swapper/ in shapeshift/web repo

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions