Liquidation

In return for repaying the loan, liquidators receive a discounted amount of the borrower's collateral, represented by tToken.The formula to calculate the discounted tToken amount is as follows:

discounted tToken amount = repay amount * liquidation incentive * (price of borrowed token / price of collateral token) / exchange rate

The liquidators is then transferred tTokens, which they may redeem the same as if they had supplied the asset themselves. Now, liquidation incentive is 1.08.

TErc20

function liquidateBorrow(address borrower, uint amount, address tTokenCollateral) returns (uint) msg.sender: The account which shall liquidate the borrower by repaying their debt and seizing their collateral.borrower: The account with a health factor less than 1 that shall be liquidated.repayAmount: The amount of the borrowed asset to be repaid and converted into collateral, specified in units of the underlying borrowed asset.tTokenCollateral: The address of the tToken currently held as collateral by a borrower, that the liquidator shall seize.RETURN: 0 on success. Before supplying an asset, users must first approve the tToken to access their token balance.

Tether

function liquidateBorrow(address borrower, address tTokenCollateral) payable msg.value: The amount of ether to be repaid and converted into collateral, in wei.msg.sender: The account which shall liquidate the borrower by repaying their debt and seizing their collateral.borrower: The account with a heath factor less than 1 that shall be liquidated.tTokenCollateral: The address of the tToken currently held as collateral by a borrower, that the liquidator shall seize.RETURN: No return, reverts on error.

Solidity

// Instantiate an instance of the tEther contract with the specified addressITEther tEther = ITEther(0xTEther); // Instantiate an instance of the tToken contract with the specified addressIErc20 tToken = ITToken(0xTToken); // Repay the borrowed amount of tEther to liquidate the borrower and obtain collateraltEther.liquidateBorrow{value: repayAmount}(borrower, collateral); // Repay the borrowed amount of tToken to liquidate the borrower and obtain collateraltToken.liquidateBorrow(borrower, repayAmount, collateral);

Web3 1.0

const tEther = TEther.at(0xTEther...);await tEther.methods.liquidateBorrow(borrower, collateral).send({from: myAccount, value: repayAmount}; const tToken = TErc20.at(0xTToken...);await tToken.methods.liquidateBorrow(borrower, repayAmount, collateral).send({from: myAccount});

Last updated