emptyVaultfeature can be used to once we are done using a vault for a specific collateral and we wish to repay all debts for the collateral and withdraw our collateral balance without any additional capital.
Note: You should use
withdrawinstead if the vault you wish to close does not have any outstanding debt.
EmptyVaultcall does the following:
- 1.Flash loan some collateral
- 2.Use an aggregator to swap loaned collateral for PAR
- 3.Use swapped PAR to repay any outstanding vault debt
- 4.Withdraw collateral from vault
Note: There will likely be some leftover PAR from repaying the vault debt since we don't know exactly how much PAR we will get from a swap. The vault will still technically exist after calling
emptyVault; it will just have zero collateral balance and zero vault debt.