diff --git a/contracts/lib/ChildManagerLib.sol b/contracts/lib/ChildManagerLib.sol deleted file mode 100644 index 40b4c6cd..00000000 --- a/contracts/lib/ChildManagerLib.sol +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.19; - -struct ChildChains { - uint256 counter; - mapping(uint256 => address) managers; - mapping(address => uint256) ids; -} - -library ChildManagerLib { - function registerChild(ChildChains storage self, address manager) internal returns (uint256 id) { - require(manager != address(0), "ChildManagerLib: INVALID_ADDRESS"); - id = ++self.counter; - self.managers[id] = manager; - self.ids[manager] = id; - } - - function managerOf(ChildChains storage self, uint256 id) internal view returns (address manager) { - manager = self.managers[id]; - require(manager != address(0), "ChildManagerLib: INVALID_ID"); - } - - function idFor(ChildChains storage self, address manager) internal view returns (uint256 id) { - id = self.ids[manager]; - require(id != 0, "ChildManagerLib: INVALID_MANAGER"); - } -} diff --git a/contracts/lib/StakeManagerLib.sol b/contracts/lib/StakeManagerLib.sol deleted file mode 100644 index 6148274c..00000000 --- a/contracts/lib/StakeManagerLib.sol +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.19; - -import "../interfaces/root/staking/IStakeManager.sol"; - -struct Stakes { - uint256 totalStake; - // validator => child => amount - mapping(address => mapping(uint256 => uint256)) stakes; - // child chain => total stake - mapping(uint256 => uint256) totalStakePerChild; - mapping(address => uint256) totalStakes; - mapping(address => uint256) withdrawableStakes; -} - -library StakeManagerLib { - function addStake(Stakes storage self, address validator, uint256 id, uint256 amount) internal { - self.stakes[validator][id] += amount; - self.totalStakePerChild[id] += amount; - self.totalStakes[validator] += amount; - self.totalStake += amount; - } - - function removeStake(Stakes storage self, address validator, uint256 id, uint256 amount) internal { - self.stakes[validator][id] -= amount; - self.totalStakePerChild[id] -= amount; - self.totalStakes[validator] -= amount; - self.totalStake -= amount; - self.withdrawableStakes[validator] += amount; - } - - function withdrawStake(Stakes storage self, address validator, uint256 amount) internal { - self.withdrawableStakes[validator] -= amount; - } - - function withdrawableStakeOf(Stakes storage self, address validator) internal view returns (uint256 amount) { - amount = self.withdrawableStakes[validator]; - } - - function totalStakeOfChild(Stakes storage self, uint256 id) internal view returns (uint256 amount) { - amount = self.totalStakePerChild[id]; - } - - function stakeOf(Stakes storage self, address validator, uint256 id) internal view returns (uint256 amount) { - amount = self.stakes[validator][id]; - } - - function totalStakeOf(Stakes storage self, address validator) internal view returns (uint256 amount) { - amount = self.totalStakes[validator]; - } -} diff --git a/contracts/root/staking/StakeManager.sol b/contracts/root/staking/StakeManager.sol index 27680bd8..84f4b269 100644 --- a/contracts/root/staking/StakeManager.sol +++ b/contracts/root/staking/StakeManager.sol @@ -4,28 +4,25 @@ pragma solidity 0.8.19; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import "../../lib/ChildManagerLib.sol"; -import "../../lib/StakeManagerLib.sol"; +import "../../interfaces/root/staking/IStakeManager.sol"; +import "./StakeManagerChildData.sol"; +import "./StakeManagerStakingData.sol"; -contract StakeManager is IStakeManager, Initializable { - using ChildManagerLib for ChildChains; - using StakeManagerLib for Stakes; +contract StakeManager is IStakeManager, Initializable, StakeManagerChildData, StakeManagerStakingData { using SafeERC20 for IERC20; - IERC20 internal matic; - ChildChains private _chains; - Stakes private _stakes; + IERC20 internal stakingToken; - function initialize(address newMatic) public initializer { - matic = IERC20(newMatic); + function initialize(address newStakingToken) public initializer { + stakingToken = IERC20(newStakingToken); } /** * @inheritdoc IStakeManager */ function registerChildChain(address manager) external returns (uint256 id) { - require(_chains.ids[manager] == 0, "StakeManager: ID_ALREADY_SET"); - id = _chains.registerChild(manager); + require(_ids[manager] == 0, "StakeManager: ID_ALREADY_SET"); + id = _registerChild(manager); ISupernetManager(manager).onInit(id); // slither-disable-next-line reentrancy-events emit ChildManagerRegistered(id, manager); @@ -35,12 +32,12 @@ contract StakeManager is IStakeManager, Initializable { * @inheritdoc IStakeManager */ function stakeFor(uint256 id, uint256 amount) external { - require(id != 0 && id <= _chains.counter, "StakeManager: INVALID_ID"); + require(id != 0 && id <= counter, "StakeManager: INVALID_ID"); // slither-disable-next-line reentrancy-benign,reentrancy-events - matic.safeTransferFrom(msg.sender, address(this), amount); + stakingToken.safeTransferFrom(msg.sender, address(this), amount); // calling the library directly once fixes the coverage issue // https://github.com/foundry-rs/foundry/issues/4854#issuecomment-1528897219 - StakeManagerLib.addStake(_stakes, msg.sender, id, amount); + _addStake(msg.sender, id, amount); ISupernetManager manager = managerOf(id); manager.onStake(msg.sender, amount); // slither-disable-next-line reentrancy-events @@ -52,7 +49,7 @@ contract StakeManager is IStakeManager, Initializable { */ function releaseStakeOf(address validator, uint256 amount) external { uint256 id = idFor(msg.sender); - _stakes.removeStake(validator, id, amount); + _removeStake(validator, id, amount); // slither-disable-next-line reentrancy-events emit StakeRemoved(id, validator, amount); } @@ -69,9 +66,9 @@ contract StakeManager is IStakeManager, Initializable { */ function slashStakeOf(address validator, uint256 amount) external { uint256 id = idFor(msg.sender); - uint256 stake = stakeOf(validator, id); + uint256 stake = _stakeOf(validator, id); if (amount > stake) amount = stake; - _stakes.removeStake(validator, id, stake); + _removeStake(validator, id, stake); _withdrawStake(validator, msg.sender, amount); emit StakeRemoved(id, validator, stake); emit ValidatorSlashed(id, validator, amount); @@ -81,55 +78,55 @@ contract StakeManager is IStakeManager, Initializable { * @inheritdoc IStakeManager */ function withdrawableStake(address validator) external view returns (uint256 amount) { - amount = _stakes.withdrawableStakeOf(validator); + amount = _withdrawableStakeOf(validator); } /** * @inheritdoc IStakeManager */ function totalStake() external view returns (uint256 amount) { - amount = _stakes.totalStake; + amount = _totalStake; } /** * @inheritdoc IStakeManager */ function totalStakeOfChild(uint256 id) external view returns (uint256 amount) { - amount = _stakes.totalStakeOfChild(id); + amount = _totalStakeOfChild(id); } /** * @inheritdoc IStakeManager */ function totalStakeOf(address validator) external view returns (uint256 amount) { - amount = _stakes.totalStakeOf(validator); + amount = _totalStakeOf(validator); } /** * @inheritdoc IStakeManager */ function stakeOf(address validator, uint256 id) public view returns (uint256 amount) { - amount = _stakes.stakeOf(validator, id); + amount = _stakeOf(validator, id); } /** * @inheritdoc IStakeManager */ function managerOf(uint256 id) public view returns (ISupernetManager manager) { - manager = ISupernetManager(_chains.managerOf(id)); + manager = ISupernetManager(_managerOf(id)); } /** * @inheritdoc IStakeManager */ function idFor(address manager) public view returns (uint256 id) { - id = ChildManagerLib.idFor(_chains, manager); + id = _idFor(manager); } function _withdrawStake(address validator, address to, uint256 amount) private { - _stakes.withdrawStake(validator, amount); + _withdrawStake(validator, amount); // slither-disable-next-line reentrancy-events - matic.safeTransfer(to, amount); + stakingToken.safeTransfer(to, amount); emit StakeWithdrawn(validator, to, amount); } diff --git a/contracts/root/staking/StakeManagerChildData.sol b/contracts/root/staking/StakeManagerChildData.sol new file mode 100644 index 00000000..185ae8c4 --- /dev/null +++ b/contracts/root/staking/StakeManagerChildData.sol @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.19; + +/** + * @title StakeManagerChildData + * @notice Holds data to allow look-up between child chain manager contract address and child chain id. + * Note that this is contract is designed to be included in StakeManager. It is upgradeable. + */ +abstract contract StakeManagerChildData { + // Highest child chain id allocated thus far. Child chain id 0x00 is an invalid id. + uint256 internal counter; + // child chain id to child chain manager contract address. + mapping(uint256 => address) private _managers; + // child chain manager contract address to child chain id. + // slither-disable-next-line naming-convention + mapping(address => uint256) internal _ids; + + /** + * @notice Register a child chain manager contract and allocate a child chain id. + * @param manager Child chain manager contract address. + * @return id Child chain id allocated for the child chain. + */ + function _registerChild(address manager) internal returns (uint256 id) { + require(manager != address(0), "StakeManagerChildData: INVALID_ADDRESS"); + unchecked { + id = ++counter; + } + _managers[id] = manager; + _ids[manager] = id; + } + + /** + * @notice Get the child chain manager contract that corresponds to a child chain id. + * @param id Child chain id. + * @return manager Child chain manager contract address. + */ + function _managerOf(uint256 id) internal view returns (address manager) { + manager = _managers[id]; + require(manager != address(0), "StakeManagerChildData: INVALID_ID"); + } + + /** + * @notice Get the child chain id that corresponds to a child chain manager contract. + * @param manager Child chain manager contract address. + * @return id Child chain id. + */ + function _idFor(address manager) internal view returns (uint256 id) { + id = _ids[manager]; + require(id != 0, "StakeManagerChildData: INVALID_MANAGER"); + } + + // Storage gap + // slither-disable-next-line unused-state,naming-convention + uint256[50] private __gap; +} diff --git a/contracts/root/staking/StakeManagerStakingData.sol b/contracts/root/staking/StakeManagerStakingData.sol new file mode 100644 index 00000000..9d1b9042 --- /dev/null +++ b/contracts/root/staking/StakeManagerStakingData.sol @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.19; + +/** + * @title StakeManagerStakingData + * @notice Holds all staking related data. + * Note that this is contract is designed to be included in StakeManager. It is upgradeable. + */ +abstract contract StakeManagerStakingData { + // slither-disable-next-line naming-convention + uint256 internal _totalStake; + // validator => child => amount + mapping(address => mapping(uint256 => uint256)) private _stakes; + // child chain id => total stake + mapping(uint256 => uint256) private _totalStakePerChild; + // validator address => stake across all child chains. + mapping(address => uint256) private _totalStakes; + // validator address => withdrawable stake. + mapping(address => uint256) private _withdrawableStakes; + + function _addStake(address validator, uint256 id, uint256 amount) internal { + _stakes[validator][id] += amount; + _totalStakePerChild[id] += amount; + _totalStakes[validator] += amount; + _totalStake += amount; + } + + function _removeStake(address validator, uint256 id, uint256 amount) internal { + _stakes[validator][id] -= amount; + _totalStakePerChild[id] -= amount; + _totalStakes[validator] -= amount; + _totalStake -= amount; + _withdrawableStakes[validator] += amount; + } + + function _withdrawStake(address validator, uint256 amount) internal { + _withdrawableStakes[validator] -= amount; + } + + function _withdrawableStakeOf(address validator) internal view returns (uint256 amount) { + amount = _withdrawableStakes[validator]; + } + + function _totalStakeOfChild(uint256 id) internal view returns (uint256 amount) { + amount = _totalStakePerChild[id]; + } + + function _stakeOf(address validator, uint256 id) internal view returns (uint256 amount) { + amount = _stakes[validator][id]; + } + + function _totalStakeOf(address validator) internal view returns (uint256 amount) { + amount = _totalStakes[validator]; + } + + // Storage gap + // slither-disable-next-line unused-state,naming-convention + uint256[50] private __gap; +} diff --git a/docs/elin/contracts-upgradeable/governance/GovernorUpgradeable.md b/docs/elin/contracts-upgradeable/governance/GovernorUpgradeable.md index 348ae907..1db01533 100644 --- a/docs/elin/contracts-upgradeable/governance/GovernorUpgradeable.md +++ b/docs/elin/contracts-upgradeable/governance/GovernorUpgradeable.md @@ -574,7 +574,7 @@ function propose(address[] targets, uint256[] values, bytes[] calldatas, string -*See {IGovernor-propose}.* +*See {IGovernor-propose}. This function has opt-in frontrunning protection, described in {_isValidDescriptionForProposer}.* #### Parameters diff --git a/docs/elin/contracts-upgradeable/governance/extensions/GovernorTimelockControlUpgradeable.md b/docs/elin/contracts-upgradeable/governance/extensions/GovernorTimelockControlUpgradeable.md index b7df2a4a..45121f1a 100644 --- a/docs/elin/contracts-upgradeable/governance/extensions/GovernorTimelockControlUpgradeable.md +++ b/docs/elin/contracts-upgradeable/governance/extensions/GovernorTimelockControlUpgradeable.md @@ -596,7 +596,7 @@ function propose(address[] targets, uint256[] values, bytes[] calldatas, string -*See {IGovernor-propose}.* +*See {IGovernor-propose}. This function has opt-in frontrunning protection, described in {_isValidDescriptionForProposer}.* #### Parameters diff --git a/docs/elin/contracts-upgradeable/governance/extensions/GovernorVotesQuorumFractionUpgradeable.md b/docs/elin/contracts-upgradeable/governance/extensions/GovernorVotesQuorumFractionUpgradeable.md index f9f38ada..5f24b223 100644 --- a/docs/elin/contracts-upgradeable/governance/extensions/GovernorVotesQuorumFractionUpgradeable.md +++ b/docs/elin/contracts-upgradeable/governance/extensions/GovernorVotesQuorumFractionUpgradeable.md @@ -574,7 +574,7 @@ function propose(address[] targets, uint256[] values, bytes[] calldatas, string -*See {IGovernor-propose}.* +*See {IGovernor-propose}. This function has opt-in frontrunning protection, described in {_isValidDescriptionForProposer}.* #### Parameters diff --git a/docs/elin/contracts-upgradeable/governance/extensions/GovernorVotesUpgradeable.md b/docs/elin/contracts-upgradeable/governance/extensions/GovernorVotesUpgradeable.md index 0f54f4ac..b52e384f 100644 --- a/docs/elin/contracts-upgradeable/governance/extensions/GovernorVotesUpgradeable.md +++ b/docs/elin/contracts-upgradeable/governance/extensions/GovernorVotesUpgradeable.md @@ -574,7 +574,7 @@ function propose(address[] targets, uint256[] values, bytes[] calldatas, string -*See {IGovernor-propose}.* +*See {IGovernor-propose}. This function has opt-in frontrunning protection, described in {_isValidDescriptionForProposer}.* #### Parameters diff --git a/docs/lib/ChildManagerLib.md b/docs/lib/ChildManagerLib.md deleted file mode 100644 index 2c9b6934..00000000 --- a/docs/lib/ChildManagerLib.md +++ /dev/null @@ -1,12 +0,0 @@ -# ChildManagerLib - - - - - - - - - - - diff --git a/docs/lib/StakeManagerLib.md b/docs/lib/StakeManagerLib.md deleted file mode 100644 index 3e72d4c1..00000000 --- a/docs/lib/StakeManagerLib.md +++ /dev/null @@ -1,12 +0,0 @@ -# StakeManagerLib - - - - - - - - - - - diff --git a/docs/root/staking/StakeManager.md b/docs/root/staking/StakeManager.md index 9e697b8b..051fa9f6 100644 --- a/docs/root/staking/StakeManager.md +++ b/docs/root/staking/StakeManager.md @@ -35,7 +35,7 @@ returns the child id for a child chain manager contract ### initialize ```solidity -function initialize(address newMatic) external nonpayable +function initialize(address newStakingToken) external nonpayable ``` @@ -46,7 +46,7 @@ function initialize(address newMatic) external nonpayable | Name | Type | Description | |---|---|---| -| newMatic | address | undefined | +| newStakingToken | address | undefined | ### managerOf diff --git a/docs/root/staking/StakeManagerChildData.md b/docs/root/staking/StakeManagerChildData.md new file mode 100644 index 00000000..283b810e --- /dev/null +++ b/docs/root/staking/StakeManagerChildData.md @@ -0,0 +1,12 @@ +# StakeManagerChildData + + + +> StakeManagerChildData + +Holds data to allow look-up between child chain manager contract address and child chain id. Note that this is contract is designed to be included in StakeManager. It is upgradeable. + + + + + diff --git a/docs/root/staking/StakeManagerStakingData.md b/docs/root/staking/StakeManagerStakingData.md new file mode 100644 index 00000000..cbf2e4b3 --- /dev/null +++ b/docs/root/staking/StakeManagerStakingData.md @@ -0,0 +1,12 @@ +# StakeManagerStakingData + + + +> StakeManagerStakingData + +Holds all staking related data. Note that this is contract is designed to be included in StakeManager. It is upgradeable. + + + + + diff --git a/package-lock.json b/package-lock.json index d0998724..78d2c08c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@openzeppelin/contracts": "^4.9.2", "@openzeppelin/contracts-upgradeable": "^4.9.2", "@primitivefi/hardhat-dodoc": "^0.2.3", - "hardhat": "^2.15.0", + "hardhat": "^2.16.1", "keccak256": "^1.0.6", "mcl-wasm": "^1.1.0", "merkletreejs": "^0.3.10" @@ -2983,6 +2983,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, "dependencies": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -5561,7 +5562,8 @@ "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true }, "node_modules/function.prototype.name": { "version": "1.1.5", @@ -5617,6 +5619,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "dev": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -5882,9 +5885,9 @@ } }, "node_modules/hardhat": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.15.0.tgz", - "integrity": "sha512-cC9tM/N10YaES04zPOp7yR13iX3YibqaNmi0//Ep40Nt9ELIJx3kFpQmucur0PAIfXYpGnw5RuXHNLkxpnVHEw==", + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.16.1.tgz", + "integrity": "sha512-QpBjGXFhhSYoYBGEHyoau/A63crZOP+i3GbNxzLGkL6IklzT+piN14+wGnINNCg5BLSKisQI/RAySPzaWRcx/g==", "dependencies": { "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", @@ -5925,7 +5928,6 @@ "mnemonist": "^0.38.0", "mocha": "^10.0.0", "p-map": "^4.0.0", - "qs": "^6.7.0", "raw-body": "^2.4.1", "resolve": "1.17.0", "semver": "^6.3.0", @@ -6402,6 +6404,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, "dependencies": { "function-bind": "^1.1.1" }, @@ -6454,6 +6457,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -7991,6 +7995,7 @@ "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -8426,6 +8431,8 @@ "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dev": true, + "peer": true, "dependencies": { "side-channel": "^1.0.4" }, @@ -9150,6 +9157,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, "dependencies": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", @@ -13433,6 +13441,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, "requires": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -15446,7 +15455,8 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true }, "function.prototype.name": { "version": "1.1.5", @@ -15487,6 +15497,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "dev": true, "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -15681,9 +15692,9 @@ } }, "hardhat": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.15.0.tgz", - "integrity": "sha512-cC9tM/N10YaES04zPOp7yR13iX3YibqaNmi0//Ep40Nt9ELIJx3kFpQmucur0PAIfXYpGnw5RuXHNLkxpnVHEw==", + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.16.1.tgz", + "integrity": "sha512-QpBjGXFhhSYoYBGEHyoau/A63crZOP+i3GbNxzLGkL6IklzT+piN14+wGnINNCg5BLSKisQI/RAySPzaWRcx/g==", "requires": { "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", @@ -15724,7 +15735,6 @@ "mnemonist": "^0.38.0", "mocha": "^10.0.0", "p-map": "^4.0.0", - "qs": "^6.7.0", "raw-body": "^2.4.1", "resolve": "1.17.0", "semver": "^6.3.0", @@ -16161,6 +16171,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -16194,7 +16205,8 @@ "has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true }, "has-tostringtag": { "version": "1.0.0", @@ -17335,7 +17347,8 @@ "object-inspect": { "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==" + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "dev": true }, "object-keys": { "version": "1.1.1", @@ -17661,6 +17674,8 @@ "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dev": true, + "peer": true, "requires": { "side-channel": "^1.0.4" } @@ -18183,6 +18198,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, "requires": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", diff --git a/package.json b/package.json index 66b35f86..4808c9e4 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@openzeppelin/contracts": "^4.9.2", "@openzeppelin/contracts-upgradeable": "^4.9.2", "@primitivefi/hardhat-dodoc": "^0.2.3", - "hardhat": "^2.15.0", + "hardhat": "^2.16.1", "keccak256": "^1.0.6", "mcl-wasm": "^1.1.0", "merkletreejs": "^0.3.10" diff --git a/test/forge/root/staking/StakeManager.t.sol b/test/forge/root/staking/StakeManager.t.sol index 1c1dc051..e132ea06 100644 --- a/test/forge/root/staking/StakeManager.t.sol +++ b/test/forge/root/staking/StakeManager.t.sol @@ -132,7 +132,7 @@ contract StakeManager_StakeFor is Registered, StakeManager { contract StakeManager_ReleaseStake is Staked, StakeManager { function test_RevertNotSupernetManager() public { - vm.expectRevert("ChildManagerLib: INVALID_MANAGER"); + vm.expectRevert("StakeManagerChildData: INVALID_MANAGER"); stakeManager.releaseStakeOf(address(this), 1); } @@ -152,7 +152,7 @@ contract StakeManager_ReleaseStake is Staked, StakeManager { contract StakeManager_SlashStake is Staked, StakeManager { function test_RevertNotSupernetManager() public { - vm.expectRevert("ChildManagerLib: INVALID_MANAGER"); + vm.expectRevert("StakeManagerChildData: INVALID_MANAGER"); stakeManager.slashStakeOf(address(this), 1); }