The Graph API
Aave Flash Loans
AAVEtrage is dashboard for discovering and leveraging opportunities for interest rate arbitrage on AAVE. The motivation for the project is to increase borrow utilization on AAVE, and allow users to earn additional yield on their collateral. AAVE offers a variety of stablecoins, and eventually a variety of markets, which creates a large pool of borrow and deposit rates to choose from. AAVEtrage shows user the most competitive interest rate spreads and lets them enter leveraged positions on the spreads. The V2 AAVEtrage uses a debt-incurring flashloan to enter a leveraged arbitrage position with a single transaction. A central focus of our project is on accessibility. We provide users with an easy-to-understand and easy-to-use interface for interacting with AAVEtrage.
How It's Made
This project was built using scaffold-eth. The front end is a React application which pulls AAVE data from the v1 and v2 subgraphs, and utilizes scaffold-eth for Web3 interactions.The specific graph endpoints which get utilized are Reserve (interest rates) and UserReserve (portfolio). In the portfolio page, there is an additional step of passing this data into the aave-js library to generate a summary for each market. The V2 AAVEtrage is where a bulk of the effort was focused, both for smart contracts and on the front-end side. The V2 AAVEtrage utilizes a debt incurring flashloan to allow user to borrow, swap, and deposit assets with leverage in a single transaction. On the front-end, the maximum borrow amount is calculated by setting the minimum health factor to 1.4 and using the following formula to solve for maxBorrowETH: healthFactor = ((currentCollateralValueETH * currentLiquidationThreshold) + (maxBorrowETH * borrowAssetLTV)) / (maxBorrowETH + currentBorrowValueETH) Currently the V2 AAVEtrage is the only action which is implemented, and this contract is NOT enabled on mainnet yet. Due to the complexity of steps in this transaction, additional testing is needed to ensure that transactions prevent failure or high slippage.