Rosario Borgesi pfp
Rosario Borgesi

@rosarioborgesi

Here is the `liquidate()` function I implemented in the lending protocol of the SpeedrunEthereum challenge (ETH collateral, CORN debt). Here’s the reasoning behind it 👇 1) Liquidation is only allowed when a position becomes unsafe (collateral ratio falls below 120%). 2) The liquidator repays the borrower’s outstanding debt in CORN. 3) In exchange, the liquidator receives ETH collateral from the protocol. 4) The liquidator earns a 10% reward on the seized ETH collateral. 5) Everything happens atomically. If anything goes wrong, the entire transaction reverts.
0 reply
0 recast
0 reaction