@venusprotocol/venus-protocol 5.1.0-dev.2 → 5.1.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/@openzeppelin/contracts/access/IAccessControl.sol/IAccessControl.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/access/Ownable2Step.sol/Ownable2Step.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol/IERC20Permit.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol/ReentrancyGuardUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol/IERC20MetadataUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol/IERC20PermitUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol/SafeERC20Upgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +1 -1
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol/AccessControlledV8.dbg.json +1 -1
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV8.sol/IAccessControlManagerV8.dbg.json +1 -1
- package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/BoundValidatorInterface.dbg.json +1 -1
- package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/OracleInterface.dbg.json +1 -1
- package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/ResilientOracleInterface.dbg.json +1 -1
- package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/TwapInterface.dbg.json +1 -1
- package/artifacts/build-info/bef6b5a62efc5de19d5510cf7f208c2e.json +1 -0
- package/artifacts/contracts/Admin/VBNBAdmin.sol/VBNBAdmin.dbg.json +1 -1
- package/artifacts/contracts/Admin/VBNBAdminStorage.sol/IProtocolShareReserve.dbg.json +1 -1
- package/artifacts/contracts/Admin/VBNBAdminStorage.sol/IWBNB.dbg.json +1 -1
- package/artifacts/contracts/Admin/VBNBAdminStorage.sol/VBNBAdminStorage.dbg.json +1 -1
- package/artifacts/contracts/Admin/VBNBAdminStorage.sol/VTokenInterface.dbg.json +1 -1
- package/artifacts/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IComptroller.dbg.json +1 -1
- package/artifacts/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IPriceOracle.dbg.json +1 -1
- package/artifacts/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IVToken.dbg.json +1 -1
- package/artifacts/contracts/DelegateBorrowers/SwapDebtDelegate.sol/SwapDebtDelegate.dbg.json +1 -1
- package/artifacts/contracts/Liquidator/BUSDLiquidator.sol/BUSDLiquidator.dbg.json +4 -0
- package/artifacts/contracts/Liquidator/BUSDLiquidator.sol/BUSDLiquidator.json +324 -0
- package/artifacts/contracts/Liquidator/Interfaces.sol/IComptroller.dbg.json +1 -1
- package/artifacts/contracts/Liquidator/Interfaces.sol/IComptroller.json +36 -0
- package/artifacts/contracts/Liquidator/Interfaces.sol/ILiquidator.dbg.json +4 -0
- package/artifacts/contracts/Liquidator/Interfaces.sol/ILiquidator.json +127 -0
- package/artifacts/contracts/Liquidator/Interfaces.sol/IVAIController.dbg.json +1 -1
- package/artifacts/contracts/Liquidator/Interfaces.sol/IVBNB.dbg.json +1 -1
- package/artifacts/contracts/Liquidator/Interfaces.sol/IVBNB.json +20 -1
- package/artifacts/contracts/Liquidator/Interfaces.sol/IVBep20.dbg.json +1 -1
- package/artifacts/contracts/Liquidator/Interfaces.sol/IVBep20.json +20 -1
- package/artifacts/contracts/Liquidator/Interfaces.sol/IVToken.dbg.json +1 -1
- package/artifacts/contracts/Liquidator/Interfaces.sol/IVToken.json +20 -1
- package/artifacts/contracts/Liquidator/Liquidator.sol/Liquidator.dbg.json +1 -1
- package/artifacts/contracts/Liquidator/Liquidator.sol/Liquidator.json +2 -2
- package/artifacts/contracts/PegStability/IVAI.sol/IVAI.dbg.json +1 -1
- package/artifacts/contracts/PegStability/PegStability.sol/PegStability.dbg.json +1 -1
- package/artifacts/contracts/Swap/IRouterHelper.sol/IRouterHelper.dbg.json +1 -1
- package/artifacts/contracts/Swap/RouterHelper.sol/RouterHelper.dbg.json +1 -1
- package/artifacts/contracts/Swap/SwapRouter.sol/SwapRouter.dbg.json +1 -1
- package/artifacts/contracts/Swap/interfaces/IPancakePair.sol/IPancakePair.dbg.json +1 -1
- package/artifacts/contracts/Swap/interfaces/IPancakeSwapV2Factory.sol/IPancakeSwapV2Factory.dbg.json +1 -1
- package/artifacts/contracts/Swap/interfaces/IPancakeSwapV2Router.sol/IPancakeSwapV2Router.dbg.json +1 -1
- package/artifacts/contracts/Swap/interfaces/IVBNB.sol/IVBNB.dbg.json +1 -1
- package/artifacts/contracts/Swap/interfaces/IVtoken.sol/IVToken.dbg.json +1 -1
- package/artifacts/contracts/Swap/interfaces/IWBNB.sol/IWBNB.dbg.json +1 -1
- package/artifacts/contracts/Swap/interfaces/InterfaceComptroller.sol/InterfaceComptroller.dbg.json +1 -1
- package/artifacts/contracts/Swap/lib/PancakeLibrary.sol/PancakeLibrary.dbg.json +1 -1
- package/artifacts/contracts/Swap/lib/TransferHelper.sol/TransferHelper.dbg.json +1 -1
- package/artifacts/contracts/test/LiquidatorHarness.sol/LiquidatorHarness.dbg.json +1 -1
- package/artifacts/contracts/test/LiquidatorHarness.sol/LiquidatorHarness.json +2 -2
- package/contracts/Liquidator/BUSDLiquidator.sol +184 -0
- package/contracts/Liquidator/Interfaces.sol +43 -1
- package/contracts/Liquidator/Liquidator.sol +3 -11
- package/contracts/Liquidator/approveOrRevert.sol +28 -0
- package/contracts/Liquidator/constants.sol +5 -0
- package/contracts/Liquidator/zeroAddress.sol +11 -0
- package/dist/typechain/contracts/Liquidator/BUSDLiquidator.d.ts +264 -0
- package/dist/typechain/contracts/Liquidator/BUSDLiquidator.js +3 -0
- package/dist/typechain/contracts/Liquidator/Interfaces.sol/IComptroller.d.ts +31 -3
- package/dist/typechain/contracts/Liquidator/Interfaces.sol/ILiquidator.d.ts +143 -0
- package/dist/typechain/contracts/Liquidator/Interfaces.sol/ILiquidator.js +3 -0
- package/dist/typechain/contracts/Liquidator/Interfaces.sol/IVBNB.d.ts +22 -6
- package/dist/typechain/contracts/Liquidator/Interfaces.sol/IVBep20.d.ts +22 -6
- package/dist/typechain/contracts/Liquidator/Interfaces.sol/IVToken.d.ts +22 -6
- package/dist/typechain/contracts/Liquidator/Interfaces.sol/index.d.ts +1 -0
- package/dist/typechain/contracts/Liquidator/index.d.ts +1 -0
- package/dist/typechain/factories/contracts/Liquidator/BUSDLiquidator__factory.d.ts +264 -0
- package/dist/typechain/factories/contracts/Liquidator/BUSDLiquidator__factory.js +353 -0
- package/dist/typechain/factories/contracts/Liquidator/Interfaces.sol/IComptroller__factory.d.ts +28 -0
- package/dist/typechain/factories/contracts/Liquidator/Interfaces.sol/IComptroller__factory.js +36 -0
- package/dist/typechain/factories/contracts/Liquidator/Interfaces.sol/ILiquidator__factory.d.ts +98 -0
- package/dist/typechain/factories/contracts/Liquidator/Interfaces.sol/ILiquidator__factory.js +133 -0
- package/dist/typechain/factories/contracts/Liquidator/Interfaces.sol/IVBNB__factory.d.ts +15 -1
- package/dist/typechain/factories/contracts/Liquidator/Interfaces.sol/IVBNB__factory.js +20 -1
- package/dist/typechain/factories/contracts/Liquidator/Interfaces.sol/IVBep20__factory.d.ts +15 -1
- package/dist/typechain/factories/contracts/Liquidator/Interfaces.sol/IVBep20__factory.js +20 -1
- package/dist/typechain/factories/contracts/Liquidator/Interfaces.sol/IVToken__factory.d.ts +15 -1
- package/dist/typechain/factories/contracts/Liquidator/Interfaces.sol/IVToken__factory.js +20 -1
- package/dist/typechain/factories/contracts/Liquidator/Interfaces.sol/index.d.ts +1 -0
- package/dist/typechain/factories/contracts/Liquidator/Interfaces.sol/index.js +3 -1
- package/dist/typechain/factories/contracts/Liquidator/Liquidator__factory.d.ts +1 -1
- package/dist/typechain/factories/contracts/Liquidator/Liquidator__factory.js +1 -1
- package/dist/typechain/factories/contracts/Liquidator/index.d.ts +1 -0
- package/dist/typechain/factories/contracts/Liquidator/index.js +3 -1
- package/dist/typechain/factories/contracts/test/LiquidatorHarness__factory.d.ts +1 -1
- package/dist/typechain/factories/contracts/test/LiquidatorHarness__factory.js +1 -1
- package/dist/typechain/index.d.ts +4 -0
- package/dist/typechain/index.js +8 -4
- package/package.json +1 -1
- package/artifacts/build-info/6dd0842f1ff5cc6ec93b0e1b7e8d3053.json +0 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
|
+
|
|
4
|
+
import { SafeERC20Upgradeable, IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
|
|
5
|
+
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
|
|
6
|
+
import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
|
|
7
|
+
|
|
8
|
+
import { MANTISSA_ONE } from "./constants.sol";
|
|
9
|
+
import { ensureNonzeroAddress } from "./zeroAddress.sol";
|
|
10
|
+
import { approveOrRevert } from "./approveOrRevert.sol";
|
|
11
|
+
import { ILiquidator, IComptroller, IVToken, IVBep20, IVBNB, IVAIController } from "./Interfaces.sol";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @title BUSDLiquidator
|
|
15
|
+
* @author Venus
|
|
16
|
+
* @notice A custom contract for force-liquidating BUSD debts
|
|
17
|
+
*/
|
|
18
|
+
contract BUSDLiquidator is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable {
|
|
19
|
+
using SafeERC20Upgradeable for IERC20Upgradeable;
|
|
20
|
+
using SafeERC20Upgradeable for IVToken;
|
|
21
|
+
|
|
22
|
+
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
23
|
+
IVBep20 public immutable vBUSD;
|
|
24
|
+
|
|
25
|
+
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
26
|
+
IComptroller public immutable comptroller;
|
|
27
|
+
|
|
28
|
+
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
29
|
+
address public immutable treasury;
|
|
30
|
+
|
|
31
|
+
/// @notice The liquidator's share, scaled by 1e18 (e.g. 1.02 * 1e18 for 102% of the debt covered)
|
|
32
|
+
uint256 public liquidatorShareMantissa;
|
|
33
|
+
|
|
34
|
+
/// @notice Thrown if trying to set liquidator's share lower than 100% of the debt covered
|
|
35
|
+
error LiquidatorShareTooLow(uint256 liquidatorShareMantissa_);
|
|
36
|
+
|
|
37
|
+
/// @notice Thrown if trying to set liquidator's share larger than this contract can receive from a liquidation
|
|
38
|
+
error LiquidatorShareTooHigh(uint256 maxLiquidatorShareMantissa, uint256 liquidatorShareMantissa_);
|
|
39
|
+
|
|
40
|
+
/// @notice Emitted when the liquidator's share is set
|
|
41
|
+
event NewLiquidatorShare(uint256 oldLiquidatorShareMantissa, uint256 newLiquidatorShareMantissa);
|
|
42
|
+
|
|
43
|
+
/// @notice Constructor for the implementation contract. Sets immutable variables.
|
|
44
|
+
/// @param comptroller_ The address of the Comptroller contract
|
|
45
|
+
/// @param vBUSD_ The address of the VBNB
|
|
46
|
+
/// @param treasury_ The address of Venus treasury
|
|
47
|
+
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
48
|
+
constructor(address comptroller_, address vBUSD_, address treasury_) {
|
|
49
|
+
ensureNonzeroAddress(vBUSD_);
|
|
50
|
+
ensureNonzeroAddress(comptroller_);
|
|
51
|
+
ensureNonzeroAddress(treasury_);
|
|
52
|
+
vBUSD = IVBep20(vBUSD_);
|
|
53
|
+
comptroller = IComptroller(comptroller_);
|
|
54
|
+
treasury = treasury_;
|
|
55
|
+
_disableInitializers();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/// @notice Initializer for the implementation contract.
|
|
59
|
+
/// @param liquidatorShareMantissa_ Liquidator's share, scaled by 1e18 (e.g. 1.01 * 1e18 for 101%)
|
|
60
|
+
/// @custom:error LiquidatorShareTooHigh is thrown if trying to set liquidator percent larger than the liquidation profit
|
|
61
|
+
function initialize(uint256 liquidatorShareMantissa_) external virtual initializer {
|
|
62
|
+
__Ownable2Step_init();
|
|
63
|
+
__ReentrancyGuard_init();
|
|
64
|
+
_validateLiquidatorShareMantissa(liquidatorShareMantissa_);
|
|
65
|
+
liquidatorShareMantissa = liquidatorShareMantissa_;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// @notice Liquidate the entire BUSD debt of a borrower, seizing vTokenCollateral
|
|
69
|
+
/// @param borrower The borrower whose debt should be liquidated
|
|
70
|
+
/// @param vTokenCollateral The collateral to seize from the borrower
|
|
71
|
+
function liquidateEntireBorrow(address borrower, IVToken vTokenCollateral) external nonReentrant {
|
|
72
|
+
uint256 repayAmount = vBUSD.borrowBalanceCurrent(borrower);
|
|
73
|
+
_unpauseAndLiquidate(borrower, repayAmount, vTokenCollateral);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/// @notice Liquidate a BUSD borrow, repaying the repayAmount of BUSD
|
|
77
|
+
/// @param borrower The borrower whose debt should be liquidated
|
|
78
|
+
/// @param repayAmount The amount to repay
|
|
79
|
+
/// @param vTokenCollateral The collateral to seize from the borrower
|
|
80
|
+
function liquidateBorrow(address borrower, uint256 repayAmount, IVToken vTokenCollateral) external nonReentrant {
|
|
81
|
+
_unpauseAndLiquidate(borrower, repayAmount, vTokenCollateral);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/// @notice Allows Governance to set the liquidator's share
|
|
85
|
+
/// @param liquidatorShareMantissa_ Liquidator's share, scaled by 1e18 (e.g. 1.01 * 1e18 for 101%)
|
|
86
|
+
/// @custom:access Only Governance
|
|
87
|
+
function setLiquidatorShare(uint256 liquidatorShareMantissa_) external onlyOwner {
|
|
88
|
+
_validateLiquidatorShareMantissa(liquidatorShareMantissa_);
|
|
89
|
+
uint256 oldLiquidatorShareMantissa = liquidatorShareMantissa;
|
|
90
|
+
liquidatorShareMantissa = liquidatorShareMantissa_;
|
|
91
|
+
emit NewLiquidatorShare(oldLiquidatorShareMantissa, liquidatorShareMantissa_);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/// @notice Allows to recover token accidentally sent to this contract by sending the entire balance to Governance
|
|
95
|
+
/// @param token The address of the token to recover
|
|
96
|
+
/// @custom:access Only Governance
|
|
97
|
+
function sweepToken(IERC20Upgradeable token) external onlyOwner {
|
|
98
|
+
token.safeTransfer(msg.sender, token.balanceOf(address(this)));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/// @dev Unpauses the liquidation on the BUSD market, liquidates the borrower's debt,
|
|
102
|
+
/// and pauses the liquidations back
|
|
103
|
+
/// @param borrower The borrower whose debt should be liquidated
|
|
104
|
+
/// @param repayAmount The amount to repay
|
|
105
|
+
/// @param vTokenCollateral The collateral to seize from the borrower
|
|
106
|
+
function _unpauseAndLiquidate(address borrower, uint256 repayAmount, IVToken vTokenCollateral) internal {
|
|
107
|
+
address[] memory vTokens = new address[](1);
|
|
108
|
+
vTokens[0] = address(vBUSD);
|
|
109
|
+
IComptroller.Action[] memory actions = new IComptroller.Action[](1);
|
|
110
|
+
actions[0] = IComptroller.Action.LIQUIDATE;
|
|
111
|
+
|
|
112
|
+
comptroller._setActionsPaused(vTokens, actions, false);
|
|
113
|
+
_liquidateBorrow(borrower, repayAmount, vTokenCollateral);
|
|
114
|
+
comptroller._setActionsPaused(vTokens, actions, true);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/// @dev Performs the actual liquidation, transferring BUSD from the sender to this contract,
|
|
118
|
+
/// repaying the debt, and transferring the seized collateral to the sender and the treasury
|
|
119
|
+
/// @param borrower The borrower whose debt should be liquidated
|
|
120
|
+
/// @param repayAmount The amount to repay
|
|
121
|
+
/// @param vTokenCollateral The collateral to seize from the borrower
|
|
122
|
+
function _liquidateBorrow(address borrower, uint256 repayAmount, IVToken vTokenCollateral) internal {
|
|
123
|
+
ILiquidator liquidatorContract = ILiquidator(comptroller.liquidatorContract());
|
|
124
|
+
IERC20Upgradeable busd = IERC20Upgradeable(vBUSD.underlying());
|
|
125
|
+
|
|
126
|
+
uint256 actualRepayAmount = _transferIn(busd, msg.sender, repayAmount);
|
|
127
|
+
approveOrRevert(busd, address(liquidatorContract), actualRepayAmount);
|
|
128
|
+
uint256 balanceBefore = vTokenCollateral.balanceOf(address(this));
|
|
129
|
+
liquidatorContract.liquidateBorrow(address(vBUSD), borrower, actualRepayAmount, vTokenCollateral);
|
|
130
|
+
uint256 receivedAmount = vTokenCollateral.balanceOf(address(this)) - balanceBefore;
|
|
131
|
+
approveOrRevert(busd, address(liquidatorContract), 0);
|
|
132
|
+
|
|
133
|
+
(uint256 liquidatorAmount, uint256 treasuryAmount) = _computeShares(receivedAmount);
|
|
134
|
+
vTokenCollateral.safeTransfer(msg.sender, liquidatorAmount);
|
|
135
|
+
vTokenCollateral.safeTransfer(treasury, treasuryAmount);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/// @dev Transfers tokens to this contract and returns the actual transfer amount
|
|
139
|
+
/// @param token The token to transfer
|
|
140
|
+
/// @param from The account to transfer from
|
|
141
|
+
/// @param amount The amount to transfer
|
|
142
|
+
/// @return The actual amount transferred
|
|
143
|
+
function _transferIn(IERC20Upgradeable token, address from, uint256 amount) internal returns (uint256) {
|
|
144
|
+
uint256 prevBalance = token.balanceOf(address(this));
|
|
145
|
+
token.safeTransferFrom(from, address(this), amount);
|
|
146
|
+
return token.balanceOf(address(this)) - prevBalance;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/// @dev Computes the liquidator's and treasury's shares of the received amount
|
|
150
|
+
/// @param receivedAmount The amount received from the liquidation
|
|
151
|
+
/// @return liquidatorAmount The liquidator's share
|
|
152
|
+
/// @return treasuryAmount The treasury's share
|
|
153
|
+
function _computeShares(
|
|
154
|
+
uint256 receivedAmount
|
|
155
|
+
) internal view returns (uint256 liquidatorAmount, uint256 treasuryAmount) {
|
|
156
|
+
uint256 denominator = _getDenominator();
|
|
157
|
+
liquidatorAmount = (receivedAmount * liquidatorShareMantissa) / denominator;
|
|
158
|
+
treasuryAmount = receivedAmount - liquidatorAmount;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/// @dev Returns (liquidation incentive - treasury percent), the value used as the denominator
|
|
162
|
+
/// when calculating the liquidator's share
|
|
163
|
+
/// @return The denominator for the seized amount used when calculating the liquidator's share
|
|
164
|
+
function _getDenominator() internal view returns (uint256) {
|
|
165
|
+
uint256 totalPercentageToDistribute = comptroller.liquidationIncentiveMantissa();
|
|
166
|
+
uint256 regularTreasuryPercent = ILiquidator(comptroller.liquidatorContract()).treasuryPercentMantissa();
|
|
167
|
+
uint256 denominator = totalPercentageToDistribute - regularTreasuryPercent;
|
|
168
|
+
return denominator;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/// @dev Checks if the liquidator's share is more than 100% of the debt covered and less
|
|
172
|
+
/// than (liquidation incentive - treasury percent)
|
|
173
|
+
/// @param liquidatorShareMantissa_ Liquidator's share, scaled by 1e18 (e.g. 1.01 * 1e18 for 101%)
|
|
174
|
+
function _validateLiquidatorShareMantissa(uint256 liquidatorShareMantissa_) internal view {
|
|
175
|
+
uint256 maxLiquidatorShareMantissa = _getDenominator();
|
|
176
|
+
if (liquidatorShareMantissa_ < MANTISSA_ONE) {
|
|
177
|
+
revert LiquidatorShareTooLow(liquidatorShareMantissa_);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (liquidatorShareMantissa_ > maxLiquidatorShareMantissa) {
|
|
181
|
+
revert LiquidatorShareTooHigh(maxLiquidatorShareMantissa, liquidatorShareMantissa_);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
1
2
|
pragma solidity 0.8.13;
|
|
2
3
|
|
|
3
4
|
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
|
|
4
5
|
|
|
5
|
-
interface IVToken is IERC20Upgradeable {
|
|
6
|
+
interface IVToken is IERC20Upgradeable {
|
|
7
|
+
function borrowBalanceCurrent(address borrower) external returns (uint256);
|
|
8
|
+
|
|
9
|
+
function transfer(address dst, uint256 amount) external returns (bool);
|
|
10
|
+
}
|
|
6
11
|
|
|
7
12
|
interface IVBep20 is IVToken {
|
|
8
13
|
function underlying() external view returns (address);
|
|
@@ -29,7 +34,44 @@ interface IVAIController {
|
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
interface IComptroller {
|
|
37
|
+
enum Action {
|
|
38
|
+
MINT,
|
|
39
|
+
REDEEM,
|
|
40
|
+
BORROW,
|
|
41
|
+
REPAY,
|
|
42
|
+
SEIZE,
|
|
43
|
+
LIQUIDATE,
|
|
44
|
+
TRANSFER,
|
|
45
|
+
ENTER_MARKET,
|
|
46
|
+
EXIT_MARKET
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function _setActionsPaused(address[] calldata markets_, Action[] calldata actions_, bool paused_) external;
|
|
50
|
+
|
|
32
51
|
function liquidationIncentiveMantissa() external view returns (uint256);
|
|
33
52
|
|
|
34
53
|
function vaiController() external view returns (IVAIController);
|
|
54
|
+
|
|
55
|
+
function liquidatorContract() external view returns (address);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface ILiquidator {
|
|
59
|
+
function restrictLiquidation(address borrower) external;
|
|
60
|
+
|
|
61
|
+
function unrestrictLiquidation(address borrower) external;
|
|
62
|
+
|
|
63
|
+
function addToAllowlist(address borrower, address liquidator) external;
|
|
64
|
+
|
|
65
|
+
function removeFromAllowlist(address borrower, address liquidator) external;
|
|
66
|
+
|
|
67
|
+
function liquidateBorrow(
|
|
68
|
+
address vToken,
|
|
69
|
+
address borrower,
|
|
70
|
+
uint256 repayAmount,
|
|
71
|
+
IVToken vTokenCollateral
|
|
72
|
+
) external payable;
|
|
73
|
+
|
|
74
|
+
function setTreasuryPercent(uint256 newTreasuryPercentMantissa) external;
|
|
75
|
+
|
|
76
|
+
function treasuryPercentMantissa() external view returns (uint256);
|
|
35
77
|
}
|
|
@@ -5,14 +5,15 @@ import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeab
|
|
|
5
5
|
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
|
|
6
6
|
import "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { ensureNonzeroAddress } from "./zeroAddress.sol";
|
|
9
|
+
import { ILiquidator, IComptroller, IVToken, IVBep20, IVBNB, IVAIController } from "./Interfaces.sol";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @title Liquidator
|
|
12
13
|
* @author Venus
|
|
13
14
|
* @notice The Liquidator contract is responsible for liquidating underwater accounts.
|
|
14
15
|
*/
|
|
15
|
-
contract Liquidator is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable {
|
|
16
|
+
contract Liquidator is ILiquidator, Ownable2StepUpgradeable, ReentrancyGuardUpgradeable {
|
|
16
17
|
/// @notice Address of vBNB contract.
|
|
17
18
|
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
18
19
|
IVBNB public immutable vBnb;
|
|
@@ -95,9 +96,6 @@ contract Liquidator is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable {
|
|
|
95
96
|
/// intended BNB repayment
|
|
96
97
|
error WrongTransactionAmount(uint256 expected, uint256 actual);
|
|
97
98
|
|
|
98
|
-
/// @notice Thrown if the argument is a zero address because probably it is a mistake
|
|
99
|
-
error UnexpectedZeroAddress();
|
|
100
|
-
|
|
101
99
|
/// @notice Thrown if trying to set treasury percent larger than the liquidation profit
|
|
102
100
|
error TreasuryPercentTooHigh(uint256 maxTreasuryPercentMantissa, uint256 treasuryPercentMantissa_);
|
|
103
101
|
|
|
@@ -307,12 +305,6 @@ contract Liquidator is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable {
|
|
|
307
305
|
revert LiquidationFailed(errCode);
|
|
308
306
|
}
|
|
309
307
|
|
|
310
|
-
function ensureNonzeroAddress(address address_) internal pure {
|
|
311
|
-
if (address_ == address(0)) {
|
|
312
|
-
revert UnexpectedZeroAddress();
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
308
|
function checkRestrictions(address borrower, address liquidator) internal view {
|
|
317
309
|
if (liquidationRestricted[borrower] && !allowedLiquidatorsByAccount[borrower][liquidator]) {
|
|
318
310
|
revert LiquidationNotAllowed(borrower, liquidator);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity 0.8.13;
|
|
4
|
+
|
|
5
|
+
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
|
|
6
|
+
|
|
7
|
+
/// @notice Thrown if a contract is unable to approve a transfer
|
|
8
|
+
error ApproveFailed();
|
|
9
|
+
|
|
10
|
+
/// @notice Approves a transfer, ensuring that it is successful. This function supports non-compliant
|
|
11
|
+
/// tokens like the ones that don't return a boolean value on success. Thus, such approve call supports
|
|
12
|
+
/// three different kinds of tokens:
|
|
13
|
+
/// * Compliant tokens that revert on failure
|
|
14
|
+
/// * Compliant tokens that return false on failure
|
|
15
|
+
/// * Non-compliant tokens that don't return a value
|
|
16
|
+
/// @param token The contract address of the token which will be transferred
|
|
17
|
+
/// @param spender The spender contract address
|
|
18
|
+
/// @param amount The value of the transfer
|
|
19
|
+
function approveOrRevert(IERC20Upgradeable token, address spender, uint256 amount) {
|
|
20
|
+
bytes memory callData = abi.encodeCall(token.approve, (spender, amount));
|
|
21
|
+
|
|
22
|
+
// solhint-disable-next-line avoid-low-level-calls
|
|
23
|
+
(bool success, bytes memory result) = address(token).call(callData);
|
|
24
|
+
|
|
25
|
+
if (!success || (result.length != 0 && !abi.decode(result, (bool)))) {
|
|
26
|
+
revert ApproveFailed();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
|
+
|
|
4
|
+
/// @notice Thrown if the argument is a zero address because probably it is a mistake
|
|
5
|
+
error UnexpectedZeroAddress();
|
|
6
|
+
|
|
7
|
+
function ensureNonzeroAddress(address address_) pure {
|
|
8
|
+
if (address_ == address(0)) {
|
|
9
|
+
revert UnexpectedZeroAddress();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from "../../common";
|
|
2
|
+
import type { FunctionFragment, Result, EventFragment } from "@ethersproject/abi";
|
|
3
|
+
import type { Listener, Provider } from "@ethersproject/providers";
|
|
4
|
+
import type { BaseContract, BigNumber, BigNumberish, BytesLike, CallOverrides, ContractTransaction, Overrides, PopulatedTransaction, Signer, utils } from "ethers";
|
|
5
|
+
export interface BUSDLiquidatorInterface extends utils.Interface {
|
|
6
|
+
functions: {
|
|
7
|
+
"acceptOwnership()": FunctionFragment;
|
|
8
|
+
"comptroller()": FunctionFragment;
|
|
9
|
+
"initialize(uint256)": FunctionFragment;
|
|
10
|
+
"liquidateBorrow(address,uint256,address)": FunctionFragment;
|
|
11
|
+
"liquidateEntireBorrow(address,address)": FunctionFragment;
|
|
12
|
+
"liquidatorShareMantissa()": FunctionFragment;
|
|
13
|
+
"owner()": FunctionFragment;
|
|
14
|
+
"pendingOwner()": FunctionFragment;
|
|
15
|
+
"renounceOwnership()": FunctionFragment;
|
|
16
|
+
"setLiquidatorShare(uint256)": FunctionFragment;
|
|
17
|
+
"sweepToken(address)": FunctionFragment;
|
|
18
|
+
"transferOwnership(address)": FunctionFragment;
|
|
19
|
+
"treasury()": FunctionFragment;
|
|
20
|
+
"vBUSD()": FunctionFragment;
|
|
21
|
+
};
|
|
22
|
+
getFunction(nameOrSignatureOrTopic: "acceptOwnership" | "comptroller" | "initialize" | "liquidateBorrow" | "liquidateEntireBorrow" | "liquidatorShareMantissa" | "owner" | "pendingOwner" | "renounceOwnership" | "setLiquidatorShare" | "sweepToken" | "transferOwnership" | "treasury" | "vBUSD"): FunctionFragment;
|
|
23
|
+
encodeFunctionData(functionFragment: "acceptOwnership", values?: undefined): string;
|
|
24
|
+
encodeFunctionData(functionFragment: "comptroller", values?: undefined): string;
|
|
25
|
+
encodeFunctionData(functionFragment: "initialize", values: [PromiseOrValue<BigNumberish>]): string;
|
|
26
|
+
encodeFunctionData(functionFragment: "liquidateBorrow", values: [
|
|
27
|
+
PromiseOrValue<string>,
|
|
28
|
+
PromiseOrValue<BigNumberish>,
|
|
29
|
+
PromiseOrValue<string>
|
|
30
|
+
]): string;
|
|
31
|
+
encodeFunctionData(functionFragment: "liquidateEntireBorrow", values: [PromiseOrValue<string>, PromiseOrValue<string>]): string;
|
|
32
|
+
encodeFunctionData(functionFragment: "liquidatorShareMantissa", values?: undefined): string;
|
|
33
|
+
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
|
|
34
|
+
encodeFunctionData(functionFragment: "pendingOwner", values?: undefined): string;
|
|
35
|
+
encodeFunctionData(functionFragment: "renounceOwnership", values?: undefined): string;
|
|
36
|
+
encodeFunctionData(functionFragment: "setLiquidatorShare", values: [PromiseOrValue<BigNumberish>]): string;
|
|
37
|
+
encodeFunctionData(functionFragment: "sweepToken", values: [PromiseOrValue<string>]): string;
|
|
38
|
+
encodeFunctionData(functionFragment: "transferOwnership", values: [PromiseOrValue<string>]): string;
|
|
39
|
+
encodeFunctionData(functionFragment: "treasury", values?: undefined): string;
|
|
40
|
+
encodeFunctionData(functionFragment: "vBUSD", values?: undefined): string;
|
|
41
|
+
decodeFunctionResult(functionFragment: "acceptOwnership", data: BytesLike): Result;
|
|
42
|
+
decodeFunctionResult(functionFragment: "comptroller", data: BytesLike): Result;
|
|
43
|
+
decodeFunctionResult(functionFragment: "initialize", data: BytesLike): Result;
|
|
44
|
+
decodeFunctionResult(functionFragment: "liquidateBorrow", data: BytesLike): Result;
|
|
45
|
+
decodeFunctionResult(functionFragment: "liquidateEntireBorrow", data: BytesLike): Result;
|
|
46
|
+
decodeFunctionResult(functionFragment: "liquidatorShareMantissa", data: BytesLike): Result;
|
|
47
|
+
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
|
|
48
|
+
decodeFunctionResult(functionFragment: "pendingOwner", data: BytesLike): Result;
|
|
49
|
+
decodeFunctionResult(functionFragment: "renounceOwnership", data: BytesLike): Result;
|
|
50
|
+
decodeFunctionResult(functionFragment: "setLiquidatorShare", data: BytesLike): Result;
|
|
51
|
+
decodeFunctionResult(functionFragment: "sweepToken", data: BytesLike): Result;
|
|
52
|
+
decodeFunctionResult(functionFragment: "transferOwnership", data: BytesLike): Result;
|
|
53
|
+
decodeFunctionResult(functionFragment: "treasury", data: BytesLike): Result;
|
|
54
|
+
decodeFunctionResult(functionFragment: "vBUSD", data: BytesLike): Result;
|
|
55
|
+
events: {
|
|
56
|
+
"Initialized(uint8)": EventFragment;
|
|
57
|
+
"NewLiquidatorShare(uint256,uint256)": EventFragment;
|
|
58
|
+
"OwnershipTransferStarted(address,address)": EventFragment;
|
|
59
|
+
"OwnershipTransferred(address,address)": EventFragment;
|
|
60
|
+
};
|
|
61
|
+
getEvent(nameOrSignatureOrTopic: "Initialized"): EventFragment;
|
|
62
|
+
getEvent(nameOrSignatureOrTopic: "NewLiquidatorShare"): EventFragment;
|
|
63
|
+
getEvent(nameOrSignatureOrTopic: "OwnershipTransferStarted"): EventFragment;
|
|
64
|
+
getEvent(nameOrSignatureOrTopic: "OwnershipTransferred"): EventFragment;
|
|
65
|
+
}
|
|
66
|
+
export interface InitializedEventObject {
|
|
67
|
+
version: number;
|
|
68
|
+
}
|
|
69
|
+
export type InitializedEvent = TypedEvent<[number], InitializedEventObject>;
|
|
70
|
+
export type InitializedEventFilter = TypedEventFilter<InitializedEvent>;
|
|
71
|
+
export interface NewLiquidatorShareEventObject {
|
|
72
|
+
oldLiquidatorShareMantissa: BigNumber;
|
|
73
|
+
newLiquidatorShareMantissa: BigNumber;
|
|
74
|
+
}
|
|
75
|
+
export type NewLiquidatorShareEvent = TypedEvent<[
|
|
76
|
+
BigNumber,
|
|
77
|
+
BigNumber
|
|
78
|
+
], NewLiquidatorShareEventObject>;
|
|
79
|
+
export type NewLiquidatorShareEventFilter = TypedEventFilter<NewLiquidatorShareEvent>;
|
|
80
|
+
export interface OwnershipTransferStartedEventObject {
|
|
81
|
+
previousOwner: string;
|
|
82
|
+
newOwner: string;
|
|
83
|
+
}
|
|
84
|
+
export type OwnershipTransferStartedEvent = TypedEvent<[
|
|
85
|
+
string,
|
|
86
|
+
string
|
|
87
|
+
], OwnershipTransferStartedEventObject>;
|
|
88
|
+
export type OwnershipTransferStartedEventFilter = TypedEventFilter<OwnershipTransferStartedEvent>;
|
|
89
|
+
export interface OwnershipTransferredEventObject {
|
|
90
|
+
previousOwner: string;
|
|
91
|
+
newOwner: string;
|
|
92
|
+
}
|
|
93
|
+
export type OwnershipTransferredEvent = TypedEvent<[
|
|
94
|
+
string,
|
|
95
|
+
string
|
|
96
|
+
], OwnershipTransferredEventObject>;
|
|
97
|
+
export type OwnershipTransferredEventFilter = TypedEventFilter<OwnershipTransferredEvent>;
|
|
98
|
+
export interface BUSDLiquidator extends BaseContract {
|
|
99
|
+
connect(signerOrProvider: Signer | Provider | string): this;
|
|
100
|
+
attach(addressOrName: string): this;
|
|
101
|
+
deployed(): Promise<this>;
|
|
102
|
+
interface: BUSDLiquidatorInterface;
|
|
103
|
+
queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
|
|
104
|
+
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
|
|
105
|
+
listeners(eventName?: string): Array<Listener>;
|
|
106
|
+
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
|
|
107
|
+
removeAllListeners(eventName?: string): this;
|
|
108
|
+
off: OnEvent<this>;
|
|
109
|
+
on: OnEvent<this>;
|
|
110
|
+
once: OnEvent<this>;
|
|
111
|
+
removeListener: OnEvent<this>;
|
|
112
|
+
functions: {
|
|
113
|
+
acceptOwnership(overrides?: Overrides & {
|
|
114
|
+
from?: PromiseOrValue<string>;
|
|
115
|
+
}): Promise<ContractTransaction>;
|
|
116
|
+
comptroller(overrides?: CallOverrides): Promise<[string]>;
|
|
117
|
+
initialize(liquidatorShareMantissa_: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
118
|
+
from?: PromiseOrValue<string>;
|
|
119
|
+
}): Promise<ContractTransaction>;
|
|
120
|
+
liquidateBorrow(borrower: PromiseOrValue<string>, repayAmount: PromiseOrValue<BigNumberish>, vTokenCollateral: PromiseOrValue<string>, overrides?: Overrides & {
|
|
121
|
+
from?: PromiseOrValue<string>;
|
|
122
|
+
}): Promise<ContractTransaction>;
|
|
123
|
+
liquidateEntireBorrow(borrower: PromiseOrValue<string>, vTokenCollateral: PromiseOrValue<string>, overrides?: Overrides & {
|
|
124
|
+
from?: PromiseOrValue<string>;
|
|
125
|
+
}): Promise<ContractTransaction>;
|
|
126
|
+
liquidatorShareMantissa(overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
127
|
+
owner(overrides?: CallOverrides): Promise<[string]>;
|
|
128
|
+
pendingOwner(overrides?: CallOverrides): Promise<[string]>;
|
|
129
|
+
renounceOwnership(overrides?: Overrides & {
|
|
130
|
+
from?: PromiseOrValue<string>;
|
|
131
|
+
}): Promise<ContractTransaction>;
|
|
132
|
+
setLiquidatorShare(liquidatorShareMantissa_: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
133
|
+
from?: PromiseOrValue<string>;
|
|
134
|
+
}): Promise<ContractTransaction>;
|
|
135
|
+
sweepToken(token: PromiseOrValue<string>, overrides?: Overrides & {
|
|
136
|
+
from?: PromiseOrValue<string>;
|
|
137
|
+
}): Promise<ContractTransaction>;
|
|
138
|
+
transferOwnership(newOwner: PromiseOrValue<string>, overrides?: Overrides & {
|
|
139
|
+
from?: PromiseOrValue<string>;
|
|
140
|
+
}): Promise<ContractTransaction>;
|
|
141
|
+
treasury(overrides?: CallOverrides): Promise<[string]>;
|
|
142
|
+
vBUSD(overrides?: CallOverrides): Promise<[string]>;
|
|
143
|
+
};
|
|
144
|
+
acceptOwnership(overrides?: Overrides & {
|
|
145
|
+
from?: PromiseOrValue<string>;
|
|
146
|
+
}): Promise<ContractTransaction>;
|
|
147
|
+
comptroller(overrides?: CallOverrides): Promise<string>;
|
|
148
|
+
initialize(liquidatorShareMantissa_: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
149
|
+
from?: PromiseOrValue<string>;
|
|
150
|
+
}): Promise<ContractTransaction>;
|
|
151
|
+
liquidateBorrow(borrower: PromiseOrValue<string>, repayAmount: PromiseOrValue<BigNumberish>, vTokenCollateral: PromiseOrValue<string>, overrides?: Overrides & {
|
|
152
|
+
from?: PromiseOrValue<string>;
|
|
153
|
+
}): Promise<ContractTransaction>;
|
|
154
|
+
liquidateEntireBorrow(borrower: PromiseOrValue<string>, vTokenCollateral: PromiseOrValue<string>, overrides?: Overrides & {
|
|
155
|
+
from?: PromiseOrValue<string>;
|
|
156
|
+
}): Promise<ContractTransaction>;
|
|
157
|
+
liquidatorShareMantissa(overrides?: CallOverrides): Promise<BigNumber>;
|
|
158
|
+
owner(overrides?: CallOverrides): Promise<string>;
|
|
159
|
+
pendingOwner(overrides?: CallOverrides): Promise<string>;
|
|
160
|
+
renounceOwnership(overrides?: Overrides & {
|
|
161
|
+
from?: PromiseOrValue<string>;
|
|
162
|
+
}): Promise<ContractTransaction>;
|
|
163
|
+
setLiquidatorShare(liquidatorShareMantissa_: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
164
|
+
from?: PromiseOrValue<string>;
|
|
165
|
+
}): Promise<ContractTransaction>;
|
|
166
|
+
sweepToken(token: PromiseOrValue<string>, overrides?: Overrides & {
|
|
167
|
+
from?: PromiseOrValue<string>;
|
|
168
|
+
}): Promise<ContractTransaction>;
|
|
169
|
+
transferOwnership(newOwner: PromiseOrValue<string>, overrides?: Overrides & {
|
|
170
|
+
from?: PromiseOrValue<string>;
|
|
171
|
+
}): Promise<ContractTransaction>;
|
|
172
|
+
treasury(overrides?: CallOverrides): Promise<string>;
|
|
173
|
+
vBUSD(overrides?: CallOverrides): Promise<string>;
|
|
174
|
+
callStatic: {
|
|
175
|
+
acceptOwnership(overrides?: CallOverrides): Promise<void>;
|
|
176
|
+
comptroller(overrides?: CallOverrides): Promise<string>;
|
|
177
|
+
initialize(liquidatorShareMantissa_: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<void>;
|
|
178
|
+
liquidateBorrow(borrower: PromiseOrValue<string>, repayAmount: PromiseOrValue<BigNumberish>, vTokenCollateral: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;
|
|
179
|
+
liquidateEntireBorrow(borrower: PromiseOrValue<string>, vTokenCollateral: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;
|
|
180
|
+
liquidatorShareMantissa(overrides?: CallOverrides): Promise<BigNumber>;
|
|
181
|
+
owner(overrides?: CallOverrides): Promise<string>;
|
|
182
|
+
pendingOwner(overrides?: CallOverrides): Promise<string>;
|
|
183
|
+
renounceOwnership(overrides?: CallOverrides): Promise<void>;
|
|
184
|
+
setLiquidatorShare(liquidatorShareMantissa_: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<void>;
|
|
185
|
+
sweepToken(token: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;
|
|
186
|
+
transferOwnership(newOwner: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;
|
|
187
|
+
treasury(overrides?: CallOverrides): Promise<string>;
|
|
188
|
+
vBUSD(overrides?: CallOverrides): Promise<string>;
|
|
189
|
+
};
|
|
190
|
+
filters: {
|
|
191
|
+
"Initialized(uint8)"(version?: null): InitializedEventFilter;
|
|
192
|
+
Initialized(version?: null): InitializedEventFilter;
|
|
193
|
+
"NewLiquidatorShare(uint256,uint256)"(oldLiquidatorShareMantissa?: null, newLiquidatorShareMantissa?: null): NewLiquidatorShareEventFilter;
|
|
194
|
+
NewLiquidatorShare(oldLiquidatorShareMantissa?: null, newLiquidatorShareMantissa?: null): NewLiquidatorShareEventFilter;
|
|
195
|
+
"OwnershipTransferStarted(address,address)"(previousOwner?: PromiseOrValue<string> | null, newOwner?: PromiseOrValue<string> | null): OwnershipTransferStartedEventFilter;
|
|
196
|
+
OwnershipTransferStarted(previousOwner?: PromiseOrValue<string> | null, newOwner?: PromiseOrValue<string> | null): OwnershipTransferStartedEventFilter;
|
|
197
|
+
"OwnershipTransferred(address,address)"(previousOwner?: PromiseOrValue<string> | null, newOwner?: PromiseOrValue<string> | null): OwnershipTransferredEventFilter;
|
|
198
|
+
OwnershipTransferred(previousOwner?: PromiseOrValue<string> | null, newOwner?: PromiseOrValue<string> | null): OwnershipTransferredEventFilter;
|
|
199
|
+
};
|
|
200
|
+
estimateGas: {
|
|
201
|
+
acceptOwnership(overrides?: Overrides & {
|
|
202
|
+
from?: PromiseOrValue<string>;
|
|
203
|
+
}): Promise<BigNumber>;
|
|
204
|
+
comptroller(overrides?: CallOverrides): Promise<BigNumber>;
|
|
205
|
+
initialize(liquidatorShareMantissa_: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
206
|
+
from?: PromiseOrValue<string>;
|
|
207
|
+
}): Promise<BigNumber>;
|
|
208
|
+
liquidateBorrow(borrower: PromiseOrValue<string>, repayAmount: PromiseOrValue<BigNumberish>, vTokenCollateral: PromiseOrValue<string>, overrides?: Overrides & {
|
|
209
|
+
from?: PromiseOrValue<string>;
|
|
210
|
+
}): Promise<BigNumber>;
|
|
211
|
+
liquidateEntireBorrow(borrower: PromiseOrValue<string>, vTokenCollateral: PromiseOrValue<string>, overrides?: Overrides & {
|
|
212
|
+
from?: PromiseOrValue<string>;
|
|
213
|
+
}): Promise<BigNumber>;
|
|
214
|
+
liquidatorShareMantissa(overrides?: CallOverrides): Promise<BigNumber>;
|
|
215
|
+
owner(overrides?: CallOverrides): Promise<BigNumber>;
|
|
216
|
+
pendingOwner(overrides?: CallOverrides): Promise<BigNumber>;
|
|
217
|
+
renounceOwnership(overrides?: Overrides & {
|
|
218
|
+
from?: PromiseOrValue<string>;
|
|
219
|
+
}): Promise<BigNumber>;
|
|
220
|
+
setLiquidatorShare(liquidatorShareMantissa_: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
221
|
+
from?: PromiseOrValue<string>;
|
|
222
|
+
}): Promise<BigNumber>;
|
|
223
|
+
sweepToken(token: PromiseOrValue<string>, overrides?: Overrides & {
|
|
224
|
+
from?: PromiseOrValue<string>;
|
|
225
|
+
}): Promise<BigNumber>;
|
|
226
|
+
transferOwnership(newOwner: PromiseOrValue<string>, overrides?: Overrides & {
|
|
227
|
+
from?: PromiseOrValue<string>;
|
|
228
|
+
}): Promise<BigNumber>;
|
|
229
|
+
treasury(overrides?: CallOverrides): Promise<BigNumber>;
|
|
230
|
+
vBUSD(overrides?: CallOverrides): Promise<BigNumber>;
|
|
231
|
+
};
|
|
232
|
+
populateTransaction: {
|
|
233
|
+
acceptOwnership(overrides?: Overrides & {
|
|
234
|
+
from?: PromiseOrValue<string>;
|
|
235
|
+
}): Promise<PopulatedTransaction>;
|
|
236
|
+
comptroller(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
237
|
+
initialize(liquidatorShareMantissa_: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
238
|
+
from?: PromiseOrValue<string>;
|
|
239
|
+
}): Promise<PopulatedTransaction>;
|
|
240
|
+
liquidateBorrow(borrower: PromiseOrValue<string>, repayAmount: PromiseOrValue<BigNumberish>, vTokenCollateral: PromiseOrValue<string>, overrides?: Overrides & {
|
|
241
|
+
from?: PromiseOrValue<string>;
|
|
242
|
+
}): Promise<PopulatedTransaction>;
|
|
243
|
+
liquidateEntireBorrow(borrower: PromiseOrValue<string>, vTokenCollateral: PromiseOrValue<string>, overrides?: Overrides & {
|
|
244
|
+
from?: PromiseOrValue<string>;
|
|
245
|
+
}): Promise<PopulatedTransaction>;
|
|
246
|
+
liquidatorShareMantissa(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
247
|
+
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
248
|
+
pendingOwner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
249
|
+
renounceOwnership(overrides?: Overrides & {
|
|
250
|
+
from?: PromiseOrValue<string>;
|
|
251
|
+
}): Promise<PopulatedTransaction>;
|
|
252
|
+
setLiquidatorShare(liquidatorShareMantissa_: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
253
|
+
from?: PromiseOrValue<string>;
|
|
254
|
+
}): Promise<PopulatedTransaction>;
|
|
255
|
+
sweepToken(token: PromiseOrValue<string>, overrides?: Overrides & {
|
|
256
|
+
from?: PromiseOrValue<string>;
|
|
257
|
+
}): Promise<PopulatedTransaction>;
|
|
258
|
+
transferOwnership(newOwner: PromiseOrValue<string>, overrides?: Overrides & {
|
|
259
|
+
from?: PromiseOrValue<string>;
|
|
260
|
+
}): Promise<PopulatedTransaction>;
|
|
261
|
+
treasury(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
262
|
+
vBUSD(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
263
|
+
};
|
|
264
|
+
}
|