Skip to content

Commit 77054e3

Browse files
committed
fix: prepared SortitionModule upgrade adding changeGovernor()
1 parent 5e207df commit 77054e3

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

contracts/deploy/upgrade-sortition-module.ts renamed to contracts/deploy/upgrade-sortition-module-v0.9.0.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const deployUpgradeSortitionModule: DeployFunction = async (hre: HardhatRuntimeE
1515
console.log("upgrading SortitionModuleNeo...");
1616
await deployUpgradable(deployments, "SortitionModuleNeo", {
1717
newImplementation: "SortitionModuleNeo",
18-
initializer: "initialize",
18+
initializer: "initialize3",
1919
from: deployer,
2020
// Warning: do not reinitialize everything, only the new variables
2121
args: [],

contracts/src/arbitration/SortitionModule.sol

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {SortitionModuleBase, KlerosCore, RNG} from "./SortitionModuleBase.sol";
1515
/// @title SortitionModule
1616
/// @dev A factory of trees that keeps track of staked values for sortition.
1717
contract SortitionModule is SortitionModuleBase {
18-
string public constant override version = "0.8.0";
18+
string public constant override version = "0.9.0";
1919

2020
// ************************************* //
2121
// * Constructor * //
@@ -44,6 +44,10 @@ contract SortitionModule is SortitionModuleBase {
4444
__SortitionModuleBase_initialize(_governor, _core, _minStakingTime, _maxDrawingTime, _rng, _rngLookahead);
4545
}
4646

47+
function initialize3() external reinitializer(3) {
48+
// NOP
49+
}
50+
4751
// ************************************* //
4852
// * Governance * //
4953
// ************************************* //

contracts/src/arbitration/SortitionModuleBase.sol

+6
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ abstract contract SortitionModuleBase is ISortitionModule, Initializable, UUPSPr
127127
// * Governance * //
128128
// ************************************* //
129129

130+
/// @dev Changes the governor of the contract.
131+
/// @param _governor The new governor.
132+
function changeGovernor(address _governor) external onlyByGovernor {
133+
governor = _governor;
134+
}
135+
130136
/// @dev Changes the `minStakingTime` storage variable.
131137
/// @param _minStakingTime The new value for the `minStakingTime` storage variable.
132138
function changeMinStakingTime(uint256 _minStakingTime) external onlyByGovernor {

contracts/src/arbitration/SortitionModuleNeo.sol

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {SortitionModuleBase, KlerosCore, RNG, StakingResult} from "./SortitionMo
1515
/// @title SortitionModuleNeo
1616
/// @dev A factory of trees that keeps track of staked values for sortition.
1717
contract SortitionModuleNeo is SortitionModuleBase {
18-
string public constant override version = "0.8.0";
18+
string public constant override version = "0.9.0";
1919

2020
// ************************************* //
2121
// * Storage * //
@@ -58,6 +58,10 @@ contract SortitionModuleNeo is SortitionModuleBase {
5858
maxTotalStaked = _maxTotalStaked;
5959
}
6060

61+
function initialize3() external reinitializer(3) {
62+
// NOP
63+
}
64+
6165
// ************************************* //
6266
// * Governance * //
6367
// ************************************* //

0 commit comments

Comments
 (0)