The Graph API
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 lend DAI on Aave, provide your aDai as liquidity on Curve, and stake your LP tokens in the Curve farming gauge, SimpleFi will show your combined return.
How It's Made
To retrieve user data, SimpleFi makes direct calls to the blockchain using Ethers.js, and makes heavy use of individual protocol subgraphs, combined with the Etherscan and Coingecko APIs. The core of SimpleFi is a "Rewinder" function that boils DeFi investments down to their base assets, recursing through underlying fields as necessary. For example, starting with a stake in the Curve reward gauge, it will calculate the user's share of the Aave CRV liquidity pool, then the derived ownership of aDai, aUSDT and aUSDC, and finally Dai, USDC and USDT. SimpleFi then calculates ROIs based on the user's past transactions (e.g. liquidity provision, staking, reward claims, etc.) and the historical price of tokens. The SimpleFi front end is built with React and a simple backend stores key smart contract metadata.