feat: add cowswap affiliate tracking
Summary
This adds butterswap to our affiliate revenue tracker. The implementation is a bit of a best effort hack until we get a proper API from butter. It just queries the approximate block at the start and end of your time period, looks at total affiliate fees and takes the diff.
Testing
- Make sure unchained ain't dead
If you want to properly test this locally:
-
Install dependencies (from repo root) cd /home/sean/Repos/shapeshift-unchained yarn install
-
Copy and configure env cp node/proxy/sample.env node/proxy/.env // Edit node/proxy/.env with real API keys (BEBOP_API_KEY, ZRX_API_KEY, etc.)
-
Start reverse proxy (from repo root) docker-compose up -d reverse-proxy
-
Start proxy API cd node/proxy docker-compose up
-
Test endpoint (in another terminal)
curl "http://api.proxy.localhost/api/v1/affiliate/revenue?startTimestamp=1764547200&endTimestamp=1767225600"
Screenshots
[!IMPORTANT]
Review skipped
Auto reviews are disabled on base/target branches other than the default branch.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.
✨ Finishing touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
11439_cowswap_tracker
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.
Comment @coderabbitai help to get the list of available commands and usage tips.