cowprotocol / dune-bridge

Other
4 stars 3 forks source link

Blazing Fast V2 Referral & Trader Data Query #52

Open bh2smith opened 1 year ago

bh2smith commented 1 year ago

The following query should eliminate the need for the entire python portion of this project and also any component of the Rust project responsible for fetching and parsing App Data

The API part of this project would now only refresh this query (responsibly) say once per hours and be able to serve this data to the user account page on CoW.Fi

Observe the current end point is:

https://api.cow.fi/affiliate/api/v1/profile/0x8540f80fab2afcae8d8fd6b1557b1cf943a0999b

which can be compared with any of the trader addresses returned by the query:

V2 Referral Query

Note that, while working on this I have discovered what appears to be a bug in the existing API service/referral query.

Namely, that for 0x8540f80fab2afcae8d8fd6b1557b1cf943a0999b (the address in the link above) the new query returns non zero referral count and volume. I went to look at the trade history of these referrals and found that the traders first trade did, in fact, use this wallet as the referred on their first trade. So I can not understand why we would be neglecting this as a valid referral:

  1. Referral 1
  2. Referral 2
  3. Referral 3

cc @gentrexha and @josojo as something we should plan for in the beginning of January.

bh2smith commented 1 year ago

Blocked by this bug in trades table.