Collateral Swap Executor
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
Collateral Swap Executor is a DeFi tool that lets you swap one collateral asset for another within a lending position while simultaneously repaying debt and adjusting your overall health factor. It reads your current collateral balances, debt outstanding, and protocol liquidation thresholds, then constructs a multi-step transaction that withdraws collateral, routes it through a swap router (e.g., Uniswap), repays debt, and re-deposits any surplus — all in one atomic operation. This prevents partial execution and reduces gas costs compared to doing each step manually.
HOW TO USE
Connect your EVM wallet via the built-in BGWallet bridge. Paste your lending pool address (e.g., Aave, Compound), the collateral token you want to remove, and the debt token you want to repay. Enter a swap router address and the token path for the exchange. Specify the amount of collateral to swap and your slippage tolerance. Click "Fetch position" to see your current health factor, collateral balance, and estimated swap output. Review the new debt projection, then click "Execute swap" to sign and broadcast the transaction. The tool handles approvals if needed and provides a transaction hash for tracking.
TECHNICAL MECHANISM
The tool constructs a batch of contract calls using a lending pool's withdraw function, a router's swapExactTokensForTokens (or similar), and a repay function on the debt token. It simulates the swap output using on-chain oracles or the router's getAmountsOut, then computes the resulting debt and health factor. The transaction is sequenced so that if any step fails (e.g., slippage exceeds tolerance), the entire operation reverts — preserving your position. The tool also checks allowances and prompts for approval transactions when necessary. It uses ethers v5.7.2 and supports any EVM chain with a compatible lending pool and router.
WHAT IT CANNOT SEE
This tool cannot predict transaction finality timing — network congestion and gas price fluctuations are outside its control. It also cannot simulate off-chain price manipulation or oracle attacks that might occur between the simulation and the actual execution. The health factor calculation is based on current on-chain data and may differ from the protocol's view if oracles update during the transaction. Always monitor the mempool and adjust slippage according to market volatility.
PLEASE NOTE
EVM chains only. This tool relies on the BGWallet connector and will not function on Solana, Tron, Starknet, SUI, TON, Aptos, Bitcoin, Cosmos, or XRP. The user is responsible for ensuring the supplied contract addresses are correct and that the lending pool supports the token operations described.