Updated Adapter - Curve Fees v0.0.2

I’ve published an updated adapter for Curve Fees

I’m using the graphql endpoint you suggested for mainnet : https://thegraph.com/hosted-service/subgraph/sistemico/curve
Querying this:

{
  dailyVolumes (
    orderBy: timestamp
    orderDirection: desc
    where: {
      timestamp_gte: 1642464000
      timestamp_lte: 1642465000
      pool_contains
    }
  ) {
    pool {
      fee
      adminFee
      assetType
      name
    }
    volume
    timestamp
  }
}

Then summing over the pools dailyVolumes vol.volume * vol.pool.fee * asset_type_price[vol.pool.assetType] where vol.pool.fee is actually mostly 0.04%

The weird thing is that it seems I’m not getting the same values as displayed here on tokenterminal: Curve (CRV) | Dashboard | Token Terminal
Was probably due to the clamping of thegraph dailyVolumes object to 100 values. Adding first:1000 solved the problem - note that with 45 pools today, this limits the range queries to roughly a month of data.

Hey @jochemla, thanks for putting this together! Here’s my first thoughts on the adapter:

First, I think the adapter is double-counting fees on given days. You can see that the query is returning dates from both the beginning of the day (1642636800) and the end of the day (1642723200):

This could be fixed by changing timestamp_lte: $timestamp_lte to timestamp_lt: $timestamp_lt, however I think we can simplify it by simply querying single days (timestamp: $timestamp).

The dateRangeTotalFees query should probably be removed all-together, since we can only query price data at a single point in time, and for volatile assets (ETH, BTC, LINK), this price can change quite a bit.

It would be nice to compare our results to the fee data here:

However, the daily fees chart isn’t showing up for me.

Indeed, the inequality condition has to be strict on one side, just modifier this. Also removed range queries. Here is the updated adapter! Note the charts do not load on my side either from official curve fees dashboard.

New version with all chains, correct protocol launch dates, excluding one fantom fusdt because wrong volume

1 Like

curious, on the fantom usd why do you say it is returning the wrong value? the current price I see on spiritswap for fUSDT to fUSD looks like the same value that coingecko shows.

may also want to rename the variable from timestamp_lte to prevent confusion.

awesome work!

It’s the volume reported by the fantom graph for the fudft pool which seem to be incorrect, not the fusdt price, in the trillions or more - you can edit the adapter and add an sdk.log call in the if check to see the volume value.

I don’t think it should block the release.
I do wonder whats going on in there re: fantom usd . :thinking:

Just checking back in on this, seems this is the current status:

  • Arbitrum, Optimism and Avalanche aren’t working, I believe due to the lack of assetType. This can be fixed the same way the Fantom one is
  • The Polygon subgraph is only synced up to mid September 2021. Would be nice for this subgraph to finish syncing before we release this, but I’m not sure how long that will take

Alright, thanks for the info! Just updated the adapter

  • to include assetTypes for pool with no type. I let the adapter hard fails when mapping between pool name and asset type is not defined, to more easily spot wrong fees error on the curve adapter
  • and there seem to be two pools reporting wrong volumes : fantom fusdt as well as arbitrum mim, so I set these to zero

Awesome, the Polygon subgraph still has a ways to go (only synced up to Sept 26, 2021), but I think it’s fair to include the adapter now. Going to go ahead and verify it.

Thanks so much for your hard work on this adapter!

1 Like