A user who has negative account liquidity is subject to liquidation by other users of the protocol to return his/her account liquidity back to positive (i.e. above the collateral requirement). When a liquidation occurs, a liquidator may repay some or all of an outstanding borrow on behalf of a borrower and in return receive a discounted amount of collateral held by the borrower; this discount is defined as the liquidation incentive.
A liquidator may close up to a certain fixed percentage (i.e. close factor) of any individual outstanding borrow of the underwater account. Unlike in v1, liquidators must interact with each aToken contract in which they wish to repay a borrow and seize another asset as collateral. When collateral is seized, the liquidator is transferred aTokens, which they may redeem the same as if they had supplied the asset themselves. Users must approve each aToken contract before calling liquidate (i.e. on the borrowed asset which they are repaying), as they are transferring funds into the contract.
function liquidateBorrow(address borrower, uint amount, address collateral) returns (uint)
msg.sender: The account which shall liquidate the borrower by repaying their debt and seizing their collateral.