|
| 1 | +# Liquidator |
| 2 | + |
| 3 | +Liquidator contract is the only publicly accessible interface for liquidations in the core pool. |
| 4 | + |
| 5 | +Liquidator contract was introduced in [VIP-64](https://app.venus.io/governance/proposal/64) so that the protocol could capture a part of the liquidation revenue. It has a unified interface for VAI, BNB and BEP-20 token liquidations. |
| 6 | + |
| 7 | +## liquidateBorrow |
| 8 | + |
| 9 | +``` |
| 10 | +function liquidateBorrow( |
| 11 | + address vToken, |
| 12 | + address borrower, |
| 13 | + uint256 repayAmount, |
| 14 | + VToken vTokenCollateral |
| 15 | +) external payable; |
| 16 | +``` |
| 17 | + |
| 18 | +Liquidates a borrow and splits the seized amount between treasury and liquidator. The liquidators should use this interface instead of calling `vToken.liquidateBorrow(...)` directly. Reverts on errors. |
| 19 | + |
| 20 | +Note: For BNB borrows `msg.value` must be equal to repayAmount; for all other borrows msg.value must be zero. |
| 21 | + |
| 22 | +To use this function, the liquidator has to `approve` the underlying asset to Liquidator (unless the underlying asset is BNB). |
| 23 | + |
| 24 | +#### Parameters |
| 25 | + |
| 26 | +| Name | Type | Description | |
| 27 | +| ---- | ---- | ----------- | |
| 28 | +| `vToken` | address | Borrowed vToken (or VAIUnitroller for VAI) | |
| 29 | +| `borrower` | address | The address of the borrower | |
| 30 | +| `repayAmount` | uint256 | The amount to repay on behalf of the borrower | |
| 31 | +| `vTokenCollateral` | address | The collateral vToken to seize | |
| 32 | + |
| 33 | +## setTreasuryPercent |
| 34 | + |
| 35 | +``` |
| 36 | +function setTreasuryPercent( |
| 37 | + uint256 newTreasuryPercentMantissa |
| 38 | +) external onlyAdmin; |
| 39 | +``` |
| 40 | + |
| 41 | +Sets the new percent of the seized amount that goes to treasury. Should be less than or equal to `comptroller.liquidationIncentiveMantissa() - 1e18`. |
| 42 | + |
| 43 | +Only callable by the admin (Governance). |
| 44 | + |
| 45 | +#### Parameters |
| 46 | + |
| 47 | +| Name | Type | Description | |
| 48 | +| ---- | ---- | ----------- | |
| 49 | +| `newTreasuryPercentMantissa` | uint256 | New treasury percent (scaled by 10^18). | |
| 50 | + |
| 51 | +## _setPendingAdmin, _acceptAdmin |
| 52 | + |
| 53 | +The admin is updated via the regular [two-step procedure](./admins.md). `_setPendingAdmin` and `_acceptAdmin` do not return any value and revert on errors. |
0 commit comments