A borrower account has Dai collateral and an open WBTC borrow. It has become under-collateralized. I can seize their cDai by liquidating their WBTC borrow. I have a balance of WBTC. I call approve on cWBTC and pass the amount of WBTC that I want to repay (or greater). I then call liquidateBorrow on cWBTC and pass the borrower address, amount of WBTC to liquidate, and the cDai address. If the liquidation is successful, my WBTC balance goes down and my cDai balance goes up. If I redeem that cDai immediately, the underlying Dai is worth the same amount as the amount of WBTC I gave up plus 8%.
Created
March 16, 2022 19:45
-
-
Save ajb413/45ba3ac84bab5037e9e9cadba99a052b to your computer and use it in GitHub Desktop.
A Compound v2 Liquidation Example
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment