sushiswap / subgraphs

Sushi subgraphs
38 stars 96 forks source link

Buckets #2

Closed matthewlilley closed 2 years ago

matthewlilley commented 2 years ago

Buckets are essentially just clones of an KPI variants of entities, Token & Pool KPIs are reflected in PoolHourBucket, PoolDayBucket, TokenHourBucket, TokenDayBucket.

Each entity during update needs it's buckets updated at the same time. In a similar fashion to legacy subgraph

e.g. https://github.com/sushiswap/sushiswap-subgraph/blob/master/subgraphs/exchange/src/mappings/pair.ts#L429

Schema needs updating for Pool entities & Token to have a dayBuckets & hourBuckets relation on each.

Additionally we need a FactoryDayBucket & FactoryHourBucket too which is a reflection of KPIs in the same way.