Get user earnings
Developers > Best Yield > Get user earnings
Tracking earnings on Idle is easy, you just need the avg buy price of the IdleTokens, the amount of IdleTokens held by a user and the current price.
IdleToken contract saves and updates the userAvgPrices
mapping which contains the avg price paid for each IdleToken of a user, so to calculate earnings (in underlying) one can do the following:
Last updated
Was this helpful?