Trader Joe QA (Avalanche) Schema Version 1.3.0 Subgraph Version 1.0.1 Methodology Version 1.0.0
| Description | Value |
|---|---|
| Subgraph Reviewed | https://subgraphs.messari.io/subgraph?endpoint=https://api.thegraph.com/subgraphs/name/messari/trader-joe-avalanche&tab=protocol |
| Date Reviewed | August 2 2022 |
| Schema Version | 1.3.0 |
| Subgraph Version | 1.0.1 |
| Methodology Version | 1.0.0 |
| Evidence Spreadsheet | https://docs.google.com/spreadsheets/d/1h_sEU5Ke4dTNuzGs6GkAw7o3SkgAC80_gx2axHwRpzk/edit?usp=sharing |
Metrics To Review
Protocol Metrics
| Section | Metric | Issue |
|---|---|---|
| financialsDailySnapshots | totalValueLockedUSD | 12/01/2021 and 01/01/2022 are looking roughly 20% off to me and there is about a 50% difference on 11/01/2021. The dates before then match well though. |
| usageMetricsDailySnapshots | dailyTransactionCount | I think that these metrics are generally correct, so I am guessing that they are accurate, but I do not have any exact date to compare to. Uniswap V3 on mainnet has about 38k transactions while TJ has 164K on 01/06/202, which seems like it could be a little suspicious. Granted though, swapping on AVAX is cheaper, so this could be completely accurate, but would not hurt to double check. |
| usageMetricsDailySnapshots | dailyDepositCount | Following same logic as overall transaction count |
| usageMetricsDailySnapshots | dailyWithdrawCount | Following same logic as overall transaction count |
| usageMetricsDailySnapshots | dailySwapCount | Following same logic as overall transaction count |
Pool Metrics
| Pool | Section | Metric | Issue |
|---|---|---|---|
| Trader Joe USD Coin/Wrapped AVAX | liquidityPoolDailySnapshots | cumulativeSupplySideRevenueUSD | Looks like this is not adding correctly. The dailySupplySideRevenueUSD for 01/07/2022 is 243,677.032 and difference in cumulative values between 01/07 and 01/06 is 105,866,601.894 - 105,031,817.123 = 834,784.771 |
| Trader Joe USD Coin/Wrapped AVAX | liquidityPoolDailySnapshots | cumulativeProtocolSideRevenueUSD | This also looks like it is not adding correctly. The dailyProtocolSideRevenueUSD for 01/07/2022 is 48,735.406 and the difference in cumulative vales between 01/07 and 01/06 is 21,173,320.379 - 21,006,363.425 = 166,956.954 |
| Trader Joe USD Coin/Wrapped AVAX | liquidityPoolDailySnapshots | cumulativeTotalRevenueUSD | Same problem as cumulative metrics for supply side and protocol side revenue |
| Trader Joe USD Coin/Wrapped AVAX | liquidityPoolDailySnapshots | dailyVolumeByTokenUSD - USDC | This is 0, would expect there to be values here |
| Trader Joe USD Coin/Wrapped AVAX | liquidityPoolDailySnapshots | stakedOutputTokenAmount - USD Coin/Wrapped AVAX LP | TJ allows for LP tokens to be staked for JOE emissions, so there should be output for this metric. Currently, nothing being outputted. |
| Trader Joe USD Coin/Wrapped AVAX | liquidityPoolDailySnapshots | rewardTokenEmissionAmount | No output. There should be output, as TJ has JOE emissions. There is reward information on the pool overview page, so not sure why it is not being reflected here. Looks like there might be an error though, as there is a warning at the top of the page stating: "LiquidityPoolDailySnapshot-rewardTokenEmissionsAmount should be an array, but has a null value in its timeseries data (first instance in LiquidityPoolDailySnapshot 0xa389f9430876455c36478deea9769b7ca4e3ddb1-18864)" |
| Trader Joe USD Coin/Wrapped AVAX | liquidityPoolDailySnapshots | rewardTokenEmissions - USD | No output. There should be output, as TJ has JOE emissions. |
| Trader Joe USD Coin/Wrapped AVAX | liquidityPoolDailySnapshots | rewardAPR | No output. There should be output, as TJ has JOE emissions. |
totalValueLocked
The big difference in totalValueLockedUSD starts happening around October 10th 2021, which is when TraderJoe launches its compound fork: https://snowtrace.io/tx/0xe09ea61ea36c730a07d0f76f8560766a0b2000fb5165befcd29b2967377d8e11
Defillama adds the exchange TVL to the Lending TVL on their page: https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/traderjoe/index.js
dailyTransactionCount
Our count matches perfectly with the one in the trader joe official subgraph: https://thegraph.com/hosted-service/subgraph/traderjoe-xyz/exchange?query=liquidity%20in%20AVAX%20and%20USD
Since daily txs seems correct I assume withdrawal, deposit and swap count will match too.
Leaving a few data points here on the TVL reported by Trader Joe's subgraph, for future reference:
01/11/2021 -> 1.219.265.143
01/12/2021 -> 2.009.645.295
01/01/2022 -> 1.546.111.189
01/06/2022 -> 1.425.159.775
02/01/2022 -> 849.066.289
03/01/2022 -> 1.083.538.027
04/01/2022 -> 1.085.065.124
05/01/2022 -> 662.370.229
06/01/2022 -> 280.981.427
07/01/2022 -> 157.798.352
TLDR; Most of these issues have been fixed already and just need to deploy the subgraph again
cumulative[...]RevenueUSD
Liquidity Pool Daily Snapshot values on:
-
cumulativeSupplySideRevenueUSD -
cumulativeProtocolSideRevenueUSD -
cumulativeTotalRevenueUSD
... are wrong because of the issue fixed here. We were using the protocol cumulative revenue values on the pool snapshots, instead of using the pool values. If we compare pool snapshot cumulative revenues to protocol snapshots cumulative revenues we can see they are almost the say for any given day. For example:
- 01/05:
-
pool.cumulativeTotalRevenueUSD->125,278,994 -
protocol.cumulativeTotalRevenueUSD->125,279,252
-
- 01/06:
-
pool.cumulativeTotalRevenueUSD->126,038,180 -
protocol.cumulativeTotalRevenueUSD->126,038,197
-
- 01/14:
-
pool.cumulativeTotalRevenueUSD->131,410,189 -
protocol.cumulativeTotalRevenueUSD->131,410,191
-
Re-syncing them again should fix that.
dailyVolumeByTokenUSD
Part of the issue was that we weren't setting the volume for non-whitelisted tokens in a pair. This has been resolved here.
The other part of the issue is that there are 2 USDC in AVAX: USDC and USDC.e. The latter was not marked as whitelisted, this is fixed here.
Re-syncing again should fix this too.
stakedOutputTokenAmount && rewardTokenEmissionAmount && rewardTokenEmissionsUSD
This was also fixed here. Re-syincing should make it :D
rewardAPR
This gets calculated from (rewardTokenEmissionsUSD / (totalValueLockedUSD * (stakedOutputTokenAmount /outputTokenSupply))) * 100 * 365.
Since the values of rewardTokenEmissionsUSD and stakedOutputTokenAmount are messed up because of the previous issue seems understandable that it is wrong. Re-syncing and correcting the previous issue should resolve this one too if there aren't any other additional causes.
Awesome! Thanks @jaimehgb. Will take a look again when the subgraph is resynced.
FYI It's been syncing for a couple of days now, it's on 2021-09-28.
Feel free to take a look at it already, or wait until it gets to where it was before the resync to compare with the same dates. As you prefer :D
FYI It's been syncing for a couple of days now, it's on
2021-09-28.Feel free to take a look at it already, or wait until it gets to where it was before the resync to compare with the same dates. As you prefer :D
Sounds good! Will probably give it another review by EOW. I think I also am waiting for it to fully sync to check outputToken metrics, but I can do that later and check the other stuff before.
@jaimehgb Looks like all the cumulative revenues and the dailyVolumeByTokenUSD - USDC metrics look good now. The other metrics (stakedOutputTokenAmount, rewardTokenEmissionsAmount, rewardTokenEmissionsUSD) also look like they are outputting values now, but it is hard to check the accuracy when the subgraph is not fully indexed. I am guessing most likely they are right though.
My only other concern is about pools that have JOE + other token rewards. Currently, if I look at the TJ UI (https://traderjoexyz.com/farm) there are pools, such as PTP/AVAX, AVAX/BTC.b, and AVAX/sAVAX, that are receiving token rewards (AVAX, QI, PTP) in addition to or instead of JOE. It is hard for me to check this right now since I am not sure of the past rewards emitted by other pools (on pool overview tab looks like there are only JOE rewards though), but wanted to check that we are accounting for this in general.
I'll prob make a full GH issue with a linked sheet once I can check the other metrics more thoroughly, but hopefully this helps. Thanks!
Hmm, yeah, looking at the code I only see JOE on the pool rewards. Been taking a look at the contracts, and they have some Rewarder module that we are not considering, so you'll find them missing.
I'm going to let it sync while I review this. Maybe I can deploy some parallel subgraph which only tracks rewards so we don't have to wait so long. I'll keep you posted.
@bye43
If we use the latest deployment to QA this should resolve most of these issues. The only thing missing will be the bonus staking rewards. There's another issue which I found while working on this which is that staking pool rewards start with a negative value ... It should not matter very much because rewards don't know on any cumulative values or revenues, but the plot is odd 😅

I'm not sure what's the best approach here, if QA-ing the version we have 50% synced or wait for the latest one to sync. The latest one started syncing yesterday, so it will still take a while. But maybe it's better to just wait. What do you think?
Default: https://subgraphs.messari.io/subgraph?endpoint=https://api.thegraph.com/subgraphs/name/messari/trader-joe-avalanche&tab=protocol Latest: https://subgraphs.messari.io/subgraph?endpoint=https://api.thegraph.com/subgraphs/name/jaimehgb/trader-joe&tab=protocol
@jaimehgb I think from my last quick check the core metrics should be fine in the default version, so I think it makes the most sense to wait and check all the reward metrics at once, but Trader Joe is a P1. What is the estimated indexing time? If it is going to take till after Mainnet, @this-username-is-taken does it make sense to QA the default version and give it the okay to have the non reward-based metrics be backfilled since rewards do not seem like they are going to be included for Mainnet?
@bye43 the latest deployment will take 25-30 days to index while the default one will take another 18-20 days or so. We should QA the default version for now and make a note of known issues and come back to the latest version after it fully indexes
@this-username-is-taken I think this has indexed to 02/2022, so was going to try to QA it by the EOW. Can hold off though if you think it needs to index further.
@this-username-is-taken I think this has indexed to 02/2022, so was going to try to QA it by the EOW. Can hold off though if you think it needs to index further.
EOW sounds good!
@this-username-is-taken @jaimehgb The non-reward metrics look good here, so I think this can be frozen for Mainnet if we are going to add in reward tokens later. Just for tracking the metrics that need to be QA'd still are (making sure that values are not negative and bonus rewards are included):
- rewardTokenEmissionAmount
- rewardTokenEmissionsUSD
Going to leave this in fixed, but indexing for now.
@this-username-is-taken @jaimehgb Closing this issue and going to move post mainnet issues here: https://github.com/messari/subgraphs/issues/1026