Rebalancing loan positions utilizing AAVE Flash loan

Strategy One Liner

The user borrowed 178,963 USDC from AAVE and then repaid 890 USDC and 88 WETH. He used DEXes and Flash loans to rebalance his loan position.

Big Picture

Key Steps

  • Step 0: The user borrowed 178,963 USDC from AAVE

  • Step 1: The user sent the borrowed 178,963 USDC to Paraswap, aiming to swap for WETH

  • Steps 2,3: Paraswap swapped 163,810 USDC for 80.96 WETH for the user at UniswapV3

  • Steps 4,5: Paraswap swapped 14,238 USDC for 7.04 WETH for the user at Pancake

  • Step 7: Paraswap collected a fee of 25.26 USDC

  • Step 6,8: Paraswap returned 890.3642 USDC and 88 WETH to the user

  • Step 10,13: The user repaid 890.3642 USDC and 88 WETH to AAVE

Key Protocols

  • AAVE: Aave is a decentralized crypto lending platform that lets users borrow and lend crypto.

  • Paraswap: ParaSwap is a decentralized exchange aggregator, like Booking.com but for DEX.

  • UniswapV3, Pancake: major DEXs.

Key Addresses

  • The solid green pentagon "from" is the user's EOA.

  • The addresses in the box "AAVE v3" are AAVE's addresses; you can view them as one account.

  • The oval "Paraswap Augustus Swapper" and the box "ParaSwapDebtSwapAdapterV3GHO" are Paraswap's contracts.

  • The oval "FeeClaimer" is Paraswap's contract for collecting fees.

  • The ovals "UniswapV3Pool" and "PancakeV3Pool" are UniswapV3 and Pancake's Pool addresses.

Key Assets

USDC, WETH

Simplified Illustration

Step-by-step Decoding

  • Step 0: The user borrowed 178,963 USDC from AAVE

  • Step 1: The user sent the borrowed 178,963 USDC to Paraswap, aiming to swap for WETH

  • Steps 2,3: Paraswap swapped 163,810 USDC for 80.96 WETH for the user at UniswapV3

  • Steps 4,5: Paraswap swapped 14,238 USDC for 7.04 WETH for the user at Pancake

  • Step 7: Paraswap collected a fee of 25.26 USDC

  • Step 6,8: Paraswap returned 890.3642 USDC and 88 WETH to the user

  • Step 10,13: The user repaid 890.3642 USDC and 88 WETH to AAVE

  • Step 9,12: 87.96 DebtWETH and 890.36 DebtUSDC were burnt, corresponding to the user's repayment.

  • Step 11: 178,963 DebtUSDC were mint, corresponding to the borrow in Step 0.

More Details

There are more similar rebalances like this one, for example,

In contrast to other DeFi users, this user uses Flash Loan to rebalance his positions. Debt contracts are tricky to handle, but one can do margin trading and short. Meanwhile, he can also earn a little interest. The rebalance amount is so large that he sometimes becomes the victim of sandwich attacks, for example,

Keywords

Flash loan, Rebalance

Last updated

Was this helpful?