Context
Core atomic execution. Inside one transaction: flash-borrow the debt token from Aave V3 → call VToken.liquidateBorrow → swap seized collateral → repay the flash loan → forward profit. If anything fails, the whole transaction reverts — zero capital risk.
Scope
executeLiquidation(LiquidationParams params) — external entry point, onlyOwner
- Invokes
AavePool.flashLoanSimple(address(this), debtToken, amount, data, 0)
executeOperation callback:
- Approve
VToken to pull debtToken
- Call
VToken.liquidateBorrow(borrower, repayAmount, collateralVToken)
- Redeem seized
collateralVToken for underlying
- Swap underlying → debt token via PancakeSwap V3
exactInputSingle
- Approve Aave to pull principal + premium
- Transfer profit remainder to
owner()
- Slippage guard on the swap (
minAmountOut parameter)
- Revert reasons for every failure mode (documented)
Acceptance criteria
References
Context
Core atomic execution. Inside one transaction: flash-borrow the debt token from Aave V3 → call
VToken.liquidateBorrow→ swap seized collateral → repay the flash loan → forward profit. If anything fails, the whole transaction reverts — zero capital risk.Scope
executeLiquidation(LiquidationParams params)— external entry point,onlyOwnerAavePool.flashLoanSimple(address(this), debtToken, amount, data, 0)executeOperationcallback:VTokento pulldebtTokenVToken.liquidateBorrow(borrower, repayAmount, collateralVToken)collateralVTokenfor underlyingexactInputSingleowner()minAmountOutparameter)Acceptance criteria
forge buildpassesReferences