Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Sats-Terminal/borrow-recovery/llms.txt
Use this file to discover all available pages before exploring further.
Overview
After scanning for wallets, you can load detailed position data from supported lending protocols. Borrow Recovery currently supports:- Aave V3 (Ethereum, Base, Arbitrum, BSC)
- Morpho Blue (Base only)
Loading Positions
Navigate to Wallet Details
Click any wallet from the scan results or navigate directly to
/wallet/{index} where {index} is your wallet index.Select Chain
Choose the chain where your loan is deployed. The app will auto-detect the chain if the wallet is deployed.
Chain Auto-Detection
When you first load a wallet page, the app automatically scans all supported chains to find where the Kernel wallet is deployed:Data Displayed
Wallet Balances
The app displays three key balances:- Native token (ETH/BNB): Required for gas to execute UserOperations
- USDC: The debt asset, needed for repayment
- Collateral (cbBTC/WBTC): The asset supplied to the lending protocol
If the native balance is 0, you’ll see a warning. You must send gas to the Kernel wallet address before executing rescue operations.
Aave V3 Position Data
For Aave positions, the app fetches:Account Summary
- Health Factor: Ratio of collateral to debt (liquidation occurs below 1.0)
- LTV: Current loan-to-value ratio
- Liquidation Threshold: The LTV at which liquidation is triggered
Raw Position Data
The app also queries the Aave Pool contract directly:Token Balances (aToken & Debt Tokens)
Morpho Blue Position Data (Base Only)
For Morpho positions on Base:- Supply shares: Your share of the lending pool
- Borrow shares: Your share of the borrowing pool
- Collateral supplied: Amount of cbBTC collateral
- Borrow amount: Amount of USDC borrowed
- LTV: Current loan-to-value ratio
- Health Factor: Risk metric (liquidation threshold)
- Liquidation Price: The price at which liquidation occurs
Understanding Health Factor
The health factor is the most critical metric for loan positions:- > 2.0: Healthy position (displayed with dark background)
- 1.2 - 2.0: Moderate risk (displayed with gray background)
- < 1.2: High risk (displayed with red background)
- < 1.0: Liquidation will occur
Position Loading Flow
The complete position loading sequence:Fetch Aave Data
- Call
getUserAccountDataon Aave Pool - Get reserve token addresses from Protocol Data Provider
- Query aToken and debt token balances
- Fetch computed summary from backend parity logic
Error Handling
Common Issues
“Invalid wallet index”- The index parameter is not a valid positive integer
- Navigate back to the scanner and select a valid wallet
- Click the “Connect Wallet” button in the top right
- Ensure you’re using the EOA that created the loan wallets
- The position data requires reading from a specific chain
- Approve the network switch request in your wallet
- If the switch fails, manually switch networks in your wallet
- The selected chain is not supported by Borrow Recovery
- Select a different chain from the dropdown
Stale Data Prevention
The app uses request IDs to prevent race conditions when switching chains rapidly:Next Steps
Once positions are loaded:- Review your health factor and loan metrics
- Check if the Kernel wallet has sufficient gas
- Execute rescue operations to manage your position
Code Reference
- Wallet detail page:
app/wallet/[index]/page.tsx - Aave backend logic:
lib/protocols/aaveBackendParity.ts - Morpho backend logic:
lib/protocols/morphoBackendParity.ts - Protocol encoders/decoders:
lib/protocols/aave.ts,lib/protocols/morpho.ts