diff --git a/contracts/governance/Staking/StakingProxy.sol b/contracts/governance/Staking/StakingProxy.sol deleted file mode 100644 index 91db72b3c..000000000 --- a/contracts/governance/Staking/StakingProxy.sol +++ /dev/null @@ -1,22 +0,0 @@ -pragma solidity ^0.5.17; - -import "./modules/shared/StakingStorageShared.sol"; -import "../../proxy/UpgradableProxy.sol"; - -/** - * @title Staking Proxy contract. - * @dev Staking contract should be upgradable, use UpgradableProxy. - * StakingStorage is deployed with the upgradable functionality - * by using this contract instead, that inherits from UpgradableProxy - * the possibility of being enhanced and re-deployed. - * */ -contract StakingProxy is StakingStorageShared, UpgradableProxy { - /** - * @notice Construct a new staking contract. - * @param SOV The address of the SOV token address. - */ - constructor(address SOV) public { - SOVToken = IERC20(SOV); - kickoffTS = block.timestamp; - } -} diff --git a/contracts/governance/Staking/modules/StakingStakeModule.sol b/contracts/governance/Staking/modules/StakingStakeModule.sol index 831d2e769..164edb0ed 100644 --- a/contracts/governance/Staking/modules/StakingStakeModule.sol +++ b/contracts/governance/Staking/modules/StakingStakeModule.sol @@ -248,7 +248,7 @@ contract StakingStakeModule is IFunctionsList, StakingShared, CheckpointsShared, /// @dev Retrieve the SOV tokens. if (transferToken) require( - SOVToken.transferFrom(sender, address(this), amount), + _SOVToken().transferFrom(sender, address(this), amount), "Should transfer tokens successfully" ); // IS10 @@ -346,7 +346,7 @@ contract StakingStakeModule is IFunctionsList, StakingShared, CheckpointsShared, /// @dev transferring total SOV amount before staking require( - SOVToken.transferFrom(msg.sender, address(this), amount), + _SOVToken().transferFrom(msg.sender, address(this), amount), "Should transfer tokens successfully" ); // SS10 /// @dev stakedPerInterval might lose some dust on rounding. Add it to the first staking date. @@ -384,7 +384,7 @@ contract StakingStakeModule is IFunctionsList, StakingShared, CheckpointsShared, * @return The number of tokens held. * */ function balanceOf(address account) external view returns (uint96 balance) { - for (uint256 i = kickoffTS; i <= block.timestamp + MAX_DURATION; i += TWO_WEEKS) { + for (uint256 i = _kickoffTS(); i <= block.timestamp + MAX_DURATION; i += TWO_WEEKS) { balance = add96(balance, _currentBalance(account, i), "Staking::balanceOf: overflow"); // S12 } } @@ -411,7 +411,7 @@ contract StakingStakeModule is IFunctionsList, StakingShared, CheckpointsShared, /// @dev Calculate stakes. uint256 count = 0; /// @dev We need to iterate from first possible stake date after deployment to the latest from current time. - for (uint256 i = kickoffTS + TWO_WEEKS; i <= latest; i += TWO_WEEKS) { + for (uint256 i = _kickoffTS() + TWO_WEEKS; i <= latest; i += TWO_WEEKS) { if (_currentBalance(account, i) > 0) { count++; } @@ -421,7 +421,7 @@ contract StakingStakeModule is IFunctionsList, StakingShared, CheckpointsShared, /// @dev We need to iterate from first possible stake date after deployment to the latest from current time. uint256 j = 0; - for (uint256 i = kickoffTS + TWO_WEEKS; i <= latest; i += TWO_WEEKS) { + for (uint256 i = _kickoffTS() + TWO_WEEKS; i <= latest; i += TWO_WEEKS) { uint96 balance = _currentBalance(account, i); if (balance > 0) { dates[j] = i; @@ -437,7 +437,7 @@ contract StakingStakeModule is IFunctionsList, StakingShared, CheckpointsShared, * @return The address of SOV token. * */ function _getToken() internal view returns (address) { - return address(SOVToken); + return address(_SOVToken()); } /** diff --git a/contracts/governance/Staking/modules/StakingStorageModule.sol b/contracts/governance/Staking/modules/StakingStorageModule.sol index babbe22cd..5edb993e4 100644 --- a/contracts/governance/Staking/modules/StakingStorageModule.sol +++ b/contracts/governance/Staking/modules/StakingStorageModule.sol @@ -66,8 +66,16 @@ contract StakingStorageModule is IFunctionsList, StakingStorageShared { return maxVestingWithdrawIterations; } + function kickoffTS() public view returns (uint256) { + return _kickoffTS(); + } + + function SOVToken() public view returns (IERC20) { + return _SOVToken(); + } + function getFunctionsList() external pure returns (bytes4[] memory) { - bytes4[] memory functionsList = new bytes4[](31); + bytes4[] memory functionsList = new bytes4[](32); functionsList[0] = this.getStorageMaxDurationToStakeTokens.selector; functionsList[1] = this.getStorageMaxVotingWeight.selector; functionsList[2] = this.getStorageWeightFactor.selector; @@ -99,6 +107,7 @@ contract StakingStorageModule is IFunctionsList, StakingStorageShared { functionsList[28] = this.paused.selector; functionsList[29] = this.frozen.selector; functionsList[30] = this.getMaxVestingWithdrawIterations.selector; + functionsList[31] = this.MAX_DURATION.selector; return functionsList; } diff --git a/contracts/governance/Staking/modules/StakingVestingModule.sol b/contracts/governance/Staking/modules/StakingVestingModule.sol index bd325553b..097657232 100644 --- a/contracts/governance/Staking/modules/StakingVestingModule.sol +++ b/contracts/governance/Staking/modules/StakingVestingModule.sol @@ -49,13 +49,13 @@ contract StakingVestingModule is IFunctionsList, StakingShared { */ function _setVestingStake(uint256 lockedTS, uint96 value) internal { require( - lockedTS > kickoffTS, + lockedTS > _kickoffTS(), "Invalid lock dates: must greater than contract creation timestamp" ); // locked date must be multiples of 14 days / TWO_WEEKS require( - (lockedTS - kickoffTS) % TWO_WEEKS == 0, + (lockedTS - _kickoffTS()) % TWO_WEEKS == 0, "Invalid lock dates: not multiples of 14 days" ); diff --git a/contracts/governance/Staking/modules/StakingWithdrawModule.sol b/contracts/governance/Staking/modules/StakingWithdrawModule.sol index 93610bf95..00b4e8883 100644 --- a/contracts/governance/Staking/modules/StakingWithdrawModule.sol +++ b/contracts/governance/Staking/modules/StakingWithdrawModule.sol @@ -192,12 +192,12 @@ contract StakingWithdrawModule is IFunctionsList, StakingShared, CheckpointsShar /** Burn the punished amount by sending it to 0x1 address * @note SOV token is not allowed to be transferred to zero address */ - SOVToken.transfer(address(0x1), punishedAmount); + _SOVToken().transfer(address(0x1), punishedAmount); } } /// @dev transferFrom - bool success = SOVToken.transfer(receiver, amount); + bool success = _SOVToken().transfer(receiver, amount); require(success, "Token transfer failed"); // S09 emit StakingWithdrawn(msg.sender, amount, until, receiver, isGovernance); @@ -239,7 +239,7 @@ contract StakingWithdrawModule is IFunctionsList, StakingShared, CheckpointsShar _decreaseDelegateStake(delegates[vesting][until], until, amount); /// @dev transferFrom - bool success = SOVToken.transfer(receiver, amount); + bool success = _SOVToken().transfer(receiver, amount); require(success, "Token transfer failed"); // S09 emit StakingWithdrawn(vesting, amount, until, receiver, true); @@ -311,7 +311,7 @@ contract StakingWithdrawModule is IFunctionsList, StakingShared, CheckpointsShar * */ function unlockAllTokens() external onlyOwner whenNotFrozen { allUnlocked = true; - emit TokensUnlocked(SOVToken.balanceOf(address(this))); + emit TokensUnlocked(_SOVToken().balanceOf(address(this))); } /** diff --git a/contracts/governance/Staking/modules/proxy/StakingModulesProxy.sol b/contracts/governance/Staking/modules/proxy/StakingModulesProxy.sol new file mode 100644 index 000000000..3c5b65d52 --- /dev/null +++ b/contracts/governance/Staking/modules/proxy/StakingModulesProxy.sol @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.5.17; + +import "../../../../proxy/modules/ModulesProxy.sol"; +import "../shared/StakingStorageInitializableSlots.sol"; + +/** + * ModulesProxy serves as a storage processed by a set of logic contracts - modules + * Modules functions are registered in the contract's slots generated per func sig + * All the function calls except for own Proxy functions are delegated to + * the registered functions + * The ModulesProxy is designed as a universal solution for refactorig contracts + * reaching a 24K size limit (EIP-170) + * + * Upgradability is implemented at a module level to provide consistency + * It does not allow to replace separate functions - only the whole module + * meaning that if a module being registered contains other modules function signatures + * then these modulea should be replaced completely - all the functions should be removed + * to avoid leftovers or accidental replacements and therefore functional inconsistency. + * + * A module is either a new non-overlapping with registered modules + * or a complete replacement of another registered module + * in which case all the old module functions are unregistered and then + * the new module functions are registered + * There is also a separate function to unregister a module which unregisters all the functions + * There is no option to unregister a subset of module functions - one should use pausable functionality + * to achieve this + */ + +contract StakingModulesProxy is ModulesProxy, StakingStorageInitializableSlots { + // Uncomment for using beforeFallback() hook + /* + bytes private constant BEFORE_FALLBACK_SIG = abi.encodeWithSignature("beforeFallback()"); + bytes4 private constant BEFORE_FALLBACK_SIG_BYTES4 = bytes4(keccak256(abi.encodePacked("beforeFallback()"))); + */ + + constructor(address _sovToken) public { + require(_sovToken != address(0), "Invalid SOV token address"); + bytes32 slotKickoffTs = STAKING_KICKOFF_TS_STORAGE_SLOT; + bytes32 slotSovTokenAddress = SOV_TOKEN_ADDRESS_STORAGE_SLOT; + uint256 kickoffTS = block.timestamp; + assembly { + sstore(slotKickoffTs, kickoffTS) + sstore(slotSovTokenAddress, _sovToken) + } + } + + /** + * @notice Fallback function delegates calls to modules. + * Returns whatever the implementation call returns. + * Has a hook to execute before delegating calls + * To activate register a module with beforeFallback() function + */ + function() external payable { + /* + // Commented to safe gas by default + // Uncomment for using beforeFallback() hook + // Implement and register beforeFallback() function in a module + address beforeFallback = _getFuncImplementation(BEFORE_FALLBACK_SIG_BYTES4); + if (beforeFallback != address(0)) { + (bool success, ) = beforeFallback.delegatecall(bytes(0x39b0111a)); // abi.encodeWithSignature("beforeFallback()") + require(success, "ModulesProxy::fallback: beforeFallback() fail"); //MP02 + } + */ + + address target = _getFuncImplementation(msg.sig); + require(target != address(0), "ModulesProxy:target module not registered"); // MP03 + + bytes memory data = msg.data; + assembly { + let result := delegatecall(gas, target, add(data, 0x20), mload(data), 0, 0) + let size := returndatasize + let ptr := mload(0x40) + returndatacopy(ptr, 0, size) + switch result + case 0 { + revert(ptr, size) + } + default { + return(ptr, size) + } + } + } +} diff --git a/contracts/governance/Staking/modules/shared/StakingShared.sol b/contracts/governance/Staking/modules/shared/StakingShared.sol index a40bb4963..ad0bd04f4 100644 --- a/contracts/governance/Staking/modules/shared/StakingShared.sol +++ b/contracts/governance/Staking/modules/shared/StakingShared.sol @@ -86,7 +86,7 @@ contract StakingShared is StakingStorageShared, SafeMath96 { * */ function _timestampToLockDate(uint256 timestamp) internal view returns (uint256 lockDate) { // Optimize gas costs by reading kickoffTS from storage only once. - uint256 start = kickoffTS; + uint256 start = _kickoffTS(); require(timestamp >= start, "timestamp < contract creation"); // WS23 /** * @dev If staking timestamp does not match any of the unstaking dates diff --git a/contracts/governance/Staking/modules/shared/StakingStorageInitializableSlots.sol b/contracts/governance/Staking/modules/shared/StakingStorageInitializableSlots.sol new file mode 100644 index 000000000..dcade18db --- /dev/null +++ b/contracts/governance/Staking/modules/shared/StakingStorageInitializableSlots.sol @@ -0,0 +1,12 @@ +pragma solidity ^0.5.17; + +/** + * @title Interface for Staking modules governance/Staking/modules + */ + +contract StakingStorageInitializableSlots { + bytes32 internal constant STAKING_KICKOFF_TS_STORAGE_SLOT = + keccak256("STAKING_KICKOFF_TS_STORAGE_SLOT_MTo3ODc1ODoxNzc4NzM4MjA1OjE3MTQ5NzM0NjU"); // MTo3ODc1ODoxNzc4NzM4MjA1OjE3MTQ5NzM0NjU is a nonce + bytes32 internal constant SOV_TOKEN_ADDRESS_STORAGE_SLOT = + keccak256("SOV_TOKEN_ADDRESS_STORAGE_SLOT_MTo3ODc1ODoxNzc4NzM4MjA1OjE3MTQ5NzM0NjU"); +} diff --git a/contracts/governance/Staking/modules/shared/StakingStorageShared.sol b/contracts/governance/Staking/modules/shared/StakingStorageShared.sol index 4886efcd6..9dd7bbb8a 100644 --- a/contracts/governance/Staking/modules/shared/StakingStorageShared.sol +++ b/contracts/governance/Staking/modules/shared/StakingStorageShared.sol @@ -5,6 +5,7 @@ import "../../../../openzeppelin/Ownable.sol"; import "../../../../interfaces/IERC20.sol"; import "../../../IFeeSharingCollector.sol"; import "../../../Vesting/IVestingRegistry.sol"; +import "./StakingStorageInitializableSlots.sol"; /** * @title StakingStorageShared contract is inherited by Staking modules. @@ -21,7 +22,7 @@ import "../../../Vesting/IVestingRegistry.sol"; * voting rights in the Bitocracy. Stakers are further incentivised through * fee and slashing rewards. * */ -contract StakingStorageShared is Ownable { +contract StakingStorageShared is StakingStorageInitializableSlots, Ownable { /// @notice 2 weeks in seconds. uint256 constant TWO_WEEKS = 1209600; @@ -45,13 +46,31 @@ contract StakingStorageShared is Ownable { uint96 constant MIN_WEIGHT_SCALING = 1; uint96 constant MAX_WEIGHT_SCALING = 9; + uint256 public constant REENTRANCY_GUARD_FREE = 1; + + function _kickoffTS() internal view returns (uint256 kickoffTS) { + bytes32 slot = STAKING_KICKOFF_TS_STORAGE_SLOT; + assembly { + kickoffTS := sload(slot) + } + } + + function _SOVToken() internal view returns (IERC20 SOVToken) { + bytes32 slot = SOV_TOKEN_ADDRESS_STORAGE_SLOT; + address SOVTokenAddress; + assembly { + SOVTokenAddress := sload(slot) + } + SOVToken = IERC20(SOVTokenAddress); + } + /// @notice The timestamp of contract creation. Base for the staking period calculation. - uint256 public kickoffTS; + //uint256 public kickoffTS; - moved to an unstructured storage string name = "SOVStaking"; /// @notice The token to be staked. - IERC20 public SOVToken; + //IERC20 public SOVToken; - moved to an unstructured storage /// @notice A record of each accounts delegate. mapping(address => mapping(uint256 => address)) public delegates; diff --git a/contracts/governance/StakingRewards/StakingRewards.sol b/contracts/governance/StakingRewards/StakingRewards.sol index fa60e63d9..b517851f4 100644 --- a/contracts/governance/StakingRewards/StakingRewards.sol +++ b/contracts/governance/StakingRewards/StakingRewards.sol @@ -28,7 +28,7 @@ contract StakingRewards is StakingRewardsStorage { * @notice Replacement of constructor by initialize function for Upgradable Contracts * This function will be called only once by the owner. * @param _SOV SOV token address - * @param _staking StakingProxy address should be passed + * @param _staking StakingModulesProxy address should be passed * */ function initialize(address _SOV, IStaking _staking) external onlyOwner { require(_SOV != address(0), "Invalid SOV Address."); diff --git a/deployment/deploy/10-deploy-StakingModulesProxy.js b/deployment/deploy/10-deploy-StakingModulesProxy.js index 2a2eb1bf7..9eb9e2695 100644 --- a/deployment/deploy/10-deploy-StakingModulesProxy.js +++ b/deployment/deploy/10-deploy-StakingModulesProxy.js @@ -12,8 +12,13 @@ const func = async function (hre) { } = hre; const { deployer } = await getNamedAccounts(); log(col.bgYellow("Deploying StakingModulesProxy...")); - await deployWithCustomProxy(deployer, "ModulesProxy", "StakingProxy", "StakingModulesProxy"); + await deploy("StakingModulesProxy", { + from: deployer, + args: [(await get("SOV")).address], + log: true, + skipIfAlreadyDeployed: true, + }); }; func.tags = ["StakingModulesProxy"]; -func.dependencies = ["StakingProxy"]; +func.dependencies = ["SOV"]; module.exports = func; diff --git a/deployment/deploy/1020-deploy-FeeSharingCollector.js b/deployment/deploy/1020-deploy-FeeSharingCollector.js index 75c94ce05..bdb904c3e 100644 --- a/deployment/deploy/1020-deploy-FeeSharingCollector.js +++ b/deployment/deploy/1020-deploy-FeeSharingCollector.js @@ -16,7 +16,7 @@ const func = async function (hre) { "FeeSharingCollectorProxy", true, [], - ["0x0000000000000000000000000000000000000000", (await get("StakingProxy")).address], + ["0x0000000000000000000000000000000000000000", (await get("StakingModulesProxy")).address], "ContractsGuardianMultisig" ); }; diff --git a/deployment/deploy/30-deploy-AddStakingModules.js b/deployment/deploy/30-deploy-AddStakingModules.js index 3d083fb80..2a3e284c0 100644 --- a/deployment/deploy/30-deploy-AddStakingModules.js +++ b/deployment/deploy/30-deploy-AddStakingModules.js @@ -26,9 +26,7 @@ const func = async function () { let modulesAddressList = []; let totalGas = ethers.BigNumber.from(0); - const stakingProxyDeployment = await get("StakingProxy"); const stakingModulesProxyDeployment = await get("StakingModulesProxy"); //await ethers.getContract("StakingModulesProxy"); - // @dev stakingModulesProxy@stakingProxy const stakingModulesProxy = await ethers.getContract("StakingModulesProxy"); const stakingModulesProxyOwner = await stakingModulesProxy.getProxyOwner(); @@ -82,7 +80,7 @@ const func = async function () { log(col.bgYellow("Generating multisig transaction to register modules...")); await sendWithMultisig( multisigDeployment.address, - stakingProxyDeployment.address, + stakingModulesProxyDeployment.address, data, deployer ); @@ -95,7 +93,6 @@ const func = async function () { //owned by governance - need a SIP to register // TODO: implementation ; meanwhile use brownie sip_interaction scripts to create proposal // TODO: figure out if possible to pass SIP via environment and run the script - //const stakingProxyDeployment = await get("StakingProxy"); if ( stakingModulesProxyOwner === timelockOwnerAddress || stakingModulesProxyOwner === timelockAdminAddress diff --git a/deployment/deploy/40-deploy-ReplaceStakingModules.js b/deployment/deploy/40-deploy-ReplaceStakingModules.js index 9ffdb2a82..f30ee3aac 100644 --- a/deployment/deploy/40-deploy-ReplaceStakingModules.js +++ b/deployment/deploy/40-deploy-ReplaceStakingModules.js @@ -20,9 +20,7 @@ const func = async function (hre) { ethers, } = hre; const { deployer } = await getNamedAccounts(); - const stakingProxyDeployment = await get("StakingProxy"); const stakingModulesProxyDeployment = await get("StakingModulesProxy"); //await ethers.getContract("StakingModulesProxy"); - // @dev stakingModulesProxy@stakingProxy const stakingModulesProxy = await ethers.getContract("StakingModulesProxy"); const modulesList = getStakingModulesNames(); @@ -58,7 +56,7 @@ const func = async function (hre) { log("Generating multisig transaction to replace modules..."); await sendWithMultisig( multisigDeployment.address, - stakingProxyDeployment.address, + stakingModulesProxyDeployment.address, data, deployer ); @@ -71,7 +69,6 @@ const func = async function (hre) { //owned by governance - need a SIP to register // TODO: implementation ; meanwhile use brownie sip_interaction scripts to create proposal // TODO: figure out if possible to pass SIP via environment and run the script - //const stakingProxyDeployment = await get("StakingProxy"); log( col.bgBlue( "Staking modules and StakingModuleProxy are deployed (those not modified are reused)" diff --git a/deployment/deploy/6000-deploy-Bitocracy.js b/deployment/deploy/6000-deploy-Bitocracy.js index 9ddd542e7..a121736b3 100644 --- a/deployment/deploy/6000-deploy-Bitocracy.js +++ b/deployment/deploy/6000-deploy-Bitocracy.js @@ -40,7 +40,7 @@ const func = async function (hre) { }); const timelockOwnerDeployment = await get("TimelockOwner"); - const stakingDeployment = await get("StakingProxy"); + const stakingDeployment = await get("StakingModulesProxy"); log(col.bgYellow("Deploying GovernorOwner...")); await deploy("GovernorOwner", { contract: "GovernorAlpha", diff --git a/deployment/deploy/7-deploy-StakingProxy.js b/deployment/deploy/7-deploy-StakingProxy.js deleted file mode 100644 index 668271f8a..000000000 --- a/deployment/deploy/7-deploy-StakingProxy.js +++ /dev/null @@ -1,24 +0,0 @@ -const path = require("path"); -const { getContractNameFromScriptFileName } = require("../helpers/utils"); -const { ethers } = require("hardhat"); -const col = require("cli-color"); -//const deploymentName = getContractNameFromScriptFileName(path.basename(__filename)); -const func = async function (hre) { - const { - deployments: { deploy, get, log }, - getNamedAccounts, - //ethers, - } = hre; - const { deployer } = await getNamedAccounts(); //await ethers.getSigners(); - const sovTotalSupply = ethers.utils.parseEther("100000000"); - log(col.bgYellow("Deploying StakingProxy...")); - await deploy("StakingProxy", { - from: deployer, - args: [(await get("SOV")).address], - log: true, - skipIfAlreadyDeployed: true, - }); -}; -func.tags = ["StakingProxy"]; -func.dependencies = ["SOV"]; -module.exports = func; diff --git a/hardhat/tasks/sips/args/sipArgs.js b/hardhat/tasks/sips/args/sipArgs.js index 600c15325..915044041 100644 --- a/hardhat/tasks/sips/args/sipArgs.js +++ b/hardhat/tasks/sips/args/sipArgs.js @@ -80,107 +80,6 @@ const getArgsSip0078 = async (hre) => { return { args, governor: "GovernorAdmin" }; }; -const getArgsSip0049 = async (hre) => { - const { - ethers, - deployments: { get }, - } = hre; - const abiCoder = new ethers.utils.AbiCoder(); - const stakingModulesProxyDeployment = await get("StakingModulesProxy"); - const stakingModulesProxyInterface = new ethers.utils.Interface( - stakingModulesProxyDeployment.abi - ); - const stakingProxy = await ethers.getContract("StakingProxy"); - const isNewModulesProxy = - (await stakingProxy.getImplementation()) != stakingModulesProxyDeployment.implementation; - - const moduleNamesObject = getStakingModulesNames(); - - const addModules = []; - const replaceModulesFrom = []; - const replaceModulesTo = []; - const invalidModules = []; - const targets = []; - const values = []; - const signatures = []; - const datas = []; - - for (let newModuleName in moduleNamesObject) { - const newModuleDeployment = await get(newModuleName); - const newModuleAddress = newModuleDeployment.address; - addModules.push(newModuleAddress); - /* we are skipping these validations because otherwise we would need to have Staking modules proxy implementation set (and voted) - // first and then execute modules replacement - // but leaving here commented to be used further as a boilerplate - if (await stakingModules.canAddModule(newModuleAddress)) { - addModules.push(newModuleAddress); - } else { - const clashing = await stakingModules.checkClashingFuncSelectors( - newModuleAddress - ); - const clashingUnique = clashing.clashingModules.filter(arrayToUnique); - - if (clashingUnique.length == 1) { - replaceModulesFrom.push(clashingUnique[0]); - replaceModulesTo.push(newModuleAddress); - } else if (clashing.clashingModules.length > 1) { - const invalidModulesLog = clashing.clashingModules.reduce((o, c, i) => { - o[c] = o[c] - ? o[c] + ", " + clashing.clashingModulesFuncSelectors[i] - : clashing.clashingModulesFuncSelectors[i]; - return o; - }); - invalidModules.push({ - name: newModuleName, - address: newModuleAddress, - clashing: invalidModulesLog, - }); - } - } - */ - } - - // if (invalidModules.length != 0) - // throw Exception("Function clashing with multiple modules log:" + invalidModules); - - //targets = [contracts['Staking'], contracts['Staking']] - if (isNewModulesProxy) { - targets.push(stakingProxy.address); - values.push(0); - signatures.push("setImplementation(address)"); - datas.push(abiCoder.encode(["address"], [stakingModulesProxyDeployment.implementation])); - } - if (addModules.length > 0) { - targets.push(stakingProxy.address); - values.push(0); - signatures.push("addModules(address[])"); - datas.push(abiCoder.encode(["address[]"], [addModules])); - } - if (replaceModulesFrom.length > 0) { - targets.push(stakingProxy.address); - values.push(0); - signatures.push("replaceModules(address[],address[])"); - datas.push( - abiCoder.encode(["address[]", "address[]"], [replaceModulesFrom, replaceModulesTo]) - ); - throw new Error( - "SIP-0049 is initial Staking modules deployment and should not have modules to replace" - ); - } - description = - "SIP-0049: Staking contract refactoring and other improvements, Details: https://github.com/DistributedCollective/SIPS/blob/48a3f26/SIP-0049.md, sha256: 666a1d06a574d17acb44c34d443edcce724bbd34709b005d0f49b848e4adf9ce"; - - const args = { - targets: targets, - values: values, - signatures: signatures, - data: datas, - description: description, - }; - - return { args, governor: "GovernorOwner" }; -}; - const getArgsSip0058 = async (hre) => { const { ethers, @@ -199,7 +98,7 @@ const getArgsSip0058 = async (hre) => { console.log(modulesTo); const args = { - targets: [(await get("StakingProxy")).address], + targets: [(await get("StakingModulesProxy")).address], values: [0], signatures: ["replaceModules(address[],address[])"], data: [ @@ -229,7 +128,7 @@ const getArgsSip0063 = async (hre) => { console.log([modulesFrom], "->", [modulesTo]); const args = { - targets: [(await get("StakingProxy")).address], + targets: [(await get("StakingModulesProxy")).address], values: [0], signatures: ["replaceModules(address[],address[])"], data: [ @@ -1086,7 +985,6 @@ module.exports = { sampleGovernorOwnerSIP, getArgsSip0047, getArgsSip0058, - getArgsSip0049, getArgsSip0063, getArgsSip0065, getArgsSip0046Part1, diff --git a/scripts/contractInteraction/staking_vesting.py b/scripts/contractInteraction/staking_vesting.py index ee59d1661..4f1adce81 100644 --- a/scripts/contractInteraction/staking_vesting.py +++ b/scripts/contractInteraction/staking_vesting.py @@ -418,11 +418,6 @@ def getStakes(address): stakingProxy = Contract.from_abi("Staking", address=conf.contracts['Staking'], abi=interface.IStaking.abi, owner=conf.acct) print(stakingProxy.getStakes(address)) -def getStakingLogicAddess(): - # Get the proxy contract instance - stakingProxy = Contract.from_abi("Staking", address=conf.contracts['Staking'], abi=StakingProxy.abi, owner=conf.acct) - print("Staking contract logic address:", stakingProxy.getImplementation()) - def stakeTokens(sovAmount, stakeTime, acctAddress, delegateeAddress): SOVtoken = Contract.from_abi("SOV", address=conf.contracts['SOV'], abi=SOV.abi, owner=acctAddress) staking = Contract.from_abi("Staking", address=conf.contracts['Staking'], abi=interface.IStaking.abi, owner=acctAddress) diff --git a/scripts/fixStake.js b/scripts/fixStake.js index bffa3dd2e..632e29ec7 100644 --- a/scripts/fixStake.js +++ b/scripts/fixStake.js @@ -167,12 +167,12 @@ async function main() { // const multisig2 = await ethers.getContractAt("MultiSigWallet", "0x924f5ad34698Fd20c90Fe5D5A8A0abd3b42dc711", account2); // const multisig3 = await ethers.getContractAt("MultiSigWallet", "0x924f5ad34698Fd20c90Fe5D5A8A0abd3b42dc711", account3); - /*let StakingProxyABI = [ + /*let StakingModulesProxyABI = [ // // add "payable" to the Solidity signature "function setImplementation(address _implementation)", ]; - let iStakingRewardsProxy = new ethers.utils.Interface(StakingProxyABI); + let iStakingRewardsProxy = new ethers.utils.Interface(StakingModulesProxyABI); const data = iStakingRewardsProxy.encodeFunctionData("setImplementation", [ stakinRewardsLogic.address, ]); diff --git a/tests-foundry/staking/StakingStake.t.sol b/tests-foundry/staking/StakingStake.t.sol index d33161ee7..0afc073dd 100644 --- a/tests-foundry/staking/StakingStake.t.sol +++ b/tests-foundry/staking/StakingStake.t.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.17; import "forge-std/Test.sol"; import { IStaking } from "./interfaces/IStaking.sol"; -import { IStakingProxy } from "./interfaces/IStaking.sol"; import { IStakingModulesProxy } from "./interfaces/IStaking.sol"; import { IFeeSharingCollector, IFeeSharingCollectorProxy } from "./interfaces/IFeeSharingCollector.sol"; import { IERC20 } from "./interfaces/ITokens.sol"; @@ -80,12 +79,9 @@ contract StakingFuzzTest is Test { deployCode("WeightedStakingModule.sol") ]; - IStakingProxy stakingProxy = IStakingProxy( - deployCode("StakingProxy.sol", abi.encode(address(sov))) + IStakingModulesProxy stakingModulesProxy = IStakingModulesProxy( + deployCode("StakingModulesProxy.sol", abi.encode(address(sov))) ); - address stakingProxyAddress = address(stakingProxy); - stakingProxy.setImplementation(deployCode("ModulesProxy.sol")); - IStakingModulesProxy stakingModulesProxy = IStakingModulesProxy(stakingProxyAddress); for (uint256 i = 0; i < stakingModules.length; i++) { stakingModulesProxy.addModule(stakingModules[i]); diff --git a/tests-foundry/staking/interfaces/IStaking.sol b/tests-foundry/staking/interfaces/IStaking.sol index fe6551d5b..6b1aa61b7 100644 --- a/tests-foundry/staking/interfaces/IStaking.sol +++ b/tests-foundry/staking/interfaces/IStaking.sol @@ -670,10 +670,6 @@ interface IStaking { function setMaxVestingWithdrawIterations(uint256 maxIterations) external; } -interface IStakingProxy { - function setImplementation(address _implementation) external; -} - interface IStakingModulesProxy { function addModule(address _implementation) external; } diff --git a/tests-onchain/StakingModulesSIP.test.js b/tests-onchain/StakingModulesSIP.test.js index 20879be5e..b9b32d307 100644 --- a/tests-onchain/StakingModulesSIP.test.js +++ b/tests-onchain/StakingModulesSIP.test.js @@ -32,7 +32,6 @@ const { const GovernorAlpha = artifacts.require("GovernorAlphaMockup"); const Timelock = artifacts.require("TimelockHarness"); -const StakingProxy = artifacts.require("StakingProxy"); const LoanTokenSettings = artifacts.require("LoanTokenSettingsLowerAdmin"); const LoanToken = artifacts.require("LoanToken"); @@ -48,9 +47,6 @@ const MAX_DURATION = ethers.BigNumber.from(24 * 60 * 60).mul(1092); const ONE_RBTC = ethers.utils.parseEther("1.0"); describe("Staking Modules Deployments and Upgrades via Governance", () => { - let root, account1, account2, account3, account4; - let SUSD, staking, gov, timelock, stakingProxy; - let sovryn; // async function setupTest() { const getImpersonatedSignerFromJsonRpcProvider = async (addressToImpersonate) => { //await impersonateAccount(addressToImpersonate); @@ -68,7 +64,6 @@ describe("Staking Modules Deployments and Upgrades via Governance", () => { await deployments.fixture(["StakingModules", "StakingModulesProxy"], { keepExistingDeployments: true, }); // start from a fresh deployments - const stakingProxy = await ethers.getContract("StakingProxy", deployer); const stakingModulesProxy = await ethers.getContract("StakingModulesProxy", deployer); const god = await deployments.get("GovernorOwner"); @@ -91,7 +86,6 @@ describe("Staking Modules Deployments and Upgrades via Governance", () => { return { deployer, deployerSigner, - stakingProxy, stakingModulesProxy, governorOwner, governorOwnerSigner, @@ -105,99 +99,6 @@ describe("Staking Modules Deployments and Upgrades via Governance", () => { afterEach(async () => {}); describe("Staking Modules Onchain Testing", () => { - it("SIP 0049 is executable", async () => { - if (!hre.network.tags["forked"]) { - console.error("ERROR: Must run on a forked net"); - return; - } - await hre.network.provider.request({ - method: "hardhat_reset", - params: [ - { - forking: { - jsonRpcUrl: "https://mainnet-dev.sovryn.app/rpc", - blockNumber: 5069115, //5079890 // block num at the time of the test creation with no Staking refactored deployed yet - //blockNumber: 5037475, // block num at the time of the test creation with no Staking refactored deployed yet - }, - }, - ], - }); - - const { - deployer, - deployerSigner, - stakingProxy, - stakingModulesProxy, - governorOwner, - governorOwnerSigner, - timelockOwner, - timelockOwnerSigner, - } = await setupTest(); - - // CREATE PROPOSAL - const sov = await ethers.getContract("SOV", timelockOwnerSigner); - const whaleAmount = (await sov.totalSupply()).mul(ethers.BigNumber.from(5)); - await sov.mint(deployer, whaleAmount); - /* - const quorumVotes = await governorOwner.quorumVotes(); - console.log('quorumVotes:', quorumVotes); - */ - await sov.connect(deployerSigner).approve(stakingProxy.address, whaleAmount); - const stakeABI = (await hre.artifacts.readArtifact("IStaking")).abi; - // alternatively for stakeABI can be used human readable ABI: - /*const stakeABI = [ - 'function stake(uint96 amount,uint256 until,address stakeFor,address delegatee)', - 'function pauseUnpause(bool _pause)', - 'function paused() view returns (bool)' - ];*/ - const staking = await ethers.getContractAt( - stakeABI, - stakingProxy.address, - deployerSigner - ); - const multisigSigner = await getImpersonatedSignerFromJsonRpcProvider( - (await get("MultiSigWallet")).address - ); - if (await staking.paused()) await staking.connect(multisigSigner).pauseUnpause(false); - const kickoffTS = await stakingProxy.kickoffTS(); - await staking.stake(whaleAmount, kickoffTS.add(MAX_DURATION), deployer, deployer); - await mine(); - - // CREATE PROPOSAL AND VERIFY - const proposalIdBeforeSIP = await governorOwner.latestProposalIds(deployer); - await hre.run("sips:create", { argsFunc: "getArgsSip0049" }); - const proposalId = await governorOwner.latestProposalIds(deployer); - expect( - proposalId.toString(), - "Proposal was not created. Check the SIP creation is not commented out." - ).not.equal(proposalIdBeforeSIP.toString()); - - // VOTE FOR PROPOSAL - await mine(); - await governorOwner.connect(deployerSigner).castVote(proposalId, true); - - // QUEUE PROPOSAL - let proposal = await governorOwner.proposals(proposalId); - await mine(proposal.endBlock); - await governorOwner.queue(proposalId); - - // EXECUTE PROPOSAL - proposal = await governorOwner.proposals(proposalId); - await time.increaseTo(proposal.eta); - await expect(governorOwner.execute(proposalId)) - .to.emit(governorOwner, "ProposalExecuted") - .withArgs(proposalId); - - // VALIDATE EXECUTION - expect((await governorOwner.proposals(proposalId)).executed).to.be.true; - expect(await stakingProxy.getImplementation()).to.equal( - (await get("StakingModulesProxy_Implementation")).address - ); - const modulesProxy = await ethers.getContractAt("ModulesProxy", stakingProxy.address); - expect(await modulesProxy.getFuncImplementation("0x8dae1b16")).to.equal( - (await get("WeightedStakingModule")).address - ); - }); it("SIP-0058 replacing staking modules is executable", async () => { if (!hre.network.tags["forked"]) { console.error("ERROR: Must run on a forked net"); @@ -218,11 +119,8 @@ describe("Staking Modules Deployments and Upgrades via Governance", () => { const { deployer, deployerSigner, - stakingProxy, stakingModulesProxy, governorOwner, - governorOwnerSigner, - timelockOwner, timelockOwnerSigner, } = await setupTest(); @@ -231,18 +129,18 @@ describe("Staking Modules Deployments and Upgrades via Governance", () => { const whaleAmount = (await sov.totalSupply()).mul(ethers.BigNumber.from(5)); await sov.mint(deployer, whaleAmount); - await sov.connect(deployerSigner).approve(stakingProxy.address, whaleAmount); + await sov.connect(deployerSigner).approve(stakingModulesProxy.address, whaleAmount); const stakeABI = (await hre.artifacts.readArtifact("IStaking")).abi; const staking = await ethers.getContractAt( stakeABI, - stakingProxy.address, + stakingModulesProxy.address, deployerSigner ); const multisigSigner = await getImpersonatedSignerFromJsonRpcProvider( (await get("MultiSigWallet")).address ); if (await staking.paused()) await staking.connect(multisigSigner).pauseUnpause(false); - const kickoffTS = await stakingProxy.kickoffTS(); + const kickoffTS = await stakingModulesProxy.kickoffTS(); await staking.stake(whaleAmount, kickoffTS.add(MAX_DURATION), deployer, deployer); await mine(); @@ -266,7 +164,7 @@ describe("Staking Modules Deployments and Upgrades via Governance", () => { await governorOwner.queue(proposalId); // VERIFY REGISTERED MODULES ARE NOT THE DEPLOYED ONES BEFORE THE SIP EXECUTION - const modulesProxy = await ethers.getContractAt("ModulesProxy", stakingProxy.address); + const modulesProxy = await ethers.getContract("StakingModulesProxy"); const stakingVestingModule = await ethers.getContract("StakingVestingModule"); const stakingVestingModuleFuncs = await stakingVestingModule.getFunctionsList(); for await (const func of stakingVestingModuleFuncs) { @@ -323,10 +221,10 @@ describe("Staking Modules Deployments and Upgrades via Governance", () => { ], }); - const { stakingProxy, governorOwner } = await setupTest(); + const { governorOwner } = await setupTest(); // VERIFY REGISTERED MODULES ARE NOT THE DEPLOYED ONES BEFORE THE SIP EXECUTION - const modulesProxy = await ethers.getContractAt("ModulesProxy", stakingProxy.address); + const modulesProxy = await ethers.getContract("StakingModulesProxy"); const stakingVestingModule = await ethers.getContract("StakingVestingModule"); const stakingVestingModuleFuncs = await stakingVestingModule.getFunctionsList(); for await (const func of stakingVestingModuleFuncs) { diff --git a/tests-onchain/sip0063.test.js b/tests-onchain/sip0063.test.js index b0ed1bafc..eabbd2ad8 100644 --- a/tests-onchain/sip0063.test.js +++ b/tests-onchain/sip0063.test.js @@ -40,7 +40,6 @@ describe("Staking Modules Deployments and Upgrades via Governance", () => { await deployments.fixture(["StakingModules", "StakingModulesProxy"], { keepExistingDeployments: true, }); // start from a fresh deployments - const stakingProxy = await ethers.getContract("StakingProxy", deployer); const stakingModulesProxy = await ethers.getContract("StakingModulesProxy", deployer); const god = await deployments.get("GovernorOwner"); @@ -61,7 +60,6 @@ describe("Staking Modules Deployments and Upgrades via Governance", () => { return { deployer, deployerSigner, - stakingProxy, stakingModulesProxy, governorOwner, governorOwnerSigner, @@ -88,26 +86,31 @@ describe("Staking Modules Deployments and Upgrades via Governance", () => { ], }); - const { deployer, deployerSigner, stakingProxy, governorOwner, timelockOwnerSigner } = - await setupTest(); + const { + deployer, + deployerSigner, + stakingModulesProxy, + governorOwner, + timelockOwnerSigner, + } = await setupTest(); // CREATE PROPOSAL const sov = await ethers.getContract("SOV", timelockOwnerSigner); const whaleAmount = (await sov.totalSupply()).mul(ethers.BigNumber.from(5)); await sov.mint(deployer, whaleAmount); - await sov.connect(deployerSigner).approve(stakingProxy.address, whaleAmount); + await sov.connect(deployerSigner).approve(stakingModulesProxy.address, whaleAmount); const stakeABI = (await hre.artifacts.readArtifact("IStaking")).abi; const staking = await ethers.getContractAt( stakeABI, - stakingProxy.address, + stakingModulesProxy.address, deployerSigner ); const multisigSigner = await getImpersonatedSigner( (await get("MultiSigWallet")).address ); if (await staking.paused()) await staking.connect(multisigSigner).pauseUnpause(false); - const kickoffTS = await stakingProxy.kickoffTS(); + const kickoffTS = await staking.kickoffTS(); await staking.stake(whaleAmount, kickoffTS.add(MAX_DURATION), deployer, deployer); await mine(); @@ -131,7 +134,10 @@ describe("Staking Modules Deployments and Upgrades via Governance", () => { await governorOwner.queue(proposalId); // VERIFY REGISTERED MODULES ARE NOT THE DEPLOYED ONES BEFORE THE SIP EXECUTION - const modulesProxy = await ethers.getContractAt("ModulesProxy", stakingProxy.address); + const modulesProxy = await ethers.getContractAt( + "ModulesProxy", + stakingModulesProxy.address + ); const stakingStakeModule = await ethers.getContract("StakingStakeModule"); const stakingStakeModuleFuncs = await stakingStakeModule.getFunctionsList(); diff --git a/tests/EscrowReward/anyone.test.js b/tests/EscrowReward/anyone.test.js index 1d522761d..f68dd660b 100644 --- a/tests/EscrowReward/anyone.test.js +++ b/tests/EscrowReward/anyone.test.js @@ -6,7 +6,6 @@ const { deployAndGetIStaking } = require("../Utils/initializer"); const EscrowReward = artifacts.require("EscrowReward"); const LockedSOV = artifacts.require("LockedSOV"); // Ideally should be using actual LockedSOV for testing. -const StakingProxy = artifacts.require("StakingProxy"); const SOV = artifacts.require("TestToken"); const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const VestingLogic = artifacts.require("VestingLogic"); @@ -78,8 +77,8 @@ contract("Escrow Rewards (Any User Functions)", (accounts) => { sov = await SOV.new("Sovryn", "SOV", 18, zero); // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(sov.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(sov.address); // Creating the FeeSharing Instance. feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( diff --git a/tests/EscrowReward/creator.test.js b/tests/EscrowReward/creator.test.js index ad830a93e..2098dca29 100644 --- a/tests/EscrowReward/creator.test.js +++ b/tests/EscrowReward/creator.test.js @@ -24,7 +24,7 @@ const LockedSOV = artifacts.require("LockedSOV"); // Ideally should be using act const VestingLogic = artifacts.require("VestingLogic"); const VestingFactory = artifacts.require("VestingFactory"); const VestingRegistry = artifacts.require("VestingRegistry3"); -const StakingProxy = artifacts.require("StakingProxy"); + const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const SOV = artifacts.require("TestToken"); @@ -92,8 +92,8 @@ contract("Escrow Rewards (Creator Functions)", (accounts) => { sov = await SOV.new("Sovryn", "SOV", 18, zero); // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(sov.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(sov.address); // Creating the FeeSharing Instance. feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( diff --git a/tests/EscrowReward/event.test.js b/tests/EscrowReward/event.test.js index 92bb97744..ccf23cad3 100644 --- a/tests/EscrowReward/event.test.js +++ b/tests/EscrowReward/event.test.js @@ -27,7 +27,7 @@ const SOV = artifacts.require("TestToken"); const VestingLogic = artifacts.require("VestingLogic"); const VestingFactory = artifacts.require("VestingFactory"); const VestingRegistry = artifacts.require("VestingRegistry3"); -const StakingProxy = artifacts.require("StakingProxy"); + const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const { @@ -92,8 +92,8 @@ contract("Escrow Rewards (Events)", (accounts) => { sov = await SOV.new("Sovryn", "SOV", 18, zero); // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(sov.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(sov.address); // Creating the FeeSharing Instance. feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( diff --git a/tests/EscrowReward/multisig.test.js b/tests/EscrowReward/multisig.test.js index c2af18fab..1f76253f2 100644 --- a/tests/EscrowReward/multisig.test.js +++ b/tests/EscrowReward/multisig.test.js @@ -20,7 +20,7 @@ const LockedSOV = artifacts.require("LockedSOV"); // Ideally should be using act const VestingLogic = artifacts.require("VestingLogic"); const VestingFactory = artifacts.require("VestingFactory"); const VestingRegistry = artifacts.require("VestingRegistry3"); -const StakingProxy = artifacts.require("StakingProxy"); + const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const SOV = artifacts.require("TestToken"); @@ -87,8 +87,8 @@ contract("Escrow Rewards (Multisig Functions)", (accounts) => { sov = await SOV.new("Sovryn", "SOV", 18, zero); // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(sov.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(sov.address); // Creating the FeeSharing Instance. feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( diff --git a/tests/EscrowReward/state.test.js b/tests/EscrowReward/state.test.js index 62095560c..0ef8d0724 100644 --- a/tests/EscrowReward/state.test.js +++ b/tests/EscrowReward/state.test.js @@ -22,7 +22,7 @@ const LockedSOV = artifacts.require("LockedSOV"); // Ideally should be using act const VestingLogic = artifacts.require("VestingLogic"); const VestingFactory = artifacts.require("VestingFactory"); const VestingRegistry = artifacts.require("VestingRegistry3"); -const StakingProxy = artifacts.require("StakingProxy"); + const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const SOV = artifacts.require("TestToken"); @@ -376,8 +376,8 @@ contract("Escrow Rewards (State)", (accounts) => { sov = await SOV.new("Sovryn", "SOV", 18, zero); // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(sov.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(sov.address); // Creating the FeeSharing Instance. feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( diff --git a/tests/FeeSharingCollectorTest.js b/tests/FeeSharingCollectorTest.js index a511b11f2..e3ded6060 100644 --- a/tests/FeeSharingCollectorTest.js +++ b/tests/FeeSharingCollectorTest.js @@ -40,7 +40,6 @@ const { const TestToken = artifacts.require("TestToken"); -const StakingProxy = artifacts.require("StakingProxy"); const VestingLogic = artifacts.require("VestingLogicMockup"); const Vesting = artifacts.require("TeamVesting"); @@ -159,16 +158,16 @@ contract("FeeSharingCollector:", (accounts) => { // Staking // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(SOVToken.address); + const modulesObject = await getStakingModulesObject(); - staking = await deployAndGetIStaking(stakingProxy.address, modulesObject); + staking = await deployAndGetIStaking(SOVToken.address, modulesObject); const weightedStakingModuleMockup = await WeightedStakingModuleMockup.new(); const modulesAddressList = getStakingModulesAddressList(modulesObject); //console.log(modulesAddressList); await replaceStakingModule( - stakingProxy.address, + staking.address, modulesAddressList["WeightedStakingModule"], weightedStakingModuleMockup.address ); @@ -4594,7 +4593,7 @@ contract("FeeSharingCollector:", (accounts) => { }); describe("withdraw with or considering vesting contracts", () => { - it("getAccumulatedFees should return 0 for vesting contracts", async () => { + it.only("getAccumulatedFees should return 0 for vesting contracts", async () => { /// @dev This test requires redeploying the protocol await protocolDeploymentFixture(); diff --git a/tests/Governance/GovernanceIntegrationTest.js b/tests/Governance/GovernanceIntegrationTest.js index c58b58cce..7b3e14b4c 100644 --- a/tests/Governance/GovernanceIntegrationTest.js +++ b/tests/Governance/GovernanceIntegrationTest.js @@ -41,7 +41,6 @@ const { encodeParameters, etherMantissa, mineBlock, increaseTime } = require(".. const GovernorAlpha = artifacts.require("GovernorAlphaMockup"); const Timelock = artifacts.require("TimelockHarness"); -const StakingProxy = artifacts.require("StakingProxy"); const LoanTokenSettings = artifacts.require("LoanTokenSettingsLowerAdmin"); const LoanToken = artifacts.require("LoanToken"); @@ -70,8 +69,8 @@ contract("GovernanceIntegration", (accounts) => { // Staking // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(SUSD.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(SUSD.address); // Governor timelock = await Timelock.new(root, TWO_DAYS); diff --git a/tests/Governance/GovernorAlpha/CastVoteTest.js b/tests/Governance/GovernorAlpha/CastVoteTest.js index a10e8e071..687211809 100644 --- a/tests/Governance/GovernorAlpha/CastVoteTest.js +++ b/tests/Governance/GovernorAlpha/CastVoteTest.js @@ -31,7 +31,7 @@ const { getAccountsPrivateKeysBuffer } = require("../../Utils/hardhat_utils"); const { deployAndGetIStaking } = require("../../Utils/initializer"); const GovernorAlpha = artifacts.require("GovernorAlphaMockup"); -const StakingProxy = artifacts.require("StakingProxy"); + const TestToken = artifacts.require("TestToken"); const DELAY = 86400 * 14; @@ -64,8 +64,8 @@ contract("governorAlpha#castVote/2", (accounts) => { // Staking // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(token.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(testToken.address); gov = await GovernorAlpha.new(address(0), staking.address, root, 4, 0); diff --git a/tests/Governance/GovernorAlpha/ProposeTest.js b/tests/Governance/GovernorAlpha/ProposeTest.js index f9232d4d1..2c6fa94cf 100644 --- a/tests/Governance/GovernorAlpha/ProposeTest.js +++ b/tests/Governance/GovernorAlpha/ProposeTest.js @@ -16,7 +16,7 @@ const { address, etherMantissa, encodeParameters, mineBlock } = require("../../U const { deployAndGetIStaking } = require("../../Utils/initializer"); const GovernorAlpha = artifacts.require("GovernorAlpha"); -const StakingProxy = artifacts.require("StakingProxy"); + const TestToken = artifacts.require("TestToken"); //Upgradable Vesting Registry const VestingRegistryLogic = artifacts.require("VestingRegistryLogic"); @@ -38,8 +38,8 @@ contract("GovernorAlpha#propose/5", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(token.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(testToken.address); gov = await GovernorAlpha.new(address(0), staking.address, address(0), 4, 0); diff --git a/tests/Governance/GovernorAlpha/QueueTest.js b/tests/Governance/GovernorAlpha/QueueTest.js index 72a54f326..de26d3874 100644 --- a/tests/Governance/GovernorAlpha/QueueTest.js +++ b/tests/Governance/GovernorAlpha/QueueTest.js @@ -21,7 +21,7 @@ const { ethers } = require("hardhat"); const GovernorAlpha = artifacts.require("GovernorAlphaMockup"); const Timelock = artifacts.require("TimelockHarness"); -const StakingProxy = artifacts.require("StakingProxy"); + const TestToken = artifacts.require("TestToken"); //Upgradable Vesting Registry const VestingRegistryLogic = artifacts.require("VestingRegistryLogic"); @@ -59,8 +59,8 @@ contract("GovernorAlpha#queue/1", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(token.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(testToken.address); gov = await GovernorAlpha.new(timelock.address, staking.address, root, 4, 0); diff --git a/tests/Governance/GovernorAlpha/StateTest.js b/tests/Governance/GovernorAlpha/StateTest.js index 2b9cb7f01..4bff42138 100644 --- a/tests/Governance/GovernorAlpha/StateTest.js +++ b/tests/Governance/GovernorAlpha/StateTest.js @@ -30,7 +30,7 @@ const solparse = require("solparse"); const GovernorAlpha = artifacts.require("GovernorAlphaMockup"); const Timelock = artifacts.require("TimelockHarness"); -const StakingProxy = artifacts.require("StakingProxy"); + const TestToken = artifacts.require("TestToken"); const governorAlphaPath = path.join( @@ -334,8 +334,8 @@ contract("GovernorAlpha#state/1", (accounts) => { async function deployGovernor() { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(token.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(testToken.address); delay = etherUnsigned(2 * 24 * 60 * 60).multipliedBy(2); timelock = await Timelock.new(root, delay); diff --git a/tests/Governance/GovernorAlpha/anyone.test.js b/tests/Governance/GovernorAlpha/anyone.test.js index 25f8c7e69..fdbe4ac42 100644 --- a/tests/Governance/GovernorAlpha/anyone.test.js +++ b/tests/Governance/GovernorAlpha/anyone.test.js @@ -29,7 +29,7 @@ const { loadFixture } = require("@nomicfoundation/hardhat-network-helpers"); const GovernorAlpha = artifacts.require("GovernorAlphaMockup"); const Timelock = artifacts.require("Timelock"); const TestToken = artifacts.require("TestToken"); -const StakingProxy = artifacts.require("StakingProxy"); + const SetGet = artifacts.require("setGet"); const { @@ -104,7 +104,7 @@ async function advanceBlocks(num) { } contract("GovernorAlpha (Any User Functions)", (accounts) => { - let governorAlpha, staking, stakingProxy, timelock, testToken, setGet; + let governorAlpha, staking, stakingModulesProxy, timelock, testToken, setGet; let guardianOne, guardianTwo, voterOne, voterTwo, voterThree, userOne, userTwo; let targets, values, signatures, callDatas, eta, proposalId; @@ -122,8 +122,7 @@ contract("GovernorAlpha (Any User Functions)", (accounts) => { // Staking // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(testToken.address); - staking = await deployAndGetIStaking(stakingProxy.address); + staking = await deployAndGetIStaking(testToken.address); // Creating the Timelock Contract instance. // We would be assigning the `guardianOne` as the admin for now. diff --git a/tests/Governance/GovernorAlpha/guardian.test.js b/tests/Governance/GovernorAlpha/guardian.test.js index c14a9e6a1..53983b4e1 100644 --- a/tests/Governance/GovernorAlpha/guardian.test.js +++ b/tests/Governance/GovernorAlpha/guardian.test.js @@ -17,7 +17,6 @@ const GovernorAlpha = artifacts.require("GovernorAlphaMockup"); const Timelock = artifacts.require("Timelock"); const TestToken = artifacts.require("TestToken"); -const StakingProxy = artifacts.require("StakingProxy"); const { time, // Convert different time units to seconds. Available helpers are: seconds, minutes, hours, days, weeks and years. @@ -86,7 +85,7 @@ async function stake(tokenInstance, stakingInstance, stakeFor, delegatee, amount }*/ contract("GovernorAlpha (Guardian Functions)", (accounts) => { - let governorAlpha, staking, stakingProxy, timelock, testToken; + let governorAlpha, staking, timelock, testToken; let guardianOne, guardianTwo, voterOne, voterTwo, voterThree, userOne, userTwo; let targets, values, signatures, callDatas, proposalId; let newGovernorAlpha; @@ -105,8 +104,8 @@ contract("GovernorAlpha (Guardian Functions)", (accounts) => { // Staking // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(testToken.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(testToken.address); // Calculating the tokens to be sent for the Voters to Stake. let amountOne = new BN((quorumPercentageVotes * totalSupply + 1) / 100); diff --git a/tests/Governance/GovernorAlpha/proposers.test.js b/tests/Governance/GovernorAlpha/proposers.test.js index e99270c2f..6e132666e 100644 --- a/tests/Governance/GovernorAlpha/proposers.test.js +++ b/tests/Governance/GovernorAlpha/proposers.test.js @@ -8,7 +8,6 @@ const GovernorAlpha = artifacts.require("GovernorAlpha"); const Timelock = artifacts.require("Timelock"); const TestToken = artifacts.require("TestToken"); -const StakingProxy = artifacts.require("StakingProxy"); const { time, // Convert different time units to seconds. Available helpers are: seconds, minutes, hours, days, weeks and years. @@ -49,7 +48,7 @@ async function stake(tokenInstance, stakingInstance, stakeFor, delegatee, amount } contract("GovernorAlpha (Proposer Functions)", (accounts) => { - let governorAlpha, staking, stakingProxy, timelock, testToken; + let governorAlpha, staking, timelock, testToken; let guardianOne, guardianTwo, voterOne, voterTwo, voterThree, userOne, userTwo; let targets, values, signatures, callDatas, eta; @@ -67,8 +66,8 @@ contract("GovernorAlpha (Proposer Functions)", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(testToken.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(testToken.address); // Creating the Timelock Contract instance. // We would be assigning the `guardianOne` as the admin for now. diff --git a/tests/Governance/GovernorAlpha/voter.test.js b/tests/Governance/GovernorAlpha/voter.test.js index 50911d2bd..8981e88db 100644 --- a/tests/Governance/GovernorAlpha/voter.test.js +++ b/tests/Governance/GovernorAlpha/voter.test.js @@ -16,7 +16,6 @@ const GovernorAlpha = artifacts.require("GovernorAlphaMockup"); const Timelock = artifacts.require("Timelock"); const TestToken = artifacts.require("TestToken"); -const StakingProxy = artifacts.require("StakingProxy"); const { time, // Convert different time units to seconds. Available helpers are: seconds, minutes, hours, days, weeks and years. @@ -78,7 +77,7 @@ async function advanceBlocks(num) { } contract("GovernorAlpha (Voter Functions)", (accounts) => { - let governorAlpha, staking, stakingProxy, timelock, testToken; + let governorAlpha, staking, timelock, testToken; let guardianOne, guardianTwo, voterOne, voterTwo, voterThree, userOne, userTwo; let targets, values, signatures, callDatas, eta, proposalId; let txReceipt; @@ -97,8 +96,8 @@ contract("GovernorAlpha (Voter Functions)", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(testToken.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(testToken.address); // Creating the Timelock Contract instance. // We would be assigning the `guardianOne` as the admin for now. diff --git a/tests/Locked/admin.test.js b/tests/Locked/admin.test.js index ca5f0337d..f60841c31 100644 --- a/tests/Locked/admin.test.js +++ b/tests/Locked/admin.test.js @@ -10,7 +10,7 @@ const SOV = artifacts.require("TestToken"); const TestWrbtc = artifacts.require("TestWrbtc"); const LockedSOV = artifacts.require("LockedSOV"); -const StakingProxy = artifacts.require("StakingProxy"); + const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const VestingLogic = artifacts.require("VestingLogic"); const VestingFactory = artifacts.require("VestingFactory"); @@ -54,8 +54,8 @@ contract("Locked SOV (Admin Functions)", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(sov.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(sov.address); // Creating the FeeSharing Instance. feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( diff --git a/tests/Locked/anyone.test.js b/tests/Locked/anyone.test.js index ffce71cd7..bec606e1c 100644 --- a/tests/Locked/anyone.test.js +++ b/tests/Locked/anyone.test.js @@ -12,7 +12,7 @@ const SOV = artifacts.require("TestToken"); const TestWrbtc = artifacts.require("TestWrbtc"); const LockedSOV = artifacts.require("LockedSOV"); -const StakingProxy = artifacts.require("StakingProxy"); + const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const VestingLogic = artifacts.require("VestingLogic"); const VestingFactory = artifacts.require("VestingFactory"); @@ -65,8 +65,8 @@ contract("Locked SOV (Any User Functions)", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(sov.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(sov.address); // Creating the FeeSharing Instance. feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( diff --git a/tests/Locked/creator.test.js b/tests/Locked/creator.test.js index 1afc45083..e60d0108d 100644 --- a/tests/Locked/creator.test.js +++ b/tests/Locked/creator.test.js @@ -8,7 +8,7 @@ const SOV = artifacts.require("TestToken"); const TestWrbtc = artifacts.require("TestWrbtc"); const LockedSOV = artifacts.require("LockedSOV"); -const StakingProxy = artifacts.require("StakingProxy"); + const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const VestingLogic = artifacts.require("VestingLogic"); const VestingFactory = artifacts.require("VestingFactory"); @@ -49,8 +49,8 @@ contract("Locked SOV (Creator Functions)", (accounts) => { // Creating the Staking Instance. /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(sov.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(sov.address); // Creating the FeeSharing Instance. feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( diff --git a/tests/Locked/event.test.js b/tests/Locked/event.test.js index 7b09d574e..792396998 100644 --- a/tests/Locked/event.test.js +++ b/tests/Locked/event.test.js @@ -13,7 +13,7 @@ const SOV = artifacts.require("TestToken"); const TestWrbtc = artifacts.require("TestWrbtc"); const LockedSOV = artifacts.require("LockedSOV"); -const StakingProxy = artifacts.require("StakingProxy"); + const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const VestingLogic = artifacts.require("VestingLogic"); const VestingFactory = artifacts.require("VestingFactory"); @@ -66,8 +66,8 @@ contract("Locked SOV (Events)", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(sov.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(sov.address); // Creating the FeeSharing Instance. feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( diff --git a/tests/Locked/state.test.js b/tests/Locked/state.test.js index 2a38cbbef..f0797eb47 100644 --- a/tests/Locked/state.test.js +++ b/tests/Locked/state.test.js @@ -10,7 +10,7 @@ const SOV = artifacts.require("TestToken"); const TestWrbtc = artifacts.require("TestWrbtc"); const LockedSOV = artifacts.require("LockedSOV"); -const StakingProxy = artifacts.require("StakingProxy"); + const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const VestingLogic = artifacts.require("VestingLogic"); const VestingFactory = artifacts.require("VestingFactory"); @@ -168,8 +168,8 @@ contract("Locked SOV (State)", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(sov.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(sov.address); // Creating the FeeSharing Instance. feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( diff --git a/tests/OriginInvestorsClaim.test.js b/tests/OriginInvestorsClaim.test.js index 87052178d..d5a686833 100644 --- a/tests/OriginInvestorsClaim.test.js +++ b/tests/OriginInvestorsClaim.test.js @@ -23,7 +23,6 @@ const { const { mineBlock, setNextBlockTimestamp } = require("./Utils/Ethereum"); -const StakingProxy = artifacts.require("StakingProxy"); const SOV_ABI = artifacts.require("SOV"); const TestToken = artifacts.require("TestToken"); const TestWrbtc = artifacts.require("TestWrbtc"); @@ -151,14 +150,13 @@ contract("OriginInvestorsClaim", (accounts) => { cSOV1 = await TestToken.new("cSOV1", "cSOV1", 18, TOTAL_SUPPLY); cSOV2 = await TestToken.new("cSOV2", "cSOV2", 18, TOTAL_SUPPLY); - const stakingProxy = await StakingProxy.new(SOV.address); const modulesObject = await getStakingModulesObject(); - staking = await deployAndGetIStaking(stakingProxy.address, modulesObject); + staking = await deployAndGetIStaking(SOV.address, modulesObject); const weightedStakingModuleMockup = await WeightedStakingModuleMockup.new(); const modulesAddressList = getStakingModulesAddressList(modulesObject); //console.log(modulesAddressList); await replaceStakingModule( - stakingProxy.address, + staking.address, modulesAddressList["WeightedStakingModule"], weightedStakingModuleMockup.address ); diff --git a/tests/Utils/initializer.js b/tests/Utils/initializer.js index fd38ded5e..167efa0c2 100644 --- a/tests/Utils/initializer.js +++ b/tests/Utils/initializer.js @@ -51,13 +51,12 @@ const StakingVestingModule = artifacts.require("StakingVestingModule"); const StakingWithdrawModule = artifacts.require("StakingWithdrawModule"); const WeightedStakingModule = artifacts.require("WeightedStakingModule"); const StakingModuleBlockMockup = artifacts.require("StakingModuleBlockMockup"); -const StakingProxy = artifacts.require("StakingProxy"); const WeightedStakingModuleMockup = artifacts.require("WeightedStakingModuleMockup"); const IWeightedStakingModuleMockup = artifacts.require("IWeightedStakingModuleMockup"); const IStaking = artifacts.require("IStaking"); -const StakingModulesProxy = artifacts.require("ModulesProxy"); +const StakingModulesProxy = artifacts.require("StakingModulesProxy"); let modulesAddress; @@ -100,13 +99,12 @@ const getStakingModulesWithBlockMockup = async () => { }; const initWeightedStakingModulesMockup = async (tokenAddress) => { - const stakingProxy = await StakingProxy.new(tokenAddress); const modulesObject = await getStakingModulesObject(); - const staking = await deployAndGetIStaking(stakingProxy.address, modulesObject); + const staking = await deployAndGetIStaking(tokenAddress, modulesObject); const weightedStakingModuleMockup = await WeightedStakingModuleMockup.new(); const modulesAddressList = getStakingModulesAddressList(modulesObject); await replaceStakingModule( - stakingProxy.address, + staking.address, modulesAddressList["WeightedStakingModule"], weightedStakingModuleMockup.address ); @@ -122,15 +120,11 @@ const getStakingModulesAddressList = (modulesObject) => { return newObject; }; -const deployAndGetStakingModulesProxyAtStakingProxy = async ( - stakingProxyAddress, - modulesObject = undefined -) => { +const deployAndGetStakingModulesProxy = async (tokenAddress, modulesObject = undefined) => { const modules = modulesObject ? modulesObject : await getStakingModulesObject(); - const stakingProxy = await StakingProxy.at(stakingProxyAddress); - let stakingModulesProxy = await StakingModulesProxy.new(); - await stakingProxy.setImplementation(stakingModulesProxy.address); - stakingModulesProxy = await StakingModulesProxy.at(stakingProxyAddress); + + let stakingModulesProxy = await StakingModulesProxy.new(tokenAddress); + //let i = 0; for (let moduleName in modules) { //console.log(++i); @@ -149,16 +143,13 @@ const initializeStakingModulesAt = async (address) => { } }; -const deployAndGetIStaking = async (stakingProxyAddress, modulesObject = undefined) => { - const stakingModulesProxy = await deployAndGetStakingModulesProxyAtStakingProxy( - stakingProxyAddress, - modulesObject - ); +const deployAndGetIStaking = async (tokenAddress, modulesObject = undefined) => { + const stakingModulesProxy = await deployAndGetStakingModulesProxy(tokenAddress, modulesObject); return await getIStaking(stakingModulesProxy.address); }; -const getIStaking = async (stakingProxyAddress) => { - return await IStaking.at(stakingProxyAddress); +const getIStaking = async (stakingModulesProxyAddress) => { + return await IStaking.at(stakingModulesProxyAddress); }; const getStakingModulesProxyAt = async (address) => { @@ -166,9 +157,9 @@ const getStakingModulesProxyAt = async (address) => { }; /// @dev intended for mocking modules -const replaceStakingModule = async (stakingProxyAddress, moduleFromAddress, moduleToAddress) => { - const stakingProxy = await StakingModulesProxy.at(stakingProxyAddress); - await stakingProxy.replaceModule(moduleFromAddress, moduleToAddress); +const replaceStakingModule = async (stakingAddress, moduleFromAddress, moduleToAddress) => { + const stakingModulesProxy = await StakingModulesProxy.at(stakingAddress); + await stakingModulesProxy.replaceModule(moduleFromAddress, moduleToAddress); }; // <------------------- STAKING -------------------> // @@ -735,7 +726,7 @@ module.exports = { getMockLoanTokenWRBTC, // staking - deployAndGetStakingModulesProxyAtStakingProxy, + deployAndGetStakingModulesProxy, deployAndGetIStaking, getIStaking, replaceStakingModule, diff --git a/tests/affiliates/affiliates.test.js b/tests/affiliates/affiliates.test.js index fc5cd9995..578da0a91 100644 --- a/tests/affiliates/affiliates.test.js +++ b/tests/affiliates/affiliates.test.js @@ -34,7 +34,7 @@ const ILoanTokenModulesMock = artifacts.require("ILoanTokenModulesMock"); const ILoanTokenLogicProxy = artifacts.require("ILoanTokenLogicProxy"); const LockedSOVFailedMockup = artifacts.require("LockedSOVFailedMockup"); const LockedSOV = artifacts.require("LockedSOV"); -const StakingProxy = artifacts.require("StakingProxy"); + const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const VestingLogic = artifacts.require("VestingLogic"); const VestingFactory = artifacts.require("VestingFactory"); @@ -122,8 +122,7 @@ contract("Affiliates", (accounts) => { } // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(SUSD.address); - staking = await deployAndGetIStaking(stakingProxy.address); + staking = await deployAndGetIStaking(SUSD.address); // Creating the FeeSharing Instance. feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( diff --git a/tests/affiliates/affiliates_integration.test.js b/tests/affiliates/affiliates_integration.test.js index fdf8aa800..a72ff5f33 100644 --- a/tests/affiliates/affiliates_integration.test.js +++ b/tests/affiliates/affiliates_integration.test.js @@ -27,7 +27,7 @@ const ILoanTokenLogicProxy = artifacts.require("ILoanTokenLogicProxy"); const ILoanTokenModules = artifacts.require("ILoanTokenModules"); const LoanToken = artifacts.require("LoanToken"); const LockedSOV = artifacts.require("LockedSOV"); -const StakingProxy = artifacts.require("StakingProxy"); + const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const VestingLogic = artifacts.require("VestingLogic"); const VestingFactory = artifacts.require("VestingFactory"); @@ -127,8 +127,7 @@ contract("Affiliates", (accounts) => { } // Creating the Staking Modules Instance. - stakingProxy = await StakingProxy.new(SUSD.address); - staking = await deployAndGetIStaking(stakingProxy.address); + staking = await deployAndGetIStaking(SUSD.address); // Creating the FeeSharing Instance. feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( diff --git a/tests/loan-token/LoanTokenTest.js b/tests/loan-token/LoanTokenTest.js index 64c8a5808..14657be4b 100644 --- a/tests/loan-token/LoanTokenTest.js +++ b/tests/loan-token/LoanTokenTest.js @@ -25,7 +25,6 @@ const { const GovernorAlpha = artifacts.require("GovernorAlphaMockup"); const Timelock = artifacts.require("TimelockHarness"); -const StakingProxy = artifacts.require("StakingProxy"); const LoanToken = artifacts.require("LoanToken"); const LoanTokenSettings = artifacts.require("LoanTokenSettingsLowerAdmin"); @@ -63,8 +62,8 @@ contract("LoanTokenUpgrade", (accounts) => { await sovryn.setSovrynProtocolAddress(sovryn.address); // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(SUSD.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(SUSD.address); // Governor timelock = await Timelock.new(root, TWO_DAYS); diff --git a/tests/loan-token/tokenFunctionality.test.js b/tests/loan-token/tokenFunctionality.test.js index 7aaea4452..e3d0b6051 100644 --- a/tests/loan-token/tokenFunctionality.test.js +++ b/tests/loan-token/tokenFunctionality.test.js @@ -15,7 +15,7 @@ const { expect } = require("chai"); const { loadFixture } = require("@nomicfoundation/hardhat-network-helpers"); const { expectRevert, BN, expectEvent } = require("@openzeppelin/test-helpers"); -const StakingProxy = artifacts.require("StakingProxy"); + const FeeSharingCollector = artifacts.require("FeeSharingCollector"); const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorProxy"); const Vesting = artifacts.require("TeamVesting"); @@ -131,9 +131,9 @@ contract("LoanTokenFunctionality", (accounts) => { it("should transfer to tokenOwner if passed recipient is vesting contract that has tokenOwner() selector", async () => { const vestingLogic = await VestingLogic.new(); // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(SOVToken.address); + const modulesObject = await getStakingModulesObject(); - const staking = await deployAndGetIStaking(stakingProxy.address, modulesObject); + const staking = await deployAndGetIStaking(SOVToken.address, modulesObject); const tokenOwner = accounts[3]; const cliff = new BN(24 * 60 * 60).mul(new BN(1092)); @@ -190,15 +190,15 @@ contract("LoanTokenFunctionality", (accounts) => { it("should transfer to the passed recipient if passed recipient is EOA / Contract that has no tokenOwner() function", async () => { // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(SOVToken.address); + const modulesObject = await getStakingModulesObject(); - const staking = await deployAndGetIStaking(stakingProxy.address, modulesObject); + const staking = await deployAndGetIStaking(SOVToken.address, modulesObject); await loanToken.setStakingContractAddress(staking.address); expect(await loanToken.getStakingContractAddress()).to.equal(staking.address); // we register the contract that has no tokenOwner function - const dummyContractAddress = stakingProxy.address; + const dummyContractAddress = staking.address; await staking.addContractCodeHash(dummyContractAddress); const previousDummyContractBalance = await loanToken.balanceOf(dummyContractAddress); @@ -216,9 +216,9 @@ contract("LoanTokenFunctionality", (accounts) => { it("should transfer to the passed recipient if the passed recipient is not vesting contract", async () => { const vestingLogic = await VestingLogic.new(); // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(SOVToken.address); + const modulesObject = await getStakingModulesObject(); - const staking = await deployAndGetIStaking(stakingProxy.address, modulesObject); + const staking = await deployAndGetIStaking(SOVToken.address, modulesObject); const tokenOwner = accounts[3]; const passedRecipient = accounts[2]; const cliff = new BN(24 * 60 * 60).mul(new BN(1092)); diff --git a/tests/staking/ExtendedStakingTest.js b/tests/staking/ExtendedStakingTest.js index 567c8652f..b4346253b 100644 --- a/tests/staking/ExtendedStakingTest.js +++ b/tests/staking/ExtendedStakingTest.js @@ -57,7 +57,6 @@ const { advanceBlocks, } = require("../Utils/Ethereum"); -const StakingProxy = artifacts.require("StakingProxy"); const VestingLogic = artifacts.require("VestingLogicMockup"); const Vesting = artifacts.require("TeamVesting"); @@ -118,14 +117,13 @@ contract("Staking", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface Mockup). - const stakingProxy = await StakingProxy.new(token.address); modulesObject = await getStakingModulesObject(); - staking = await deployAndGetIStaking(stakingProxy.address, modulesObject); + staking = await deployAndGetIStaking(token.address, modulesObject); const weightedStakingModuleMockup = await WeightedStakingModuleMockup.new(); modulesAddressList = getStakingModulesAddressList(modulesObject); await replaceStakingModule( - stakingProxy.address, + staking.address, modulesAddressList["WeightedStakingModule"], weightedStakingModuleMockup.address ); diff --git a/tests/staking/PauseStaking.test.js b/tests/staking/PauseStaking.test.js index 51c86aaea..3b687146d 100644 --- a/tests/staking/PauseStaking.test.js +++ b/tests/staking/PauseStaking.test.js @@ -26,8 +26,6 @@ const { const WeightedStakingModuleMockup = artifacts.require("WeightedStakingModuleMockup"); const IWeightedStakingModuleMockup = artifacts.require("IWeightedStakingModuleMockup"); -const StakingProxy = artifacts.require("StakingProxy"); - const SOV = artifacts.require("SOV"); const LoanTokenLogic = artifacts.require("LoanTokenLogicStandard"); @@ -89,14 +87,14 @@ contract("Staking", (accounts) => { // Staking /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(token.address); + const modulesObject = await getStakingModulesObject(); - staking = await deployAndGetIStaking(stakingProxy.address, modulesObject); + staking = await deployAndGetIStaking(token.address, modulesObject); const weightedStakingModuleMockup = await WeightedStakingModuleMockup.new(); const modulesAddressList = getStakingModulesAddressList(modulesObject); //console.log(modulesAddressList); await replaceStakingModule( - stakingProxy.address, + staking.address, modulesAddressList["WeightedStakingModule"], weightedStakingModuleMockup.address ); diff --git a/tests/staking/StakingTest.js b/tests/staking/StakingTest.js index bb1fd6c4c..4d390c8bb 100644 --- a/tests/staking/StakingTest.js +++ b/tests/staking/StakingTest.js @@ -35,7 +35,6 @@ const EIP712 = require("../Utils/EIP712"); // const EIP712Ethers = require("../Utils/EIP712Ethers"); const { getAccountsPrivateKeysBuffer } = require("../Utils/hardhat_utils"); -const StakingProxy = artifacts.require("StakingProxy"); const TestToken = artifacts.require("TestToken"); const Vesting = artifacts.require("Vesting"); const VestingLogic = artifacts.require("VestingLogic"); @@ -96,9 +95,9 @@ contract("Staking", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(token.address); - staking = await deployAndGetIStaking(stakingProxy.address); - stakingWrapperMockup = await StakingWrapperMockup.new(stakingProxy.address, token.address); + + staking = await deployAndGetIStaking(token.address); + stakingWrapperMockup = await StakingWrapperMockup.new(staking.address, token.address); //Upgradable Vesting Registry const vestingRegistryLogic = await VestingRegistryLogic.new(); diff --git a/tests/staking/VoteExploitSameBlock.test.js b/tests/staking/VoteExploitSameBlock.test.js index 8868a3949..fb3893616 100644 --- a/tests/staking/VoteExploitSameBlock.test.js +++ b/tests/staking/VoteExploitSameBlock.test.js @@ -12,7 +12,6 @@ const { getAccountsPrivateKeysBuffer } = require("../Utils/hardhat_utils"); const { deployAndGetIStaking } = require("../Utils/initializer"); const { ZERO_ADDRESS } = require("@openzeppelin/test-helpers/src/constants"); -const StakingProxy = artifacts.require("StakingProxy"); const TestToken = artifacts.require("TestToken"); const VestingLogic = artifacts.require("VestingLogic"); //Upgradable Vesting Registry @@ -69,8 +68,8 @@ contract("Staking", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(token.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(token.address); //Upgradable Vesting Registry vestingRegistryLogic = await VestingRegistryLogic.new(); diff --git a/tests/staking/WeightedStakingTest.js b/tests/staking/WeightedStakingTest.js index 909baab57..c6d3b9bfe 100644 --- a/tests/staking/WeightedStakingTest.js +++ b/tests/staking/WeightedStakingTest.js @@ -15,7 +15,6 @@ const { expectRevert, BN } = require("@openzeppelin/test-helpers"); const { mineBlock, setTime } = require("../Utils/Ethereum"); const { deployAndGetIStaking } = require("../Utils/initializer"); -const StakingProxy = artifacts.require("StakingProxy"); const TestToken = artifacts.require("TestToken"); const VestingLogic = artifacts.require("VestingLogicMockup"); const Vesting = artifacts.require("TeamVesting"); @@ -46,8 +45,8 @@ contract("WeightedStaking", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(token.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(token.address); //await token.transfer(a2, "1000"); //await token.approve(staking.address, "1000", { from: a2 }); diff --git a/tests/stakingRewards/Rewards.js b/tests/stakingRewards/Rewards.js index 677462af7..8ffa4eaf3 100644 --- a/tests/stakingRewards/Rewards.js +++ b/tests/stakingRewards/Rewards.js @@ -20,7 +20,7 @@ const { deployAndGetIStaking, getStakingModulesWithBlockMockup } = require("../U const { takeSnapshot } = require("@nomicfoundation/hardhat-network-helpers"); const SOV_ABI = artifacts.require("SOV"); -const StakingProxy = artifacts.require("StakingProxy"); + const StakingRewards = artifacts.require("StakingRewardsMockUp"); const StakingRewardsProxy = artifacts.require("StakingRewardsProxy"); const IStakingModuleBlockMockup = artifacts.require("IStakingModuleBlockMockup"); @@ -51,9 +51,9 @@ contract("StakingRewards - First Period", (accounts) => { blockMockUp = await BlockMockUp.new(); // Deployed Staking Functionality - const stakingProxy = await StakingProxy.new(SOV.address); + iStaking = await deployAndGetIStaking( - stakingProxy.address, + SOV.address, await getStakingModulesWithBlockMockup() ); staking = await IStakingModuleBlockMockup.at(iStaking.address); // applying extended mockup interface diff --git a/tests/stakingRewards/StakingRewards.js b/tests/stakingRewards/StakingRewards.js index 68b6913f4..ce004ff37 100644 --- a/tests/stakingRewards/StakingRewards.js +++ b/tests/stakingRewards/StakingRewards.js @@ -15,8 +15,6 @@ const { const { deployAndGetIStaking, getStakingModulesWithBlockMockup } = require("../Utils/initializer"); -const StakingProxy = artifacts.require("StakingProxy"); - const StakingRewards = artifacts.require("StakingRewardsMockUp"); const StakingRewardsProxy = artifacts.require("StakingRewardsProxy"); const FeeSharingCollector = artifacts.require("FeeSharingCollector"); @@ -40,9 +38,8 @@ contract("StakingRewards", (accounts) => { let totalRewards; const initStakingModules = async () => { - const stakingProxy = await StakingProxy.new(SOV.address); iStaking = await deployAndGetIStaking( - stakingProxy.address, + SOV.address, await getStakingModulesWithBlockMockup() ); diff --git a/tests/swaps/SwapsExternal.js b/tests/swaps/SwapsExternal.js index 51a1ef97d..2d59caea2 100644 --- a/tests/swaps/SwapsExternal.js +++ b/tests/swaps/SwapsExternal.js @@ -32,8 +32,6 @@ const SwapsExternal = artifacts.require("SwapsExternal"); const PriceFeedsLocal = artifacts.require("PriceFeedsLocal"); const TestSovrynSwap = artifacts.require("TestSovrynSwap"); -const StakingProxy = artifacts.require("StakingProxy"); - const FeeSharingCollector = artifacts.require("FeeSharingCollector"); const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorProxy"); @@ -122,8 +120,8 @@ contract("SwapsExternal", (accounts) => { // Staking /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(SUSD.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(SUSD.address); // FeeSharingCollectorProxy feeSharingCollector = await FeeSharingCollector.new(); diff --git a/tests/vesting/FourYearVesting.js b/tests/vesting/FourYearVesting.js index b7065623c..f2dabde29 100644 --- a/tests/vesting/FourYearVesting.js +++ b/tests/vesting/FourYearVesting.js @@ -6,7 +6,7 @@ const hre = require("hardhat"); const { ethers } = hre; const StakingLogic = artifacts.require("IStaking"); -const StakingProxy = artifacts.require("StakingProxy"); + const SOV = artifacts.require("SOV"); const TestWrbtc = artifacts.require("TestWrbtc"); const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); @@ -32,7 +32,7 @@ const increaseTimeEthers = async (time) => { contract("FourYearVesting", (accounts) => { let root, a1, a2, a3; - let token, staking, stakingLogic, stakingProxy, feeSharingCollectorProxy; + let token, staking, feeSharingCollectorProxy; let vestingLogic; let vestingFactory; let kickoffTS; @@ -54,8 +54,8 @@ contract("FourYearVesting", (accounts) => { ); // Creating the Staking Instance (Staking Modules Interface). - stakingProxy = await StakingProxy.new(token.address); - staking = await deployAndGetIStaking(stakingProxy.address); + stakingModulesProxy = await StakingModulesProxy.new(token.address); + staking = await deployAndGetIStaking(token.address); //Upgradable Vesting Registry vestingRegistryLogic = await VestingRegistryLogic.new(); @@ -912,8 +912,8 @@ contract("FourYearVesting", (accounts) => { // 1. set new staking contract address on staking contract // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(token.address); - const newStaking = await deployAndGetIStaking(stakingProxy.address); + + const newStaking = await deployAndGetIStaking(token.address); await staking.setNewStakingContract(newStaking.address); @@ -930,8 +930,7 @@ contract("FourYearVesting", (accounts) => { }); it("should fail if there is no new staking contract set", async () => { - let newStaking = await StakingProxy.new(token.address); - await newStaking.setImplementation(await stakingProxy.getImplementation()); //setting StakingModulesProxy address + let newStaking = await StakingModulesProxy.new(token.address); await initializeStakingModulesAt(newStaking.address); // deployes and initializes modules in the newStaking storage using previous StakingModulesProxy contact vesting = await Vesting.new( @@ -950,8 +949,7 @@ contract("FourYearVesting", (accounts) => { }); it("should fail if the caller is neither owner nor token owner", async () => { - let newStaking = await StakingProxy.new(token.address); - await newStaking.setImplementation(await stakingProxy.getImplementation()); //setting StakingModulesProxy address + let newStaking = await StakingModulesProxy.new(token.address); await initializeStakingModulesAt(newStaking.address); // deploys and initializes modules in the newStaking storage using previous StakingModulesProxy contact newStaking = await StakingLogic.at(newStaking.address); diff --git a/tests/vesting/TeamVesting.js b/tests/vesting/TeamVesting.js index 8824f1339..21bed7774 100644 --- a/tests/vesting/TeamVesting.js +++ b/tests/vesting/TeamVesting.js @@ -9,7 +9,6 @@ * */ -const StakingProxy = artifacts.require("StakingProxy"); const TestToken = artifacts.require("TestToken"); const TOTAL_SUPPLY = "10000000000000000000000000"; @@ -27,8 +26,8 @@ contract("TeamVesting", (accounts) => { token = await TestToken.new(name, symbol, 18, TOTAL_SUPPLY); // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(token.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(token.address); await token.transfer(a2, "1000"); await token.approve(staking.address, "1000", { from: a2 }); diff --git a/tests/vesting/Vesting.js b/tests/vesting/Vesting.js index a47b8f04e..29d91c39f 100644 --- a/tests/vesting/Vesting.js +++ b/tests/vesting/Vesting.js @@ -23,7 +23,7 @@ const { decodeLogs, } = require("../Utils/initializer"); const StakingLogic = artifacts.require("IStaking"); -const StakingProxy = artifacts.require("StakingProxy"); + const StakingWithdrawModule = artifacts.require("StakingWithdrawModule"); const SOV = artifacts.require("SOV"); const TestWrbtc = artifacts.require("TestWrbtc"); @@ -55,7 +55,7 @@ contract("Vesting", (accounts) => { const maxWithdrawIterations = 10; let root, a1, a2, a3; - let token, staking, stakingProxy, feeSharingCollectorProxy; + let token, staking, feeSharingCollectorProxy; let vestingLogic; let kickoffTS; @@ -75,8 +75,8 @@ contract("Vesting", (accounts) => { ); // Creating the Staking Instance (Staking Modules Interface). - stakingProxy = await StakingProxy.new(token.address); - staking = await deployAndGetIStaking(stakingProxy.address); + stakingModulesProxy = await StakingModulesProxy.new(token.address); + staking = await deployAndGetIStaking(token.address); //Upgradable Vesting Registry vestingRegistryLogic = await VestingRegistryLogic.new(); @@ -2491,8 +2491,7 @@ contract("Vesting", (accounts) => { vesting = await VestingLogic.at(vesting.address); // 1. set new staking contract address on staking contract - let newStaking = await StakingProxy.new(token.address); - await newStaking.setImplementation(await stakingProxy.getImplementation()); //setting StakingModulesProxy address + let newStaking = await StakingModulesProxy.new(token.address); await initializeStakingModulesAt(newStaking.address); // deployes and initializes modules in the newStaking storage using previous StakingModulesProxy contact await staking.setNewStakingContract(newStaking.address); @@ -2510,8 +2509,8 @@ contract("Vesting", (accounts) => { }); it("should fail if there is no new staking contract set", async () => { - let newStaking = await StakingProxy.new(token.address); - await newStaking.setImplementation(await stakingProxy.getImplementation()); //setting StakingModulesProxy address + let newStaking = await StakingModulesProxy.new(token.address); + await initializeStakingModulesAt(newStaking.address); // deployes and initializes modules in the newStaking storage using previous StakingModulesProxy contact vesting = await Vesting.new( vestingLogic.address, @@ -2530,8 +2529,7 @@ contract("Vesting", (accounts) => { }); it("should fail if the caller is neither owner nor token owner", async () => { - let newStaking = await StakingProxy.new(token.address); - await newStaking.setImplementation(await stakingProxy.getImplementation()); //setting StakingModulesProxy address + let newStaking = await StakingModulesProxy.new(token.address); await initializeStakingModulesAt(newStaking.address); // deployes and initializes modules in the newStaking storage using previous StakingModulesProxy contact newStaking = await StakingLogic.at(newStaking.address); diff --git a/tests/vesting/VestingCreator.js b/tests/vesting/VestingCreator.js index 7c299157e..a5aef5a25 100644 --- a/tests/vesting/VestingCreator.js +++ b/tests/vesting/VestingCreator.js @@ -16,7 +16,6 @@ const { loadFixture } = require("@nomicfoundation/hardhat-network-helpers"); const { expectRevert, expectEvent, constants, BN } = require("@openzeppelin/test-helpers"); const { deployAndGetIStaking } = require("../Utils/initializer"); -const StakingProxy = artifacts.require("StakingProxy"); const SOV_ABI = artifacts.require("SOV"); const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const VestingLogic = artifacts.require("VestingLogic"); @@ -56,8 +55,8 @@ contract("VestingCreator", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(SOV.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(SOV.address); feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( ZERO_ADDRESS, diff --git a/tests/vesting/VestingRegistry.js b/tests/vesting/VestingRegistry.js index b6b4286ca..d66c48111 100644 --- a/tests/vesting/VestingRegistry.js +++ b/tests/vesting/VestingRegistry.js @@ -23,7 +23,6 @@ const { expectRevert, expectEvent, constants, BN } = require("@openzeppelin/test const { mineBlock } = require("../Utils/Ethereum"); const { deployAndGetIStaking } = require("../Utils/initializer"); -const StakingProxy = artifacts.require("StakingProxy"); const SOV_ABI = artifacts.require("SOV"); const TestWrbtc = artifacts.require("TestWrbtc"); const TestToken = artifacts.require("TestToken"); @@ -57,8 +56,8 @@ contract("VestingRegistry", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(SOV.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(SOV.address); feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( ZERO_ADDRESS, diff --git a/tests/vesting/VestingRegistry2.js b/tests/vesting/VestingRegistry2.js index d76aac44c..55218d073 100644 --- a/tests/vesting/VestingRegistry2.js +++ b/tests/vesting/VestingRegistry2.js @@ -23,7 +23,6 @@ const { expectRevert, expectEvent, constants, BN } = require("@openzeppelin/test const { mineBlock } = require("../Utils/Ethereum"); const { deployAndGetIStaking } = require("../Utils/initializer"); -const StakingProxy = artifacts.require("StakingProxy"); const SOV_ABI = artifacts.require("SOV"); const TestToken = artifacts.require("TestToken"); const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); @@ -55,8 +54,8 @@ contract("VestingRegistry", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(SOV.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(SOV.address); feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( ZERO_ADDRESS, diff --git a/tests/vesting/VestingRegistryLogic.js b/tests/vesting/VestingRegistryLogic.js index 2a08783b5..bac42773e 100644 --- a/tests/vesting/VestingRegistryLogic.js +++ b/tests/vesting/VestingRegistryLogic.js @@ -4,7 +4,6 @@ const { expectRevert, expectEvent, constants, BN } = require("@openzeppelin/test const { mineBlock } = require("../Utils/Ethereum"); const { deployAndGetIStaking } = require("../Utils/initializer"); -const StakingProxy = artifacts.require("StakingProxy"); const SOV_ABI = artifacts.require("SOV"); const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const VestingLogic = artifacts.require("VestingLogic"); @@ -46,8 +45,8 @@ contract("VestingRegistryLogic", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(SOV.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(SOV.address); feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( ZERO_ADDRESS, diff --git a/tests/vesting/VestingRegistryMigrations.js b/tests/vesting/VestingRegistryMigrations.js index 92aacfcc0..440dc6b0c 100644 --- a/tests/vesting/VestingRegistryMigrations.js +++ b/tests/vesting/VestingRegistryMigrations.js @@ -4,7 +4,6 @@ const { expectRevert, expectEvent, constants, BN } = require("@openzeppelin/test const { mineBlock } = require("../Utils/Ethereum"); const { deployAndGetIStaking } = require("../Utils/initializer"); -const StakingProxy = artifacts.require("StakingProxy"); const SOV_ABI = artifacts.require("SOV"); const FeeSharingCollectorProxy = artifacts.require("FeeSharingCollectorMockup"); const VestingLogic = artifacts.require("VestingLogic"); @@ -53,8 +52,8 @@ contract("VestingRegistryMigrations", (accounts) => { /// Staking Modules // Creating the Staking Instance (Staking Modules Interface). - const stakingProxy = await StakingProxy.new(SOV.address); - staking = await deployAndGetIStaking(stakingProxy.address); + + staking = await deployAndGetIStaking(SOV.address); feeSharingCollectorProxy = await FeeSharingCollectorProxy.new( ZERO_ADDRESS,