@venusprotocol/venus-protocol 6.1.0-dev.1 → 6.1.0-dev.10
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/README.md +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/@venusprotocol/solidity-utilities/contracts/MaxLoopsLimitHelper.sol/MaxLoopsLimitHelper.dbg.json +4 -0
- package/artifacts/@venusprotocol/{isolated-pools → solidity-utilities}/contracts/MaxLoopsLimitHelper.sol/MaxLoopsLimitHelper.json +1 -1
- package/artifacts/build-info/{2760d6f350f53f1800e3646397c6e1d1.json → ca9cec918639b6d02d5466619a4c008d.json} +1 -1
- 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/MoveDebtDelegate.sol/MoveDebtDelegate.dbg.json +4 -0
- package/artifacts/contracts/DelegateBorrowers/MoveDebtDelegate.sol/MoveDebtDelegate.json +361 -0
- package/artifacts/contracts/DelegateBorrowers/SwapDebtDelegate.sol/SwapDebtDelegate.dbg.json +1 -1
- package/artifacts/contracts/DelegateBorrowers/SwapDebtDelegate.sol/SwapDebtDelegate.json +4 -4
- package/artifacts/contracts/InterfacesV8.sol/IComptroller.dbg.json +4 -0
- package/artifacts/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IComptroller.json +14 -1
- package/artifacts/contracts/InterfacesV8.sol/ILiquidator.dbg.json +4 -0
- package/artifacts/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/ILiquidator.json +1 -1
- package/artifacts/contracts/InterfacesV8.sol/IVAIController.dbg.json +4 -0
- package/artifacts/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVAIController.json +1 -1
- package/artifacts/contracts/InterfacesV8.sol/IVBNB.dbg.json +4 -0
- package/artifacts/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVBNB.json +15 -2
- package/artifacts/contracts/InterfacesV8.sol/IVBep20.dbg.json +4 -0
- package/artifacts/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVBep20.json +63 -2
- package/artifacts/contracts/InterfacesV8.sol/IVToken.dbg.json +4 -0
- package/artifacts/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVToken.json +15 -2
- package/artifacts/contracts/Liquidator/BUSDLiquidator.sol/BUSDLiquidator.dbg.json +1 -1
- package/artifacts/contracts/Liquidator/BUSDLiquidator.sol/BUSDLiquidator.json +3 -3
- package/artifacts/contracts/Liquidator/Liquidator.sol/Liquidator.dbg.json +1 -1
- package/artifacts/contracts/Liquidator/Liquidator.sol/Liquidator.json +7 -7
- 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/Tokens/Prime/Interfaces/IPrime.sol/IPrime.dbg.json +1 -1
- package/artifacts/contracts/Tokens/Prime/Interfaces/IPrimeLiquidityProvider.sol/IPrimeLiquidityProvider.dbg.json +1 -1
- package/artifacts/contracts/Tokens/Prime/Interfaces/IVToken.sol/IVToken.dbg.json +1 -1
- package/artifacts/contracts/Tokens/Prime/Interfaces/IXVSVault.sol/IXVSVault.dbg.json +1 -1
- package/artifacts/contracts/Tokens/Prime/Interfaces/InterfaceComptroller.sol/InterfaceComptroller.dbg.json +1 -1
- package/artifacts/contracts/Tokens/Prime/Prime.sol/Prime.dbg.json +1 -1
- package/artifacts/contracts/Tokens/Prime/Prime.sol/Prime.json +11 -11
- package/artifacts/contracts/Tokens/Prime/PrimeLiquidityProvider.sol/PrimeLiquidityProvider.dbg.json +1 -1
- package/artifacts/contracts/Tokens/Prime/PrimeLiquidityProvider.sol/PrimeLiquidityProvider.json +2 -2
- package/artifacts/contracts/Tokens/Prime/PrimeStorage.sol/PrimeStorageV1.dbg.json +1 -1
- package/artifacts/contracts/Tokens/Prime/libs/FixedMath.sol/FixedMath.dbg.json +1 -1
- package/artifacts/contracts/Tokens/Prime/libs/FixedMath0x.sol/FixedMath0x.dbg.json +1 -1
- package/artifacts/contracts/Tokens/Prime/libs/Scores.sol/Scores.dbg.json +1 -1
- package/artifacts/contracts/test/AccessControlManagerMock.sol/AccessControlManagerMock.dbg.json +1 -1
- package/artifacts/contracts/test/LiquidatorHarness.sol/LiquidatorHarness.dbg.json +1 -1
- package/artifacts/contracts/test/LiquidatorHarness.sol/LiquidatorHarness.json +7 -7
- package/artifacts/contracts/test/MockProtocolShareReserve.sol/IComptroller.dbg.json +1 -1
- package/artifacts/contracts/test/MockProtocolShareReserve.sol/IIncomeDestination.dbg.json +1 -1
- package/artifacts/contracts/test/MockProtocolShareReserve.sol/IMockProtocolShareReserve.dbg.json +1 -1
- package/artifacts/contracts/test/MockProtocolShareReserve.sol/IPoolRegistry.dbg.json +1 -1
- package/artifacts/contracts/test/MockProtocolShareReserve.sol/IPrime.dbg.json +1 -1
- package/artifacts/contracts/test/MockProtocolShareReserve.sol/IVToken.dbg.json +1 -1
- package/artifacts/contracts/test/MockProtocolShareReserve.sol/MaxLoopsLimitHelper.dbg.json +1 -1
- package/artifacts/contracts/test/MockProtocolShareReserve.sol/MockProtocolShareReserve.dbg.json +1 -1
- package/artifacts/contracts/test/PrimeScenario.sol/PrimeScenario.dbg.json +1 -1
- package/artifacts/contracts/test/PrimeScenario.sol/PrimeScenario.json +9 -9
- package/contracts/DelegateBorrowers/MoveDebtDelegate.sol +179 -0
- package/contracts/DelegateBorrowers/SwapDebtDelegate.sol +15 -31
- package/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol} +10 -3
- package/contracts/Liquidator/BUSDLiquidator.sol +6 -5
- package/contracts/Liquidator/Liquidator.sol +6 -5
- package/contracts/Tokens/Prime/Prime.sol +15 -17
- package/contracts/Tokens/Prime/PrimeLiquidityProvider.sol +1 -1
- package/deploy/007-deploy-VTreasuryV8.ts +2 -1
- package/deploy/007-deploy-xvs.ts +21 -0
- package/deploy/008-deploy-vaults.ts +53 -0
- package/deploy/009-configure-vaults.ts +60 -0
- package/deployments/bscmainnet_addresses.json +198 -0
- package/deployments/bsctestnet_addresses.json +117 -0
- package/deployments/ethereum_addresses.json +7 -0
- package/deployments/opbnbmainnet/.chainId +1 -0
- package/deployments/opbnbmainnet/VTreasuryV8.json +329 -0
- package/deployments/opbnbmainnet/solcInputs/eec1a81bf1f62fa3d37a473878008333.json +97 -0
- package/deployments/opbnbmainnet.json +200 -0
- package/deployments/opbnbmainnet_addresses.json +7 -0
- package/deployments/opbnbtestnet/.chainId +1 -0
- package/deployments/opbnbtestnet/VTreasuryV8.json +329 -0
- package/deployments/opbnbtestnet/solcInputs/eec1a81bf1f62fa3d37a473878008333.json +97 -0
- package/deployments/opbnbtestnet.json +200 -0
- package/deployments/opbnbtestnet_addresses.json +7 -0
- package/deployments/sepolia/XVSStore.json +374 -0
- package/deployments/sepolia/XVSVault.json +2373 -0
- package/deployments/sepolia/XVSVaultProxy.json +352 -0
- package/deployments/sepolia/solcInputs/b0e08c65414d4fb3a80b2146b3c121f2.json +345 -0
- package/deployments/sepolia.json +2040 -0
- package/deployments/sepolia_addresses.json +10 -0
- package/dist/deploy/007-deploy-VTreasuryV8.js +3 -1
- package/dist/deploy/007-deploy-xvs.d.ts +3 -0
- package/dist/deploy/007-deploy-xvs.js +16 -0
- package/dist/deploy/008-deploy-vaults.d.ts +3 -0
- package/dist/deploy/008-deploy-vaults.js +41 -0
- package/dist/deploy/009-configure-vaults.d.ts +3 -0
- package/dist/deploy/009-configure-vaults.js +41 -0
- package/dist/hardhat.config.js +111 -20
- package/dist/typechain/@venusprotocol/index.d.ts +2 -2
- package/dist/typechain/contracts/DelegateBorrowers/MoveDebtDelegate.d.ts +274 -0
- package/dist/typechain/contracts/DelegateBorrowers/{SwapDebtDelegate.sol/SwapDebtDelegate.d.ts → SwapDebtDelegate.d.ts} +1 -1
- package/dist/typechain/contracts/DelegateBorrowers/index.d.ts +2 -2
- package/dist/typechain/contracts/DelegateBorrowers/index.js +0 -1
- package/dist/typechain/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IComptroller.d.ts +10 -2
- package/dist/typechain/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/ILiquidator.d.ts +1 -1
- package/dist/typechain/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVAIController.d.ts +1 -1
- package/dist/typechain/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVBNB.d.ts +15 -7
- package/dist/typechain/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVBep20.d.ts +47 -7
- package/dist/typechain/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVToken.d.ts +15 -7
- package/dist/typechain/contracts/Liquidator/index.d.ts +0 -2
- package/dist/typechain/contracts/Liquidator/index.js +0 -1
- package/dist/typechain/contracts/Tokens/Prime/Prime.d.ts +17 -17
- package/dist/typechain/contracts/index.d.ts +2 -0
- package/dist/typechain/contracts/test/PrimeScenario.d.ts +17 -17
- package/dist/typechain/factories/@venusprotocol/index.d.ts +1 -1
- package/dist/typechain/factories/@venusprotocol/index.js +2 -2
- package/dist/typechain/factories/@venusprotocol/{isolated-pools → solidity-utilities}/contracts/MaxLoopsLimitHelper__factory.d.ts +1 -1
- package/dist/typechain/factories/contracts/DelegateBorrowers/MoveDebtDelegate__factory.d.ts +294 -0
- package/dist/typechain/factories/contracts/DelegateBorrowers/MoveDebtDelegate__factory.js +390 -0
- package/dist/typechain/factories/contracts/DelegateBorrowers/{SwapDebtDelegate.sol/SwapDebtDelegate__factory.d.ts → SwapDebtDelegate__factory.d.ts} +5 -5
- package/dist/typechain/factories/contracts/DelegateBorrowers/{SwapDebtDelegate.sol/SwapDebtDelegate__factory.js → SwapDebtDelegate__factory.js} +3 -3
- package/dist/typechain/factories/contracts/DelegateBorrowers/index.d.ts +2 -1
- package/dist/typechain/factories/contracts/DelegateBorrowers/index.js +5 -25
- package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IComptroller__factory.d.ts +11 -1
- package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IComptroller__factory.js +13 -0
- package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/ILiquidator__factory.d.ts +1 -1
- package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVAIController__factory.d.ts +1 -1
- package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVBNB__factory.d.ts +12 -2
- package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVBNB__factory.js +14 -1
- package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVBep20__factory.d.ts +48 -2
- package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVBep20__factory.js +62 -1
- package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVToken__factory.d.ts +12 -2
- package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVToken__factory.js +14 -1
- package/dist/typechain/factories/contracts/Liquidator/BUSDLiquidator__factory.d.ts +2 -2
- package/dist/typechain/factories/contracts/Liquidator/BUSDLiquidator__factory.js +2 -2
- package/dist/typechain/factories/contracts/Liquidator/Liquidator__factory.d.ts +5 -5
- package/dist/typechain/factories/contracts/Liquidator/Liquidator__factory.js +6 -6
- package/dist/typechain/factories/contracts/Liquidator/index.d.ts +0 -1
- package/dist/typechain/factories/contracts/Liquidator/index.js +1 -25
- package/dist/typechain/factories/contracts/Tokens/Prime/PrimeLiquidityProvider__factory.d.ts +1 -1
- package/dist/typechain/factories/contracts/Tokens/Prime/PrimeLiquidityProvider__factory.js +1 -1
- package/dist/typechain/factories/contracts/Tokens/Prime/Prime__factory.d.ts +12 -12
- package/dist/typechain/factories/contracts/Tokens/Prime/Prime__factory.js +14 -14
- package/dist/typechain/factories/contracts/index.d.ts +1 -0
- package/dist/typechain/factories/contracts/index.js +2 -1
- package/dist/typechain/factories/contracts/test/LiquidatorHarness__factory.d.ts +5 -5
- package/dist/typechain/factories/contracts/test/LiquidatorHarness__factory.js +6 -6
- package/dist/typechain/factories/contracts/test/PrimeScenario__factory.d.ts +8 -8
- package/dist/typechain/factories/contracts/test/PrimeScenario__factory.js +8 -8
- package/dist/typechain/index.d.ts +16 -16
- package/dist/typechain/index.js +17 -17
- package/package.json +3 -3
- package/artifacts/@venusprotocol/isolated-pools/contracts/MaxLoopsLimitHelper.sol/MaxLoopsLimitHelper.dbg.json +0 -4
- package/artifacts/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IComptroller.dbg.json +0 -4
- package/artifacts/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IComptroller.json +0 -24
- package/artifacts/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IPriceOracle.dbg.json +0 -4
- package/artifacts/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IPriceOracle.json +0 -30
- package/artifacts/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IVToken.dbg.json +0 -4
- package/artifacts/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IVToken.json +0 -104
- package/artifacts/contracts/Liquidator/Interfaces.sol/IComptroller.dbg.json +0 -4
- package/artifacts/contracts/Liquidator/Interfaces.sol/ILiquidator.dbg.json +0 -4
- package/artifacts/contracts/Liquidator/Interfaces.sol/IVAIController.dbg.json +0 -4
- package/artifacts/contracts/Liquidator/Interfaces.sol/IVBNB.dbg.json +0 -4
- package/artifacts/contracts/Liquidator/Interfaces.sol/IVBep20.dbg.json +0 -4
- package/artifacts/contracts/Liquidator/Interfaces.sol/IVToken.dbg.json +0 -4
- package/contracts/Liquidator/constants.sol +0 -5
- package/contracts/Liquidator/zeroAddress.sol +0 -11
- package/dist/typechain/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IComptroller.d.ts +0 -42
- package/dist/typechain/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IPriceOracle.d.ts +0 -42
- package/dist/typechain/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IPriceOracle.js +0 -3
- package/dist/typechain/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IVToken.d.ts +0 -98
- package/dist/typechain/contracts/DelegateBorrowers/SwapDebtDelegate.sol/index.d.ts +0 -4
- package/dist/typechain/contracts/Liquidator/Interfaces.sol/IVToken.js +0 -3
- package/dist/typechain/contracts/Liquidator/Interfaces.sol/index.js +0 -2
- package/dist/typechain/factories/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IComptroller__factory.d.ts +0 -18
- package/dist/typechain/factories/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IComptroller__factory.js +0 -30
- package/dist/typechain/factories/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IPriceOracle__factory.d.ts +0 -22
- package/dist/typechain/factories/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IPriceOracle__factory.js +0 -36
- package/dist/typechain/factories/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IVToken__factory.d.ts +0 -78
- package/dist/typechain/factories/contracts/DelegateBorrowers/SwapDebtDelegate.sol/IVToken__factory.js +0 -110
- package/dist/typechain/factories/contracts/DelegateBorrowers/SwapDebtDelegate.sol/index.d.ts +0 -4
- package/dist/typechain/factories/contracts/DelegateBorrowers/SwapDebtDelegate.sol/index.js +0 -14
- /package/contracts/{Liquidator → lib}/approveOrRevert.sol +0 -0
- /package/dist/typechain/@venusprotocol/{isolated-pools → solidity-utilities}/contracts/MaxLoopsLimitHelper.d.ts +0 -0
- /package/dist/typechain/@venusprotocol/{isolated-pools → solidity-utilities}/contracts/MaxLoopsLimitHelper.js +0 -0
- /package/dist/typechain/@venusprotocol/{isolated-pools → solidity-utilities}/contracts/index.d.ts +0 -0
- /package/dist/typechain/@venusprotocol/{isolated-pools → solidity-utilities}/contracts/index.js +0 -0
- /package/dist/typechain/@venusprotocol/{isolated-pools → solidity-utilities}/index.d.ts +0 -0
- /package/dist/typechain/@venusprotocol/{isolated-pools → solidity-utilities}/index.js +0 -0
- /package/dist/typechain/contracts/DelegateBorrowers/{SwapDebtDelegate.sol/IComptroller.js → MoveDebtDelegate.js} +0 -0
- /package/dist/typechain/contracts/DelegateBorrowers/{SwapDebtDelegate.sol/SwapDebtDelegate.js → SwapDebtDelegate.js} +0 -0
- /package/dist/typechain/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IComptroller.js +0 -0
- /package/dist/typechain/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/ILiquidator.js +0 -0
- /package/dist/typechain/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVAIController.js +0 -0
- /package/dist/typechain/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVBNB.js +0 -0
- /package/dist/typechain/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVBep20.js +0 -0
- /package/dist/typechain/contracts/{DelegateBorrowers/SwapDebtDelegate.sol → InterfacesV8.sol}/IVToken.js +0 -0
- /package/dist/typechain/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/index.d.ts +0 -0
- /package/dist/typechain/contracts/{DelegateBorrowers/SwapDebtDelegate.sol → InterfacesV8.sol}/index.js +0 -0
- /package/dist/typechain/factories/@venusprotocol/{isolated-pools → solidity-utilities}/contracts/MaxLoopsLimitHelper__factory.js +0 -0
- /package/dist/typechain/factories/@venusprotocol/{isolated-pools → solidity-utilities}/contracts/index.d.ts +0 -0
- /package/dist/typechain/factories/@venusprotocol/{isolated-pools → solidity-utilities}/contracts/index.js +0 -0
- /package/dist/typechain/factories/@venusprotocol/{isolated-pools → solidity-utilities}/index.d.ts +0 -0
- /package/dist/typechain/factories/@venusprotocol/{isolated-pools → solidity-utilities}/index.js +0 -0
- /package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/ILiquidator__factory.js +0 -0
- /package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/IVAIController__factory.js +0 -0
- /package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/index.d.ts +0 -0
- /package/dist/typechain/factories/contracts/{Liquidator/Interfaces.sol → InterfacesV8.sol}/index.js +0 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
2
|
+
|
|
3
|
+
pragma solidity 0.8.13;
|
|
4
|
+
|
|
5
|
+
import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
|
|
6
|
+
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
|
|
7
|
+
import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
|
|
8
|
+
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
|
|
9
|
+
import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol";
|
|
10
|
+
|
|
11
|
+
import { approveOrRevert } from "../lib/approveOrRevert.sol";
|
|
12
|
+
import { IVBep20, IComptroller } from "../InterfacesV8.sol";
|
|
13
|
+
|
|
14
|
+
contract MoveDebtDelegate is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable {
|
|
15
|
+
/// @dev VToken return value signalling about successful execution
|
|
16
|
+
uint256 internal constant NO_ERROR = 0;
|
|
17
|
+
|
|
18
|
+
/// @notice VToken to repay the debt to
|
|
19
|
+
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
20
|
+
IVBep20 public immutable vTokenToRepay;
|
|
21
|
+
|
|
22
|
+
/// @notice User to borrow on behalf of
|
|
23
|
+
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
24
|
+
address public immutable newBorrower;
|
|
25
|
+
|
|
26
|
+
/// @notice Whether to allow borrowing from the corresponding vToken
|
|
27
|
+
mapping(address => bool) public borrowAllowed;
|
|
28
|
+
|
|
29
|
+
/// @notice Emitted when vToken is allowed or denied to be borrowed from
|
|
30
|
+
event BorrowAllowedSet(address indexed vToken, bool allowed);
|
|
31
|
+
|
|
32
|
+
/// @notice Emitted if debt is swapped successfully
|
|
33
|
+
event DebtMoved(
|
|
34
|
+
address indexed originalBorrower,
|
|
35
|
+
address vTokenRepaid,
|
|
36
|
+
uint256 repaidAmount,
|
|
37
|
+
address indexed newBorrower,
|
|
38
|
+
address indexed vTokenBorrowed,
|
|
39
|
+
uint256 borrowedAmount
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
/// @notice Emitted when the owner transfers tokens, accidentially sent to this contract,
|
|
43
|
+
/// to their account
|
|
44
|
+
event SweptTokens(address indexed token, uint256 amount);
|
|
45
|
+
|
|
46
|
+
/// @notice Thrown if VTokens' comptrollers are not equal
|
|
47
|
+
error ComptrollerMismatch();
|
|
48
|
+
|
|
49
|
+
/// @notice Thrown if repayment fails with an error code
|
|
50
|
+
error RepaymentFailed(uint256 errorCode);
|
|
51
|
+
|
|
52
|
+
/// @notice Thrown if borrow fails with an error code
|
|
53
|
+
error BorrowFailed(uint256 errorCode);
|
|
54
|
+
|
|
55
|
+
/// @notice Thrown if borrowing from the corresponding vToken is not allowed
|
|
56
|
+
error BorrowNotAllowed(address vToken);
|
|
57
|
+
|
|
58
|
+
using SafeERC20Upgradeable for IERC20Upgradeable;
|
|
59
|
+
|
|
60
|
+
/// @notice Constructor for the implementation contract. Sets immutable variables.
|
|
61
|
+
/// @param vTokenToRepay_ VToken to repay the debt to
|
|
62
|
+
/// @param newBorrower_ User to borrow on behalf of
|
|
63
|
+
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
64
|
+
constructor(IVBep20 vTokenToRepay_, address newBorrower_) {
|
|
65
|
+
vTokenToRepay = vTokenToRepay_;
|
|
66
|
+
newBorrower = newBorrower_;
|
|
67
|
+
_disableInitializers();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function initialize() external initializer {
|
|
71
|
+
__Ownable2Step_init();
|
|
72
|
+
__ReentrancyGuard_init();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @notice Repays originalBorrower's borrow in vTokenToRepay.underlying() and borrows
|
|
77
|
+
* vTokenToBorrow.underlying() on behalf of newBorrower
|
|
78
|
+
* @param originalBorrower The address of the borrower, whose debt to repay
|
|
79
|
+
* @param repayAmount The amount to repay in terms of vTokenToRepay.underlying()
|
|
80
|
+
* @param vTokenToBorrow VToken to borrow from
|
|
81
|
+
*/
|
|
82
|
+
function moveDebt(address originalBorrower, uint256 repayAmount, IVBep20 vTokenToBorrow) external nonReentrant {
|
|
83
|
+
if (!borrowAllowed[address(vTokenToBorrow)]) {
|
|
84
|
+
revert BorrowNotAllowed(address(vTokenToBorrow));
|
|
85
|
+
}
|
|
86
|
+
uint256 actualRepaymentAmount = _repay(originalBorrower, repayAmount);
|
|
87
|
+
uint256 amountToBorrow = _convert(vTokenToRepay, vTokenToBorrow, actualRepaymentAmount);
|
|
88
|
+
_borrow(vTokenToBorrow, amountToBorrow);
|
|
89
|
+
emit DebtMoved(
|
|
90
|
+
originalBorrower,
|
|
91
|
+
address(vTokenToRepay),
|
|
92
|
+
actualRepaymentAmount,
|
|
93
|
+
newBorrower,
|
|
94
|
+
address(vTokenToBorrow),
|
|
95
|
+
amountToBorrow
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @notice Allows or denies borrowing from the corresponding vToken
|
|
101
|
+
* @param vTokenToBorrow VToken to borrow from
|
|
102
|
+
* @param allow Whether to allow borrowing from the corresponding vToken
|
|
103
|
+
*/
|
|
104
|
+
function setBorrowAllowed(address vTokenToBorrow, bool allow) external onlyOwner {
|
|
105
|
+
if (borrowAllowed[vTokenToBorrow] != allow) {
|
|
106
|
+
borrowAllowed[vTokenToBorrow] = allow;
|
|
107
|
+
emit BorrowAllowedSet(vTokenToBorrow, allow);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @notice Transfers tokens, accidentially sent to this contract, to the owner
|
|
113
|
+
* @param token ERC-20 token to sweep
|
|
114
|
+
*/
|
|
115
|
+
function sweepTokens(IERC20Upgradeable token) external onlyOwner {
|
|
116
|
+
uint256 amount = token.balanceOf(address(this));
|
|
117
|
+
token.safeTransfer(owner(), amount);
|
|
118
|
+
emit SweptTokens(address(token), amount);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @dev Transfers the funds from the sender and repays a borrow in vToken on behalf of the borrower
|
|
123
|
+
* @param borrower The address of the borrower, whose debt to repay
|
|
124
|
+
* @param repayAmount The amount to repay in terms of underlying
|
|
125
|
+
*/
|
|
126
|
+
function _repay(address borrower, uint256 repayAmount) internal returns (uint256 actualRepaymentAmount) {
|
|
127
|
+
IERC20Upgradeable underlying = IERC20Upgradeable(vTokenToRepay.underlying());
|
|
128
|
+
uint256 balanceBefore = underlying.balanceOf(address(this));
|
|
129
|
+
underlying.safeTransferFrom(msg.sender, address(this), repayAmount);
|
|
130
|
+
uint256 balanceAfter = underlying.balanceOf(address(this));
|
|
131
|
+
uint256 repayAmountMinusFee = balanceAfter - balanceBefore;
|
|
132
|
+
|
|
133
|
+
uint256 borrowBalanceBefore = vTokenToRepay.borrowBalanceCurrent(borrower);
|
|
134
|
+
approveOrRevert(underlying, address(vTokenToRepay), repayAmountMinusFee);
|
|
135
|
+
uint256 err = vTokenToRepay.repayBorrowBehalf(borrower, repayAmountMinusFee);
|
|
136
|
+
if (err != NO_ERROR) {
|
|
137
|
+
revert RepaymentFailed(err);
|
|
138
|
+
}
|
|
139
|
+
approveOrRevert(underlying, address(vTokenToRepay), 0);
|
|
140
|
+
uint256 borrowBalanceAfter = vTokenToRepay.borrowBalanceCurrent(borrower);
|
|
141
|
+
return borrowBalanceBefore - borrowBalanceAfter;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @dev Borrows in vToken on behalf of the borrower and transfers the funds to the sender
|
|
146
|
+
* @param vToken VToken to borrow from
|
|
147
|
+
* @param borrowAmount The amount to borrow in terms of underlying
|
|
148
|
+
*/
|
|
149
|
+
function _borrow(IVBep20 vToken, uint256 borrowAmount) internal {
|
|
150
|
+
IERC20Upgradeable underlying = IERC20Upgradeable(vToken.underlying());
|
|
151
|
+
uint256 balanceBefore = underlying.balanceOf(address(this));
|
|
152
|
+
uint256 err = vToken.borrowBehalf(newBorrower, borrowAmount);
|
|
153
|
+
if (err != NO_ERROR) {
|
|
154
|
+
revert BorrowFailed(err);
|
|
155
|
+
}
|
|
156
|
+
uint256 balanceAfter = underlying.balanceOf(address(this));
|
|
157
|
+
uint256 actualBorrowedAmount = balanceAfter - balanceBefore;
|
|
158
|
+
underlying.safeTransfer(msg.sender, actualBorrowedAmount);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @dev Converts the value expressed in convertFrom.underlying() to a value
|
|
163
|
+
* in convertTo.underlying(), using the oracle price
|
|
164
|
+
* @param convertFrom VToken to convert from
|
|
165
|
+
* @param convertTo VToken to convert to
|
|
166
|
+
* @param amount The amount in convertFrom.underlying()
|
|
167
|
+
*/
|
|
168
|
+
function _convert(IVBep20 convertFrom, IVBep20 convertTo, uint256 amount) internal view returns (uint256) {
|
|
169
|
+
IComptroller comptroller = convertFrom.comptroller();
|
|
170
|
+
if (comptroller != convertTo.comptroller()) {
|
|
171
|
+
revert ComptrollerMismatch();
|
|
172
|
+
}
|
|
173
|
+
ResilientOracleInterface oracle = comptroller.oracle();
|
|
174
|
+
|
|
175
|
+
// Decimals are accounted for in the oracle contract
|
|
176
|
+
uint256 scaledUsdValue = oracle.getUnderlyingPrice(address(convertFrom)) * amount; // the USD value here has 36 decimals
|
|
177
|
+
return scaledUsdValue / oracle.getUnderlyingPrice(address(convertTo));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -2,30 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
pragma solidity 0.8.13;
|
|
4
4
|
|
|
5
|
-
import "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
|
|
6
|
-
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
|
|
7
|
-
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
|
|
8
|
-
import "@openzeppelin/contracts/token/ERC20/
|
|
5
|
+
import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
|
|
6
|
+
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
|
|
7
|
+
import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
|
|
8
|
+
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
|
|
9
|
+
import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol";
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface IComptroller {
|
|
15
|
-
function oracle() external view returns (IPriceOracle);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface IVToken {
|
|
19
|
-
function borrowBehalf(address borrower, uint256 borrowAmount) external returns (uint256);
|
|
20
|
-
|
|
21
|
-
function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);
|
|
22
|
-
|
|
23
|
-
function borrowBalanceCurrent(address account) external returns (uint256);
|
|
24
|
-
|
|
25
|
-
function comptroller() external view returns (IComptroller);
|
|
26
|
-
|
|
27
|
-
function underlying() external view returns (address);
|
|
28
|
-
}
|
|
11
|
+
import { approveOrRevert } from "../lib/approveOrRevert.sol";
|
|
12
|
+
import { IVBep20, IComptroller } from "../InterfacesV8.sol";
|
|
29
13
|
|
|
30
14
|
contract SwapDebtDelegate is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable {
|
|
31
15
|
/// @dev VToken return value signalling about successful execution
|
|
@@ -69,8 +53,8 @@ contract SwapDebtDelegate is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable
|
|
|
69
53
|
*/
|
|
70
54
|
function swapDebt(
|
|
71
55
|
address borrower,
|
|
72
|
-
|
|
73
|
-
|
|
56
|
+
IVBep20 repayTo,
|
|
57
|
+
IVBep20 borrowFrom,
|
|
74
58
|
uint256 repayAmount
|
|
75
59
|
) external onlyOwner nonReentrant {
|
|
76
60
|
uint256 actualRepaymentAmount = _repay(repayTo, borrower, repayAmount);
|
|
@@ -96,7 +80,7 @@ contract SwapDebtDelegate is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable
|
|
|
96
80
|
* @param repayAmount The amount to repay in terms of underlying
|
|
97
81
|
*/
|
|
98
82
|
function _repay(
|
|
99
|
-
|
|
83
|
+
IVBep20 vToken,
|
|
100
84
|
address borrower,
|
|
101
85
|
uint256 repayAmount
|
|
102
86
|
) internal returns (uint256 actualRepaymentAmount) {
|
|
@@ -123,7 +107,7 @@ contract SwapDebtDelegate is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable
|
|
|
123
107
|
* @param borrower The address of the borrower, who will own the borrow
|
|
124
108
|
* @param borrowAmount The amount to borrow in terms of underlying
|
|
125
109
|
*/
|
|
126
|
-
function _borrow(
|
|
110
|
+
function _borrow(IVBep20 vToken, address borrower, uint256 borrowAmount) internal {
|
|
127
111
|
IERC20Upgradeable underlying = IERC20Upgradeable(vToken.underlying());
|
|
128
112
|
uint256 balanceBefore = underlying.balanceOf(address(this));
|
|
129
113
|
uint256 err = vToken.borrowBehalf(borrower, borrowAmount);
|
|
@@ -142,15 +126,15 @@ contract SwapDebtDelegate is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable
|
|
|
142
126
|
* @param convertTo VToken to convert to
|
|
143
127
|
* @param amount The amount in convertFrom.underlying()
|
|
144
128
|
*/
|
|
145
|
-
function _convert(
|
|
129
|
+
function _convert(IVBep20 convertFrom, IVBep20 convertTo, uint256 amount) internal view returns (uint256) {
|
|
146
130
|
IComptroller comptroller = convertFrom.comptroller();
|
|
147
131
|
if (comptroller != convertTo.comptroller()) {
|
|
148
132
|
revert ComptrollerMismatch();
|
|
149
133
|
}
|
|
150
|
-
|
|
134
|
+
ResilientOracleInterface oracle = comptroller.oracle();
|
|
151
135
|
|
|
152
136
|
// Decimals are accounted for in the oracle contract
|
|
153
|
-
uint256 scaledUsdValue = oracle.getUnderlyingPrice(convertFrom) * amount; // the USD value here has 36 decimals
|
|
154
|
-
return scaledUsdValue / oracle.getUnderlyingPrice(convertTo);
|
|
137
|
+
uint256 scaledUsdValue = oracle.getUnderlyingPrice(address(convertFrom)) * amount; // the USD value here has 36 decimals
|
|
138
|
+
return scaledUsdValue / oracle.getUnderlyingPrice(address(convertTo));
|
|
155
139
|
}
|
|
156
140
|
}
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
2
2
|
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
|
-
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/
|
|
4
|
+
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
|
|
5
|
+
import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol";
|
|
5
6
|
|
|
6
7
|
interface IVToken is IERC20Upgradeable {
|
|
7
8
|
function borrowBalanceCurrent(address borrower) external returns (uint256);
|
|
8
9
|
|
|
9
|
-
function
|
|
10
|
+
function comptroller() external view returns (IComptroller);
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
interface IVBep20 is IVToken {
|
|
13
|
-
function
|
|
14
|
+
function borrowBehalf(address borrower, uint256 borrowAmount) external returns (uint256);
|
|
15
|
+
|
|
16
|
+
function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);
|
|
14
17
|
|
|
15
18
|
function liquidateBorrow(
|
|
16
19
|
address borrower,
|
|
17
20
|
uint256 repayAmount,
|
|
18
21
|
IVToken vTokenCollateral
|
|
19
22
|
) external returns (uint256);
|
|
23
|
+
|
|
24
|
+
function underlying() external view returns (address);
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
interface IVBNB is IVToken {
|
|
@@ -53,6 +58,8 @@ interface IComptroller {
|
|
|
53
58
|
function vaiController() external view returns (IVAIController);
|
|
54
59
|
|
|
55
60
|
function liquidatorContract() external view returns (address);
|
|
61
|
+
|
|
62
|
+
function oracle() external view returns (ResilientOracleInterface);
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
interface ILiquidator {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
|
-
import { SafeERC20Upgradeable
|
|
4
|
+
import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
|
|
5
|
+
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
|
|
5
6
|
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
|
|
6
7
|
import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
|
|
8
|
+
import { MANTISSA_ONE } from "@venusprotocol/solidity-utilities/contracts/constants.sol";
|
|
9
|
+
import { ensureNonzeroAddress } from "@venusprotocol/solidity-utilities/contracts/validators.sol";
|
|
7
10
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { approveOrRevert } from "./approveOrRevert.sol";
|
|
11
|
-
import { ILiquidator, IComptroller, IVToken, IVBep20, IVBNB, IVAIController } from "./Interfaces.sol";
|
|
11
|
+
import { approveOrRevert } from "../lib/approveOrRevert.sol";
|
|
12
|
+
import { ILiquidator, IComptroller, IVToken, IVBep20, IVBNB, IVAIController } from "../InterfacesV8.sol";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @title BUSDLiquidator
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
2
2
|
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
|
-
import "@openzeppelin/contracts-upgradeable/
|
|
5
|
-
import "@openzeppelin/contracts-upgradeable/
|
|
6
|
-
import "@openzeppelin/contracts-upgradeable/
|
|
4
|
+
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
|
|
5
|
+
import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
|
|
6
|
+
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
|
|
7
|
+
import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
|
|
8
|
+
import { ensureNonzeroAddress } from "@venusprotocol/solidity-utilities/contracts/validators.sol";
|
|
7
9
|
|
|
8
|
-
import {
|
|
9
|
-
import { ILiquidator, IComptroller, IVToken, IVBep20, IVBNB, IVAIController } from "./Interfaces.sol";
|
|
10
|
+
import { ILiquidator, IComptroller, IVToken, IVBep20, IVBNB, IVAIController } from "../InterfacesV8.sol";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* @title Liquidator
|
|
@@ -5,7 +5,7 @@ import { SafeERC20Upgradeable, IERC20Upgradeable } from "@openzeppelin/contracts
|
|
|
5
5
|
import { AccessControlledV8 } from "@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol";
|
|
6
6
|
import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol";
|
|
7
7
|
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
|
|
8
|
-
import { MaxLoopsLimitHelper } from "@venusprotocol/
|
|
8
|
+
import { MaxLoopsLimitHelper } from "@venusprotocol/solidity-utilities/contracts/MaxLoopsLimitHelper.sol";
|
|
9
9
|
import { IERC20MetadataUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
|
|
10
10
|
|
|
11
11
|
import { PrimeStorageV1 } from "./PrimeStorage.sol";
|
|
@@ -30,13 +30,13 @@ contract Prime is IPrime, AccessControlledV8, PausableUpgradeable, MaxLoopsLimit
|
|
|
30
30
|
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
31
31
|
uint256 public immutable BLOCKS_PER_YEAR;
|
|
32
32
|
|
|
33
|
-
/// @notice address of
|
|
33
|
+
/// @notice address of wrapped native token contract
|
|
34
34
|
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
35
|
-
address public immutable
|
|
35
|
+
address public immutable WRAPPED_NATIVE_TOKEN;
|
|
36
36
|
|
|
37
|
-
/// @notice address of
|
|
37
|
+
/// @notice address of native market contract
|
|
38
38
|
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
39
|
-
address public immutable
|
|
39
|
+
address public immutable NATIVE_MARKET;
|
|
40
40
|
|
|
41
41
|
/// @notice minimum amount of XVS user needs to stake to become a prime member
|
|
42
42
|
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
@@ -145,8 +145,8 @@ contract Prime is IPrime, AccessControlledV8, PausableUpgradeable, MaxLoopsLimit
|
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* @notice Prime constructor
|
|
148
|
-
* @param
|
|
149
|
-
* @param
|
|
148
|
+
* @param _wrappedNativeToken Address of wrapped native token
|
|
149
|
+
* @param _nativeMarket Address of native market
|
|
150
150
|
* @param _blocksPerYear total blocks per year
|
|
151
151
|
* @param _stakingPeriod total number of seconds for which user needs to stake to claim prime token
|
|
152
152
|
* @param _minimumStakedXVS minimum amount of XVS user needs to stake to become a prime member (scaled by 1e18)
|
|
@@ -156,18 +156,16 @@ contract Prime is IPrime, AccessControlledV8, PausableUpgradeable, MaxLoopsLimit
|
|
|
156
156
|
*/
|
|
157
157
|
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
158
158
|
constructor(
|
|
159
|
-
address
|
|
160
|
-
address
|
|
159
|
+
address _wrappedNativeToken,
|
|
160
|
+
address _nativeMarket,
|
|
161
161
|
uint256 _blocksPerYear,
|
|
162
162
|
uint256 _stakingPeriod,
|
|
163
163
|
uint256 _minimumStakedXVS,
|
|
164
164
|
uint256 _maximumXVSCap
|
|
165
165
|
) {
|
|
166
|
-
if (_wbnb == address(0)) revert InvalidAddress();
|
|
167
|
-
if (_vbnb == address(0)) revert InvalidAddress();
|
|
168
166
|
if (_blocksPerYear == 0) revert InvalidBlocksPerYear();
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
WRAPPED_NATIVE_TOKEN = _wrappedNativeToken;
|
|
168
|
+
NATIVE_MARKET = _nativeMarket;
|
|
171
169
|
BLOCKS_PER_YEAR = _blocksPerYear;
|
|
172
170
|
STAKING_PERIOD = _stakingPeriod;
|
|
173
171
|
MINIMUM_STAKED_XVS = _minimumStakedXVS;
|
|
@@ -1092,13 +1090,13 @@ contract Prime is IPrime, AccessControlledV8, PausableUpgradeable, MaxLoopsLimit
|
|
|
1092
1090
|
}
|
|
1093
1091
|
|
|
1094
1092
|
/**
|
|
1095
|
-
* @notice Returns the underlying token associated with the VToken, or
|
|
1093
|
+
* @notice Returns the underlying token associated with the VToken, or wrapped native token if the market is native market
|
|
1096
1094
|
* @param vToken the market whose underlying token will be returned
|
|
1097
|
-
* @return underlying The address of the underlying token associated with the VToken, or the address of the
|
|
1095
|
+
* @return underlying The address of the underlying token associated with the VToken, or the address of the WRAPPED_NATIVE_TOKEN token if the market is NATIVE_MARKET
|
|
1098
1096
|
*/
|
|
1099
1097
|
function _getUnderlying(address vToken) internal view returns (address) {
|
|
1100
|
-
if (vToken ==
|
|
1101
|
-
return
|
|
1098
|
+
if (vToken == NATIVE_MARKET) {
|
|
1099
|
+
return WRAPPED_NATIVE_TOKEN;
|
|
1102
1100
|
}
|
|
1103
1101
|
return IVToken(vToken).underlying();
|
|
1104
1102
|
}
|
|
@@ -5,7 +5,7 @@ import { SafeERC20Upgradeable, IERC20Upgradeable } from "@openzeppelin/contracts
|
|
|
5
5
|
import { AccessControlledV8 } from "@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol";
|
|
6
6
|
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
|
|
7
7
|
import { IPrimeLiquidityProvider } from "./Interfaces/IPrimeLiquidityProvider.sol";
|
|
8
|
-
import { MaxLoopsLimitHelper } from "@venusprotocol/
|
|
8
|
+
import { MaxLoopsLimitHelper } from "@venusprotocol/solidity-utilities/contracts/MaxLoopsLimitHelper.sol";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @title PrimeLiquidityProvider
|
|
@@ -8,6 +8,8 @@ interface AdminAccounts {
|
|
|
8
8
|
const acmAdminAccount: AdminAccounts = {
|
|
9
9
|
sepolia: "0x94fa6078b6b8a26f0b6edffbe6501b22a10470fb", // SEPOLIA MULTISIG
|
|
10
10
|
ethereum: "0x285960C5B22fD66A736C7136967A3eB15e93CC67", // ETHEREUM MULTISIG
|
|
11
|
+
opbnbtestnet: "0xb15f6EfEbC276A3b9805df81b5FB3D50C2A62BDf", // OPBNBTESTNET MULTISIG
|
|
12
|
+
opbnbmainnet: "0xC46796a21a3A9FAB6546aF3434F2eBfFd0604207", // OPBNBMAINNET MULTISIG
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
@@ -15,7 +17,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
|
15
17
|
const { deploy } = deployments;
|
|
16
18
|
const { deployer } = await getNamedAccounts();
|
|
17
19
|
const deployerSigner = await hre.ethers.getSigner(deployer);
|
|
18
|
-
|
|
19
20
|
const treasuryInstance = await deploy("VTreasuryV8", {
|
|
20
21
|
from: deployer,
|
|
21
22
|
args: [],
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DeployFunction } from "hardhat-deploy/types";
|
|
2
|
+
import { HardhatRuntimeEnvironment } from "hardhat/types";
|
|
3
|
+
|
|
4
|
+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
5
|
+
const { deployments, getNamedAccounts } = hre;
|
|
6
|
+
const { deploy } = deployments;
|
|
7
|
+
const { deployer } = await getNamedAccounts();
|
|
8
|
+
|
|
9
|
+
await deploy("XVS", {
|
|
10
|
+
from: deployer,
|
|
11
|
+
args: [deployer],
|
|
12
|
+
log: true,
|
|
13
|
+
autoMine: true,
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
func.tags = ["xvs"];
|
|
18
|
+
|
|
19
|
+
func.skip = async (hre: HardhatRuntimeEnvironment) => hre.network.live;
|
|
20
|
+
|
|
21
|
+
export default func;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ethers } from "hardhat";
|
|
2
|
+
import { DeployFunction } from "hardhat-deploy/types";
|
|
3
|
+
import { HardhatRuntimeEnvironment } from "hardhat/types";
|
|
4
|
+
|
|
5
|
+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
6
|
+
const { deployments, getNamedAccounts } = hre;
|
|
7
|
+
const { deploy } = deployments;
|
|
8
|
+
const { deployer } = await getNamedAccounts();
|
|
9
|
+
|
|
10
|
+
const xvsVaultDeployment = await deploy("XVSVault", {
|
|
11
|
+
from: deployer,
|
|
12
|
+
args: [],
|
|
13
|
+
log: true,
|
|
14
|
+
autoMine: true,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const xvsVaultAddress = xvsVaultDeployment.address;
|
|
18
|
+
|
|
19
|
+
const xvsVaultProxyDeployment = await deploy("XVSVaultProxy", {
|
|
20
|
+
from: deployer,
|
|
21
|
+
args: [],
|
|
22
|
+
log: true,
|
|
23
|
+
autoMine: true,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const xvsVaultProxyAddress = xvsVaultProxyDeployment.address;
|
|
27
|
+
|
|
28
|
+
await deploy("XVSStore", {
|
|
29
|
+
from: deployer,
|
|
30
|
+
args: [],
|
|
31
|
+
log: true,
|
|
32
|
+
autoMine: true,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const xvsVault = await ethers.getContract("XVSVault");
|
|
36
|
+
const xvsStore = await ethers.getContract("XVSStore");
|
|
37
|
+
const xvsVaultProxy = await ethers.getContract("XVSVaultProxy");
|
|
38
|
+
|
|
39
|
+
// Become Implementation of XVSVaultProxy
|
|
40
|
+
const tx = await xvsVaultProxy._setPendingImplementation(xvsVaultAddress);
|
|
41
|
+
await tx.wait();
|
|
42
|
+
|
|
43
|
+
await xvsVault._become(xvsVaultProxyAddress);
|
|
44
|
+
await tx.wait();
|
|
45
|
+
|
|
46
|
+
// Set new owner to xvs store
|
|
47
|
+
await xvsStore.setNewOwner(xvsVaultProxyAddress);
|
|
48
|
+
await tx.wait();
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
func.tags = ["xvs-vault"];
|
|
52
|
+
|
|
53
|
+
export default func;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ethers } from "hardhat";
|
|
2
|
+
import { DeployFunction } from "hardhat-deploy/types";
|
|
3
|
+
import { HardhatRuntimeEnvironment } from "hardhat/types";
|
|
4
|
+
|
|
5
|
+
interface AdminAccounts {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
}
|
|
8
|
+
const adminAccount: AdminAccounts = {
|
|
9
|
+
sepolia: "0x94fa6078b6b8a26f0b6edffbe6501b22a10470fb", // SEPOLIA MULTISIG
|
|
10
|
+
ethereum: "0x285960C5B22fD66A736C7136967A3eB15e93CC67", // ETHEREUM MULTISIG
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
14
|
+
const { getNamedAccounts } = hre;
|
|
15
|
+
const { deployer } = await getNamedAccounts();
|
|
16
|
+
|
|
17
|
+
const accessControlManager = await ethers.getContract("AccessControlManager");
|
|
18
|
+
|
|
19
|
+
const xvs = await ethers.getContract("XVS");
|
|
20
|
+
const xvsVaultProxyDeployment = await ethers.getContract("XVSVaultProxy");
|
|
21
|
+
const xvsStoreDeployment = await ethers.getContract("XVSStore");
|
|
22
|
+
|
|
23
|
+
const xvsVaultProxy = await ethers.getContractAt("XVSVault", xvsVaultProxyDeployment.address);
|
|
24
|
+
|
|
25
|
+
let txn = await xvsVaultProxy.setXvsStore(xvs.address, xvsStoreDeployment.address);
|
|
26
|
+
await txn.wait();
|
|
27
|
+
|
|
28
|
+
txn = await xvsVaultProxy.setAccessControl(accessControlManager.address);
|
|
29
|
+
await txn.wait();
|
|
30
|
+
|
|
31
|
+
if (!hre.network.live) {
|
|
32
|
+
const tx = await accessControlManager.giveCallPermission(
|
|
33
|
+
ethers.constants.AddressZero,
|
|
34
|
+
"add(address,uint256,address,uint256,uint256)",
|
|
35
|
+
deployer,
|
|
36
|
+
);
|
|
37
|
+
await tx.wait();
|
|
38
|
+
|
|
39
|
+
// Add token pool to xvs vault
|
|
40
|
+
const allocPoint = 100;
|
|
41
|
+
const token = xvs.address;
|
|
42
|
+
const rewardToken = xvs.address;
|
|
43
|
+
const rewardPerBlock = "61805555555555555";
|
|
44
|
+
const lockPeriod = 604800;
|
|
45
|
+
|
|
46
|
+
await xvsVaultProxy.add(rewardToken, allocPoint, token, rewardPerBlock, lockPeriod);
|
|
47
|
+
} else {
|
|
48
|
+
const owner = adminAccount[hre.network.name];
|
|
49
|
+
console.log("Please accept ownership of vault and store");
|
|
50
|
+
txn = await xvsVaultProxyDeployment._setPendingAdmin(owner);
|
|
51
|
+
await txn.wait();
|
|
52
|
+
|
|
53
|
+
txn = await xvsStoreDeployment.setPendingAdmin(owner);
|
|
54
|
+
await txn.wait();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
func.tags = ["xvs-vault"];
|
|
59
|
+
|
|
60
|
+
export default func;
|