yearn / yearn-vaults-v2-subgraph

26 stars 41 forks source link

Index more strategy data #152

Closed edwinzhng closed 2 years ago

edwinzhng commented 2 years ago

yearn.watch is super slow to load right now, since we need to perform multicalls to the smart contracts for each strategy to fetch data. If we could index a few key pieces of data for strategies, loading times could be reduced significantly (most of these already exist, but there are a few missing ones).

Data loaded from multicalls in Yearn Watch:

const STRAT_VIEW_METHODS = [
    'apiVersion',
    'emergencyExit',
    'isActive',
    'keeper',
    'rewards',
    'strategist',
    'name',
    'vault',
    'estimatedTotalAssets',
    'delegatedAssets',
    'want',
    'doHealthCheck',
    'healthCheck',
];
bsamuels453 commented 2 years ago

@edwinzhng do you have any concise examples of where doHealthCheck was inaccurate?

edwinzhng commented 2 years ago

@bsamuels453 sorry I just double checked, I was querying the wrong address for a strategy, will remove that from the issue description.

Would still be nice to have any of the additional fields mentioned above though, in particular Yearn Watch loads the strategist address field on the home pages, and estimatedTotalAssets along with activation date is used on the healthcheck report page (activation is from the vault ABI)

0xkofee commented 2 years ago

looks like all but the following are on the strategy entity @edwinzhng

Do you know of a strategy that overrides the delegatedAssets method? Trying to see if it's possible to update the value in the subgraph from an event or something. So far all the strategies I checked have it hard coded to zero.

edwinzhng commented 2 years ago

Just checked the codebase and those two fields are actually not used anywhere, even though they're loaded in STRAT_VIEW_METHODS, so I think it'd be fine to just ignore those?

0xkofee commented 2 years ago

ok then this issue should be closed then

edwinzhng commented 2 years ago

sweet thanks for your work on this !