Liquidator
The Liquidator contract is responsible for liquidating underwater accounts.
Address of vBNB contract.
contract IVBNB vBnb
Address of Venus Unitroller contract.
contract IComptroller comptroller
Address of VAIUnitroller contract.
contract IVAIController vaiController
Address of Venus Treasury.
address treasury
Percent of seized amount that goes to treasury.
uint256 treasuryPercentMantissa
Mapping of addresses allowed to liquidate an account if liquidationRestricted[borrower] == true
mapping(address => mapping(address => bool)) allowedLiquidatorsByAccount
Whether the liquidations are restricted to enabled allowedLiquidatorsByAccount addresses only
mapping(address => bool) liquidationRestricted
Constructor for the implementation contract. Sets immutable variables.
constructor(address comptroller_, address payable vBnb_, address treasury_) public
Parameters
Name | Type | Description |
---|---|---|
comptroller_ | address | The address of the Comptroller contract |
vBnb_ | address payable | The address of the VBNB |
treasury_ | address | The address of Venus treasury |
Initializer for the implementation contract.
function initialize(uint256 treasuryPercentMantissa_) external virtual
Parameters
Name | Type | Description |
---|---|---|
treasuryPercentMantissa_ | uint256 | Treasury share, scaled by 1e18 (e.g. 0.2 * 1e18 for 20%) |
An admin function to restrict liquidations to allowed addresses only.
function restrictLiquidation(address borrower) external
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
An admin function to remove restrictions for liquidations.
function unrestrictLiquidation(address borrower) external
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
An admin function to add the liquidator to the allowedLiquidatorsByAccount mapping for a certain borrower. If the liquidations are restricted, only liquidators from the allowedLiquidatorsByAccount mapping can participate in liquidating the positions of this borrower.
function addToAllowlist(address borrower, address liquidator) external
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
liquidator | address | |
An admin function to remove the liquidator from the allowedLiquidatorsByAccount mapping of a certain borrower. If the liquidations are restricted, this liquidator will not be able to liquidate the positions of this borrower.
function removeFromAllowlist(address borrower, address liquidator) external
Parameters
Name | Type | Description |
---|---|---|
borrower | address | The address of the borrower |
liquidator | address | |
Liquidates a borrow and splits the seized amount between treasury and liquidator. The liquidators should use this interface instead of calling vToken.liquidateBorrow(...) directly. For BNB borrows msg.value should be equal to repayAmount; otherwise msg.value should be zero.
function liquidateBorrow(address vToken, address borrower, uint256 repayAmount, contract IVToken vTokenCollateral) external payable
Parameters
Name | Type | Description |
---|---|---|
vToken | address | Borrowed vToken |
borrower | address | The address of the borrower |
repayAmount | uint256 | The amount to repay on behalf of the borrower |
vTokenCollateral | contract IVToken | The collateral to seize |
Sets the new percent of the seized amount that goes to treasury. Should be less than or equal to comptroller.liquidationIncentiveMantissa().sub(1e18).
function setTreasuryPercent(uint256 newTreasuryPercentMantissa) external
Parameters
Name | Type | Description |
---|---|---|
newTreasuryPercentMantissa | uint256 | New treasury percent (scaled by 10^18). |
Last modified 2mo ago