Recent exploits of the Fulcrum protocol have given flash loans somewhat of a bad name in the community, but the truth is they can be used for far more convenient things than exploits. There are at least a dozen ideas floating around currently, and we’re very proud to introduce some of them into DeFi Saver.
Flash loans are an incredible development. They allow you to borrow as much funds as available within a certain pool and do whatever you want with them, as long as you fulfill one special condition — you need to return the full amount within the same transaction. In case you don’t, everything you attempted within the transaction will fail and revert, like it never happened.
Some argue flash loans are no good and shouldn’t be a thing, probably influenced by recent exploits we witnessed. But we feel the truth is they only level the playground, making any exploitable points accessible to anyone, rather than just the whales. And, what’s more, they enable some very cool things, so let’s talk about those.
1-transaction CDP closing powered by flash loans
The idea of one-tx CDP deleveraging (sometimes also called self-liquidation) is that you get to pay back all of your debt with the collateral contained within the CDP, effectively closing the collateralized debt position. This mechanism could be used either as a stop-loss, to prevent the need to continuously unwind one’s position (i.e. Repay) during a downward market trend, or as a way to close the position and collect profits after a bull run, the choice is up to you and the market gods.
The exact steps for closing a CDP with a flash loan are as follows:
- Take out a DAI flash loan equal to current CDP debt
- Pay back DAI CDP debt using that DAI
- Withdraw ETH/BAT from the CDP
- Convert required amount of ETH/BAT using a DEX to DAI for flash loan debt
- Pay back DAI flash loan debt
- Withdraw remaining ETH/BAT to account
And if you look at the screenshot of all the token transfers that happen during this process, you can probably recognise most of these steps, all of which are completed within the same transaction:
But you don’t have to bother too much, because this option is available as a single transaction feature in the DeFi Saver MakerDAO dashboard starting today.😎
All you need to do in case you want to close your CDP using the collateral within is click the button in the top right corner and confirm the transaction.
The Minimum accepted ETH option you see in the dialogue is basically a slippage limiter for CDP closing, meaning you should simply enter the least amount of ETH you are willing to accept. If the transaction ends up with less than that, it will fail and revert. On the other hand, any ETH remaining over the configured minimum will be added to your received amount.
Please note that this process includes a 0.25% DeFi Saver service fee, as well as a 0.09% Aave flash loan fee.
Extended Repay and Boost
Another update we’re introducing for MakerDAO users today is extended Repay and Boost. Extended Repay is a feature improvement that will allow you to repay a much larger part of your debt, even when your position is close to the minimum 150% collateralization ratio. This was previously not possible with simple CDP unwinding, because the CDP’s ratio cannot ever be pushed below the minimum ratio purposefully.
It’s a very similar story with Boost, with our standard method being limited by the 150% ratio, but taking out a flash loan to reduce debt past that limit allows for Extended Boost.
Despite the greater flexibility allowed by flash loans, please note that our standard Boost and Repay will still be used whenever applicable, as they include less steps and therefore minimize losses.
All of the mentioned features are now available in the DeFi Saver MakerDAO dashboard. One of our next goals is to have the Close CDP option available within CDP Automation, make sure to follow us on twitter or join the discord so you don’t miss that!