This project allows you to swap your collateral on Compound, without having to migrate to a smart wallet. Smart wallets like Instadapp and DefiSaver already allow you to do collateral swaps, however they require you to migrate your Compound position into their smart wallet to access those features. This project uses flash loans to allow you to do collateral swaps without having to migrate your position. This makes it easier and faster to swap collateral.

Compound Swaps showcase

How it's made

This project uses Solidity for the contracts to perform the swaps, and Hardhat/TypeScript for the dev environment to write the contracts. Next.js/TypeScript is used for the frontend, along with Ethers.js. The contract interacts with Uniswap V3 for flash loan liquidity, and Compound for supplying/withdrawing the CTokens. The contract can interact with any DEX, in the frontend I'm using the 1inch API to fetch the swap calldata. The 0x API can be used as well.

Technologies used