@venusprotocol/venus-protocol 7.1.0-dev.1 → 7.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/@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 +1 -1
- package/artifacts/@venusprotocol/solidity-utilities/contracts/TimeManagerV8.sol/TimeManagerV8.dbg.json +1 -1
- package/artifacts/build-info/{5158b939f09b056403dc17322b3b5c7a.json → 23955c54eec3e914a4d10c9d990fdb4c.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 +1 -1
- package/artifacts/contracts/DelegateBorrowers/MoveDebtDelegate.sol/MoveDebtDelegate.json +115 -22
- package/artifacts/contracts/DelegateBorrowers/SwapDebtDelegate.sol/SwapDebtDelegate.dbg.json +1 -1
- package/artifacts/contracts/Governance/TokenRedeemer.sol/TokenRedeemer.dbg.json +1 -1
- package/artifacts/contracts/InterfacesV8.sol/IComptroller.dbg.json +1 -1
- package/artifacts/contracts/InterfacesV8.sol/ILiquidator.dbg.json +1 -1
- package/artifacts/contracts/InterfacesV8.sol/IVAIController.dbg.json +1 -1
- package/artifacts/contracts/InterfacesV8.sol/IVBNB.dbg.json +1 -1
- package/artifacts/contracts/InterfacesV8.sol/IVBep20.dbg.json +1 -1
- package/artifacts/contracts/InterfacesV8.sol/IVToken.dbg.json +1 -1
- package/artifacts/contracts/Liquidator/BUSDLiquidator.sol/BUSDLiquidator.dbg.json +1 -1
- package/artifacts/contracts/Liquidator/Liquidator.sol/Liquidator.dbg.json +1 -1
- 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/IPoolRegistry.sol/PoolRegistryInterface.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/PrimeLiquidityProvider.sol/PrimeLiquidityProvider.dbg.json +1 -1
- package/artifacts/contracts/Tokens/Prime/PrimeLiquidityProviderStorage.sol/PrimeLiquidityProviderStorageV1.dbg.json +1 -1
- 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/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/contracts/DelegateBorrowers/MoveDebtDelegate.sol +60 -17
- package/deploy/005-update-governance.ts +15 -6
- package/deploy/008-deploy-prime.ts +44 -35
- package/deploy/009-configure-vaults.ts +1 -0
- package/deployments/bscmainnet/MoveDebtDelegate.json +592 -0
- package/deployments/bscmainnet/MoveDebtDelegate_Implementation.json +766 -0
- package/deployments/bscmainnet/MoveDebtDelegate_Proxy.json +253 -0
- package/deployments/bscmainnet/solcInputs/03a6c42b57bcdc7c1b76c0f541accfdb.json +69 -0
- package/deployments/bscmainnet/solcInputs/1dff3b4c1e459128170e9af3e75c7e17.json +72 -0
- package/deployments/bscmainnet.json +1080 -0
- package/deployments/bscmainnet_addresses.json +3 -0
- package/deployments/ethereum/XVSStore.json +374 -0
- package/deployments/ethereum/XVSVault.json +2373 -0
- package/deployments/ethereum/XVSVaultProxy.json +352 -0
- package/deployments/ethereum/solcInputs/7830d2b3dd486e9651687b362529ec15.json +345 -0
- package/deployments/ethereum.json +2040 -0
- package/deployments/ethereum_addresses.json +4 -1
- package/deployments/opbnbtestnet/XVSStore.json +374 -0
- package/deployments/opbnbtestnet/XVSVault.json +2373 -0
- package/deployments/opbnbtestnet/XVSVaultProxy.json +352 -0
- package/deployments/opbnbtestnet/solcInputs/6955f97c86c4a782497d93a270048fd7.json +345 -0
- package/deployments/opbnbtestnet.json +2040 -0
- package/deployments/opbnbtestnet_addresses.json +4 -1
- package/deployments/sepolia/Prime.json +2047 -0
- package/deployments/sepolia/PrimeLiquidityProvider.json +1118 -0
- package/deployments/sepolia/PrimeLiquidityProvider_Implementation.json +1415 -0
- package/deployments/sepolia/PrimeLiquidityProvider_Proxy.json +277 -0
- package/deployments/sepolia/Prime_Implementation.json +2949 -0
- package/deployments/sepolia/Prime_Proxy.json +287 -0
- package/deployments/sepolia/solcInputs/0e89febeebc7444140de8e67c9067d2c.json +78 -0
- package/deployments/sepolia/solcInputs/12c4cccf56f76ea87e105d789e4ae67f.json +228 -0
- package/deployments/sepolia/solcInputs/eda719eaabd93845f8c222de346f78bb.json +84 -0
- package/deployments/sepolia.json +5823 -0
- package/deployments/sepolia_addresses.json +6 -0
- package/dist/deploy/005-update-governance.js +11 -5
- package/dist/deploy/008-deploy-prime.js +36 -33
- package/dist/deploy/009-configure-vaults.js +2 -1
- package/dist/deployments/bscmainnet.json +1080 -0
- package/dist/deployments/sepolia.json +8063 -0
- package/dist/hardhat.config.js +7 -2
- package/dist/helpers/address.d.ts +28 -48
- package/dist/helpers/address.js +15 -0
- package/dist/typechain/contracts/DelegateBorrowers/MoveDebtDelegate.d.ts +64 -20
- package/dist/typechain/factories/contracts/DelegateBorrowers/MoveDebtDelegate__factory.d.ts +92 -20
- package/dist/typechain/factories/contracts/DelegateBorrowers/MoveDebtDelegate__factory.js +118 -25
- package/package.json +4 -2
|
@@ -7,6 +7,7 @@ import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/
|
|
|
7
7
|
import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
|
|
8
8
|
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
|
|
9
9
|
import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol";
|
|
10
|
+
import { ensureNonzeroAddress } from "@venusprotocol/solidity-utilities/contracts/validators.sol";
|
|
10
11
|
|
|
11
12
|
import { approveOrRevert } from "../lib/approveOrRevert.sol";
|
|
12
13
|
import { IVBep20, IComptroller } from "../InterfacesV8.sol";
|
|
@@ -15,9 +16,8 @@ contract MoveDebtDelegate is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable
|
|
|
15
16
|
/// @dev VToken return value signalling about successful execution
|
|
16
17
|
uint256 internal constant NO_ERROR = 0;
|
|
17
18
|
|
|
18
|
-
/// @notice
|
|
19
|
-
|
|
20
|
-
IVBep20 public immutable vTokenToRepay;
|
|
19
|
+
/// @notice A wildcard indicating that repayment is allowed for _any_ user in the market
|
|
20
|
+
address public constant ANY_USER = address(1);
|
|
21
21
|
|
|
22
22
|
/// @notice User to borrow on behalf of
|
|
23
23
|
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
@@ -26,15 +26,22 @@ contract MoveDebtDelegate is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable
|
|
|
26
26
|
/// @notice Whether to allow borrowing from the corresponding vToken
|
|
27
27
|
mapping(address => bool) public borrowAllowed;
|
|
28
28
|
|
|
29
|
+
/// @notice Whether to allow repaying to the corresponding vToken on behalf of
|
|
30
|
+
/// a certain user. Use ANY_USER to check if repayment is allowed for any user.
|
|
31
|
+
mapping(address => mapping(address => bool)) public repaymentAllowed;
|
|
32
|
+
|
|
33
|
+
/// @notice Emitted when vToken is allowed or denied to be borrowed from
|
|
34
|
+
event BorrowAllowedSet(address indexed vTokenToBorrow, bool allowed);
|
|
35
|
+
|
|
29
36
|
/// @notice Emitted when vToken is allowed or denied to be borrowed from
|
|
30
|
-
event
|
|
37
|
+
event RepaymentAllowedSet(address indexed vTokenToRepay, address indexed originalBorrower, bool allowed);
|
|
31
38
|
|
|
32
39
|
/// @notice Emitted if debt is swapped successfully
|
|
33
40
|
event DebtMoved(
|
|
34
41
|
address indexed originalBorrower,
|
|
35
|
-
address vTokenRepaid,
|
|
42
|
+
address indexed vTokenRepaid,
|
|
36
43
|
uint256 repaidAmount,
|
|
37
|
-
address
|
|
44
|
+
address newBorrower,
|
|
38
45
|
address indexed vTokenBorrowed,
|
|
39
46
|
uint256 borrowedAmount
|
|
40
47
|
);
|
|
@@ -55,14 +62,15 @@ contract MoveDebtDelegate is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable
|
|
|
55
62
|
/// @notice Thrown if borrowing from the corresponding vToken is not allowed
|
|
56
63
|
error BorrowNotAllowed(address vToken);
|
|
57
64
|
|
|
65
|
+
/// @notice Thrown if repaying the debts of the borrower to the corresponding vToken is not allowed
|
|
66
|
+
error RepaymentNotAllowed(address vToken, address borrower);
|
|
67
|
+
|
|
58
68
|
using SafeERC20Upgradeable for IERC20Upgradeable;
|
|
59
69
|
|
|
60
70
|
/// @notice Constructor for the implementation contract. Sets immutable variables.
|
|
61
|
-
/// @param vTokenToRepay_ VToken to repay the debt to
|
|
62
71
|
/// @param newBorrower_ User to borrow on behalf of
|
|
63
72
|
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
64
|
-
constructor(
|
|
65
|
-
vTokenToRepay = vTokenToRepay_;
|
|
73
|
+
constructor(address newBorrower_) {
|
|
66
74
|
newBorrower = newBorrower_;
|
|
67
75
|
_disableInitializers();
|
|
68
76
|
}
|
|
@@ -74,16 +82,29 @@ contract MoveDebtDelegate is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable
|
|
|
74
82
|
|
|
75
83
|
/**
|
|
76
84
|
* @notice Repays originalBorrower's borrow in vTokenToRepay.underlying() and borrows
|
|
77
|
-
* vTokenToBorrow.underlying() on behalf of newBorrower
|
|
85
|
+
* vTokenToBorrow.underlying() on behalf of newBorrower.
|
|
86
|
+
*
|
|
78
87
|
* @param originalBorrower The address of the borrower, whose debt to repay
|
|
88
|
+
* @param vTokenToRepay VToken to repay to on behalf of originalBorrower
|
|
79
89
|
* @param repayAmount The amount to repay in terms of vTokenToRepay.underlying()
|
|
80
90
|
* @param vTokenToBorrow VToken to borrow from
|
|
81
91
|
*/
|
|
82
|
-
function moveDebt(
|
|
92
|
+
function moveDebt(
|
|
93
|
+
IVBep20 vTokenToRepay,
|
|
94
|
+
address originalBorrower,
|
|
95
|
+
uint256 repayAmount,
|
|
96
|
+
IVBep20 vTokenToBorrow
|
|
97
|
+
) external nonReentrant {
|
|
83
98
|
if (!borrowAllowed[address(vTokenToBorrow)]) {
|
|
84
99
|
revert BorrowNotAllowed(address(vTokenToBorrow));
|
|
85
100
|
}
|
|
86
|
-
|
|
101
|
+
|
|
102
|
+
mapping(address => bool) storage repaymentAllowedFor = repaymentAllowed[address(vTokenToRepay)];
|
|
103
|
+
if (!repaymentAllowedFor[ANY_USER] && !repaymentAllowedFor[originalBorrower]) {
|
|
104
|
+
revert RepaymentNotAllowed(address(vTokenToRepay), originalBorrower);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
uint256 actualRepaymentAmount = _repay(vTokenToRepay, originalBorrower, repayAmount);
|
|
87
108
|
uint256 amountToBorrow = _convert(vTokenToRepay, vTokenToBorrow, actualRepaymentAmount);
|
|
88
109
|
_borrow(vTokenToBorrow, amountToBorrow);
|
|
89
110
|
emit DebtMoved(
|
|
@@ -102,12 +123,29 @@ contract MoveDebtDelegate is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable
|
|
|
102
123
|
* @param allow Whether to allow borrowing from the corresponding vToken
|
|
103
124
|
*/
|
|
104
125
|
function setBorrowAllowed(address vTokenToBorrow, bool allow) external onlyOwner {
|
|
126
|
+
ensureNonzeroAddress(vTokenToBorrow);
|
|
105
127
|
if (borrowAllowed[vTokenToBorrow] != allow) {
|
|
106
128
|
borrowAllowed[vTokenToBorrow] = allow;
|
|
107
129
|
emit BorrowAllowedSet(vTokenToBorrow, allow);
|
|
108
130
|
}
|
|
109
131
|
}
|
|
110
132
|
|
|
133
|
+
/**
|
|
134
|
+
* @notice Allows or denies repaying the debts of originalBorrower to the corresponding vToken
|
|
135
|
+
* @param vTokenToRepay VToken to repay to
|
|
136
|
+
* @param originalBorrower The address of the borrower, whose debt to repay (or ANY_USER to allow
|
|
137
|
+
* repayments for all users in the market, e.g. if the market is going to be deprecated soon)
|
|
138
|
+
* @param allow Whether to allow repaying to the corresponding vToken on behalf of originalBorrower
|
|
139
|
+
*/
|
|
140
|
+
function setRepaymentAllowed(address vTokenToRepay, address originalBorrower, bool allow) external onlyOwner {
|
|
141
|
+
ensureNonzeroAddress(vTokenToRepay);
|
|
142
|
+
ensureNonzeroAddress(originalBorrower);
|
|
143
|
+
if (repaymentAllowed[vTokenToRepay][originalBorrower] != allow) {
|
|
144
|
+
repaymentAllowed[vTokenToRepay][originalBorrower] = allow;
|
|
145
|
+
emit RepaymentAllowedSet(vTokenToRepay, originalBorrower, allow);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
111
149
|
/**
|
|
112
150
|
* @notice Transfers tokens, accidentially sent to this contract, to the owner
|
|
113
151
|
* @param token ERC-20 token to sweep
|
|
@@ -120,10 +158,15 @@ contract MoveDebtDelegate is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable
|
|
|
120
158
|
|
|
121
159
|
/**
|
|
122
160
|
* @dev Transfers the funds from the sender and repays a borrow in vToken on behalf of the borrower
|
|
161
|
+
* @param vTokenToRepay VToken to repay to
|
|
123
162
|
* @param borrower The address of the borrower, whose debt to repay
|
|
124
163
|
* @param repayAmount The amount to repay in terms of underlying
|
|
125
164
|
*/
|
|
126
|
-
function _repay(
|
|
165
|
+
function _repay(
|
|
166
|
+
IVBep20 vTokenToRepay,
|
|
167
|
+
address borrower,
|
|
168
|
+
uint256 repayAmount
|
|
169
|
+
) internal returns (uint256 actualRepaymentAmount) {
|
|
127
170
|
IERC20Upgradeable underlying = IERC20Upgradeable(vTokenToRepay.underlying());
|
|
128
171
|
uint256 balanceBefore = underlying.balanceOf(address(this));
|
|
129
172
|
underlying.safeTransferFrom(msg.sender, address(this), repayAmount);
|
|
@@ -143,13 +186,13 @@ contract MoveDebtDelegate is Ownable2StepUpgradeable, ReentrancyGuardUpgradeable
|
|
|
143
186
|
|
|
144
187
|
/**
|
|
145
188
|
* @dev Borrows in vToken on behalf of the borrower and transfers the funds to the sender
|
|
146
|
-
* @param
|
|
189
|
+
* @param vTokenToBorrow VToken to borrow from
|
|
147
190
|
* @param borrowAmount The amount to borrow in terms of underlying
|
|
148
191
|
*/
|
|
149
|
-
function _borrow(IVBep20
|
|
150
|
-
IERC20Upgradeable underlying = IERC20Upgradeable(
|
|
192
|
+
function _borrow(IVBep20 vTokenToBorrow, uint256 borrowAmount) internal {
|
|
193
|
+
IERC20Upgradeable underlying = IERC20Upgradeable(vTokenToBorrow.underlying());
|
|
151
194
|
uint256 balanceBefore = underlying.balanceOf(address(this));
|
|
152
|
-
uint256 err =
|
|
195
|
+
uint256 err = vTokenToBorrow.borrowBehalf(newBorrower, borrowAmount);
|
|
153
196
|
if (err != NO_ERROR) {
|
|
154
197
|
revert BorrowFailed(err);
|
|
155
198
|
}
|
|
@@ -55,12 +55,21 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
|
55
55
|
const { deployer } = await getNamedAccounts();
|
|
56
56
|
const { deploy } = deployments;
|
|
57
57
|
const addresses = ADDRESSES[networkName];
|
|
58
|
-
|
|
58
|
+
|
|
59
|
+
if (!addresses.governorProxy || !addresses.xvsVault || !addresses.normalVipTimelock) {
|
|
60
|
+
throw new Error(`GovernorProxy, XVSVault and NormalTimelock addresses must be defined in ${networkName}`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const governorProxyAddress = addresses.governorProxy.toString();
|
|
64
|
+
const xvsVaultAddress = addresses.xvsVault.toString();
|
|
65
|
+
const normalVipTimelockAddress = addresses.normalVipTimelock.toString();
|
|
66
|
+
|
|
67
|
+
const governorProxy = await ethers.getContractAt("GovernorBravoDelegator", governorProxyAddress);
|
|
59
68
|
|
|
60
69
|
const timeLockFastTrack = await deploy("Timelock_FastTrack", {
|
|
61
70
|
contract: "Timelock",
|
|
62
71
|
from: deployer,
|
|
63
|
-
args: [
|
|
72
|
+
args: [governorProxyAddress, timelockDelays[networkName].FAST_TRACK],
|
|
64
73
|
log: true,
|
|
65
74
|
autoMine: true,
|
|
66
75
|
});
|
|
@@ -68,7 +77,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
|
68
77
|
const timeLockCritical = await deploy("Timelock_Critical", {
|
|
69
78
|
contract: "Timelock",
|
|
70
79
|
from: deployer,
|
|
71
|
-
args: [
|
|
80
|
+
args: [governorProxyAddress, timelockDelays[networkName].CRITICAL],
|
|
72
81
|
log: true,
|
|
73
82
|
autoMine: true,
|
|
74
83
|
});
|
|
@@ -89,12 +98,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
|
89
98
|
}
|
|
90
99
|
const governorProxy_Impl = (await ethers.getContractAt(
|
|
91
100
|
"GovernorBravoDelegate",
|
|
92
|
-
|
|
101
|
+
governorProxyAddress,
|
|
93
102
|
)) as GovernorBravoDelegate;
|
|
94
103
|
tx = await governorProxy_Impl.initialize(
|
|
95
|
-
|
|
104
|
+
xvsVaultAddress,
|
|
96
105
|
PROPOSAL_CONFIGS,
|
|
97
|
-
[
|
|
106
|
+
[normalVipTimelockAddress, timeLockFastTrack.address, timeLockCritical.address],
|
|
98
107
|
deployer,
|
|
99
108
|
);
|
|
100
109
|
await tx.wait();
|
|
@@ -9,21 +9,47 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
|
9
9
|
const { deploy } = deployments;
|
|
10
10
|
const { deployer } = await getNamedAccounts();
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
const
|
|
12
|
+
const TEN_MINUTES = 60 * 10;
|
|
13
|
+
const NINETY_DAYS = 90 * 24 * 60 * 60;
|
|
14
|
+
const ZERO_ADDRESS = ethers.constants.AddressZero;
|
|
15
|
+
|
|
16
|
+
interface Config {
|
|
17
|
+
[key: string]: number;
|
|
18
|
+
}
|
|
19
|
+
const stakingPeriod: Config = {
|
|
20
|
+
bsctestnet: TEN_MINUTES,
|
|
21
|
+
sepolia: TEN_MINUTES,
|
|
22
|
+
bscmainnet: NINETY_DAYS,
|
|
23
|
+
ethereum: NINETY_DAYS,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const xVSVaultPoolId: Config = {
|
|
27
|
+
bsctestnet: 1,
|
|
28
|
+
sepolia: 0,
|
|
29
|
+
bscmainnet: 0,
|
|
30
|
+
ethereum: 0,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const blocksPerYear: Config = {
|
|
34
|
+
bsctestnet: 10_512_000, // 3 sec per block
|
|
35
|
+
sepolia: 2_628_000, // 12 sec per block
|
|
36
|
+
bscmainnet: 10_512_000,
|
|
37
|
+
ethereum: 2_628_000,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const networkName: string = network.name;
|
|
14
41
|
const maximumXVSCap = ethers.utils.parseEther("100000");
|
|
15
42
|
const minimumXVS = ethers.utils.parseEther("1000");
|
|
16
|
-
const xVSVaultPoolId = networkName === "bscmainnet" ? 0 : 1;
|
|
17
43
|
const xvsVaultAlphaNumerator = 1;
|
|
18
44
|
const xvsVaultAlphaDenominator = 2;
|
|
19
|
-
const blocksPeryear = 10512000;
|
|
20
45
|
const loopsLimit = 20;
|
|
46
|
+
const isTimeBased = false; // revise this value when deploying on L2s
|
|
21
47
|
|
|
22
48
|
await deploy("PrimeLiquidityProvider", {
|
|
23
49
|
from: deployer,
|
|
24
50
|
log: true,
|
|
25
51
|
deterministicDeployment: false,
|
|
26
|
-
args: [],
|
|
52
|
+
args: [isTimeBased, blocksPerYear[networkName]],
|
|
27
53
|
proxy: {
|
|
28
54
|
owner: ADDRESSES[networkName].normalVipTimelock,
|
|
29
55
|
proxyContract: "OpenZeppelinTransparentProxy",
|
|
@@ -36,17 +62,22 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
|
36
62
|
|
|
37
63
|
const plp = await ethers.getContract("PrimeLiquidityProvider");
|
|
38
64
|
|
|
65
|
+
const corePoolAddress = ADDRESSES[networkName].unitroller;
|
|
66
|
+
const wrappedNativeToken = ADDRESSES[networkName].wbnb;
|
|
67
|
+
const nativeMarket = ADDRESSES[networkName].vbnb;
|
|
68
|
+
|
|
39
69
|
await deploy("Prime", {
|
|
40
70
|
from: deployer,
|
|
41
71
|
log: true,
|
|
42
72
|
deterministicDeployment: false,
|
|
43
73
|
args: [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
stakingPeriod,
|
|
74
|
+
wrappedNativeToken ? wrappedNativeToken : ZERO_ADDRESS,
|
|
75
|
+
nativeMarket ? nativeMarket : ZERO_ADDRESS,
|
|
76
|
+
blocksPerYear[networkName],
|
|
77
|
+
stakingPeriod[networkName],
|
|
48
78
|
minimumXVS,
|
|
49
79
|
maximumXVSCap,
|
|
80
|
+
isTimeBased,
|
|
50
81
|
],
|
|
51
82
|
proxy: {
|
|
52
83
|
owner: ADDRESSES[networkName].normalVipTimelock,
|
|
@@ -56,12 +87,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
|
56
87
|
args: [
|
|
57
88
|
ADDRESSES[networkName].xvsVault,
|
|
58
89
|
ADDRESSES[networkName].xvs,
|
|
59
|
-
xVSVaultPoolId,
|
|
90
|
+
xVSVaultPoolId[networkName],
|
|
60
91
|
xvsVaultAlphaNumerator,
|
|
61
92
|
xvsVaultAlphaDenominator,
|
|
62
93
|
ADDRESSES[networkName].acm,
|
|
63
94
|
plp.address,
|
|
64
|
-
|
|
95
|
+
corePoolAddress ? corePoolAddress : ZERO_ADDRESS,
|
|
65
96
|
ADDRESSES[networkName].oracle,
|
|
66
97
|
loopsLimit,
|
|
67
98
|
],
|
|
@@ -69,32 +100,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
|
69
100
|
},
|
|
70
101
|
});
|
|
71
102
|
|
|
72
|
-
await
|
|
73
|
-
|
|
74
|
-
log: true,
|
|
75
|
-
deterministicDeployment: false,
|
|
76
|
-
args: [],
|
|
77
|
-
proxy: false,
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
await deploy("PolicyFacet", {
|
|
81
|
-
from: deployer,
|
|
82
|
-
log: true,
|
|
83
|
-
deterministicDeployment: false,
|
|
84
|
-
args: [],
|
|
85
|
-
proxy: false,
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
await deploy("SetterFacet", {
|
|
89
|
-
from: deployer,
|
|
90
|
-
log: true,
|
|
91
|
-
deterministicDeployment: false,
|
|
92
|
-
args: [],
|
|
93
|
-
proxy: false,
|
|
94
|
-
});
|
|
103
|
+
const prime = await ethers.getContract("Prime");
|
|
104
|
+
await prime.initializeV2(ADDRESSES[networkName].poolRegistry);
|
|
95
105
|
|
|
96
106
|
console.log("Transferring Prime ownership to Timelock");
|
|
97
|
-
const prime = await ethers.getContract("Prime");
|
|
98
107
|
await prime.transferOwnership(ADDRESSES[networkName].normalVipTimelock);
|
|
99
108
|
|
|
100
109
|
console.log("Transferring PLP ownership to Timelock");
|
|
@@ -8,6 +8,7 @@ interface AdminAccounts {
|
|
|
8
8
|
const adminAccount: AdminAccounts = {
|
|
9
9
|
sepolia: "0x94fa6078b6b8a26f0b6edffbe6501b22a10470fb", // SEPOLIA MULTISIG
|
|
10
10
|
ethereum: "0x285960C5B22fD66A736C7136967A3eB15e93CC67", // ETHEREUM MULTISIG
|
|
11
|
+
opbnbtestnet: "0xb15f6EfEbC276A3b9805df81b5FB3D50C2A62BDf", // OPBNBTESTNET MULTISIG
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|