-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Yesterday a user in the discord reported that for some protocols, the TVL change values in the protocol rankings table didn't match the protocol TVL chart . For example, PulseX has a 1d change of +97%:
But the chart doesn't reflect that change:
I found that the issue is that the deprecated or no longer updated child protocols don't have the tvlPrevDay, tvlPrevWeek and tvlPrevMonth values. For example, here's PulseX V2:
{
"name": "PulseX V2",
"slug": "pulsex-v2",
"chains": [
"PulseChain"
],
"category": "Dexs",
"tvl": {
"default": {
"tvl": 92110907.54540412,
"tvlPrevDay": null,
"tvlPrevWeek": null,
"tvlPrevMonth": null
}
},
"tvlChange": {
"change1d": null,
"change7d": null,
"change1m": null
},
The TVL from this protocol is used to calculate the total TVL of PulseX. However, the daily change calculation only adds the previous TVLs of PulseX V1 and PulseX StableSwap and compares them to the current total TVL, which includes PulseX V2.
| Child Protocols | Current TVL | Prev Day TVL | Daily Change |
|---|---|---|---|
| PulseX V1 | 92292304 | 92807284 | -0.55% |
| PulseX V2 | 92110907 | null | null |
| PulseX StableSwap | 1065538 | 1069322 | -0.35% |
| Total | 185468749 | 93876606 | +97.56% |
I found the same problem with other protocols:
- Bucket protocol where Bucket Farm is deprecated
- Tala where Tala Swap V2 was last updated on October 7 and V3 was last updated on October 1
- Elys protocol where Elys Earn was last updated in May
I couldn't run the api-server locally to try it, but a possible solution could be to default to the current TVL when the previous values are null here: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/api2/cron-task/index.ts#L132
getYesterdayTvl = (protocol: any) => latestProtocolItemsDayAgoMap[protocol.id] ?? latestProtocolItems[protocol.id]
The TVL calculation would be:
| Child Protocols | Current TVL | Prev Day TVL | Daily Change |
|---|---|---|---|
| PulseX V1 | 92292304 | 92807284 | -0.55% |
| PulseX V2 | 92110907 | 92110907 | 0% |
| PulseX StableSwap | 1065538 | 1069322 | -0.35% |
| Total | 185468749 | 185987513 | -0.27% |