S

SimpleFi

SimpleFi makes it easy to track your DeFi investments. See exactly what you've invested in, and the breakdown of your ROI.

The problem SimpleFi solves

Have you ever aped into a new yield farm promising 100%+ APY, but realised later it actually lost you money? Have you ever wished you could track your combined liquidity provider and yield farming ROI? Ever had cold sweats trying to remember what you've invested in?

Then SimpleFi is for you.

It will automatically find which fields you're invested in and how much money you've actually made from each one. Not only that, it will "rewind" your investments and tell you what underlying assets you own and where you've staked them or provided them as liquidity.

SimpleFi also calculates your ROI from multi-field strategies: for example, if you provide liquidity in a Uniswap pool and then stake your LP tokens in a yield farm, SimpleFi will show your combined return.

Challenges I ran into

For this hack I focused specifically on improving SimpleFi's tracking of Uniswap pools and their associated yield farms, in order to include the effect of impermanent loss.

The main challenges I ran into were:

  • how do you calculate your liquidity provider ROI when your LP tokens have been staked in another protocol's yield farming contract (e.g. providing liquidity in the Meta/wEth pool and then staking in the mStable Unipool farm)
  • how do you retrieve historical information about profits realised if the pool has been invested in and/or exited at different points in time?
  • how do you account for and calculate the effect of impermanent loss on your ROI?

Solving this required heavy use of the Uniswap subgraph which provides granular information on historical prices and balances, and sorting transactions so that staking or withdrawing LP tokens from a farming field were considered as neutral from a return perspective.

Discussion