Supported Chains
Aave V3 rescue operations are available on:- Ethereum (Chain ID: 1)
- Base (Chain ID: 8453)
- Arbitrum (Chain ID: 42161)
- BNB Chain (Chain ID: 56)
Understanding Aave Positions
Account Data
When you load positions, the app reads your Aave account data using thegetUserAccountData function:
Health Factor
Your health factor determines your loan’s safety:- Above 1.0: Position is healthy
- Below 1.0: Position is at risk of liquidation
- Health Factor = ∞: No outstanding debt
Aave Rescue Actions
Withdraw Collateral
Withdraw collateral tokens from Aave V3 Pool to your connected wallet.Select Action
In the Aave rescue actions section:
- Set Action dropdown to Withdraw collateral
- Choose Withdraw all or enter a custom amount
Execute Withdrawal
Click Execute Aave action via KernelThis submits a single UserOperation that calls:
Withdrawn collateral is sent directly to your connected EOA wallet, not the Kernel wallet.
Repay Debt
Repay outstanding debt to Aave V3 Pool.Fund the Wallet
Before repaying, ensure your Kernel wallet has enough repay token (USDC, USDT, etc.).
Select Action
In the Aave rescue actions section:
- Set Action dropdown to Repay debt
- Choose Repay all or enter a custom amount
Execute Repay
Click Execute Aave action via KernelThis submits two sequential UserOperations:Step 1/2: ApproveStep 2/2: RepayThe app waits for the approve UserOp to be mined before submitting the repay UserOp.
Code Examples
Reading Aave Position Data
The app reads your Aave position by calling the Pool contract:Encoding Withdraw Call
Fromlib/protocols/aave.ts:
Encoding Repay Call
Fromlib/protocols/aave.ts:
Full Repay Flow
Fromapp/wallet/[index]/_components/AaveRescueActions.tsx:
Best Practices
Monitor Health Factor
Monitor Health Factor
Always check your health factor before and after withdrawing collateral:
- A health factor above 1.5 provides a comfortable safety margin
- Never withdraw collateral that would drop your health factor below 1.2
- Consider market volatility when planning withdrawals
Partial vs Full Repayment
Partial vs Full Repayment
Full repayment (
Repay all toggle):- Uses
MAX_UINT256as the amount - Aave interprets this as “repay entire debt”
- Always fund extra tokens to account for accrued interest
- Specify exact amount in token decimals
- Useful for reducing debt while maintaining leverage
- Check remaining debt after execution
Gas Optimization
Gas Optimization
- Withdraw operations: 1 UserOp (~150k gas)
- Repay operations: 2 UserOps (~350k total gas)
- Ensure sufficient native token balance for gas
- The app adds a 50% buffer to gas estimates
Troubleshooting
'Insufficient balance' error
'Insufficient balance' error
For repay operations:
- Check that the Kernel wallet has enough repay token
- If using Repay all, add 1-2% extra to cover interest accrual
- Verify token balance with Load positions
'Health factor too low' error
'Health factor too low' error
Aave prevents withdrawals that would cause liquidation:
- Reduce withdrawal amount
- Repay some debt first to improve health factor
- Add more collateral before withdrawing
Approve UserOp reverted
Approve UserOp reverted
If Step 1/2 (approve) fails:
- Check that the Kernel wallet is deployed on this chain
- Verify sufficient gas token balance
- Try again with fresh gas price estimation
Next Steps
Wallet Recovery
Return to the full recovery workflow
Morpho Operations
Learn about Morpho Blue rescue actions