sushiswap / sushiswap-subgraph

Sushiswap Subgraph
https://thegraph.com/explorer/subgraph/sushiswap/sushiswap
MIT License
150 stars 257 forks source link

Doesnt this always return zero? #41

Open chrisfranko opened 3 years ago

chrisfranko commented 3 years ago

https://github.com/sushiswap/sushiswap-subgraph/blob/ee7afb21040d22c588e5df6da4817a5f7cc97c58/src/exchange/pricing.ts#L93

Ive added a logger here and it always seems to return zero. Like, always always.

This function seems to only be called in 2 places.

https://github.com/sushiswap/sushiswap-subgraph/blob/master/src/exchange/mappings/pair.ts#L338

and

https://github.com/sushiswap/sushiswap-subgraph/blob/master/src/exchange/mappings/pair.ts#L339

So unless im missing something, if derivedETH is never set anywhere else, itll do this expensive loop only to get a value and multiple it by another token with a derivedETH of 0, and there for always be zero.