subgraphs icon indicating copy to clipboard operation
subgraphs copied to clipboard

fix(#patch): euler finance; fix market rate calculation & divide by 0

Open jaimehgb opened this issue 3 years ago • 0 comments

It seems we were calculating the depositToken<>outputToken exchangeRate the other way around.

If exchangeRate is the amount of input tokens a full share of output tokens is worth, then it should be total deposited input tokens / output token supply. We were calculating the inverse instead.

This was causing syncing errors becuase of eventually dividing by 0, when a pool is left empty.

I checked other protocols to see if it was our own particular way of calculating it, but no, it is wrong 😅 Maple finance, for example, does it right.

jaimehgb avatar Aug 25 '22 12:08 jaimehgb