Skip to content

Commit b4d925a

Browse files
committed
feat: versioning of upgradable contracts implementation
1 parent 3463bb2 commit b4d925a

21 files changed

+40
-8
lines changed

contracts/deploy/upgrade-dispute-kit.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const deployUpgradeDisputeKit: DeployFunction = async (hre: HardhatRuntimeEnviro
1414
try {
1515
console.log("upgrading DisputeKitClassicNeo...");
1616
await deployUpgradable(deployments, "DisputeKitClassicNeo", {
17-
newImplementation: "DisputeKitGated",
17+
contract: "DisputeKitClassic",
1818
initializer: "initialize",
1919
from: deployer,
2020
// Warning: do not reinitialize everything, only the new variables

contracts/src/arbitration/DisputeTemplateRegistry.sol

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import "./interfaces/IDisputeTemplateRegistry.sol";
88
/// @title Dispute Template Registry
99
/// @dev A contract to maintain a registry of dispute templates.
1010
contract DisputeTemplateRegistry is IDisputeTemplateRegistry, UUPSProxiable, Initializable {
11+
string public constant override version = "0.8.0";
12+
1113
// ************************************* //
1214
// * Storage * //
1315
// ************************************* //

contracts/src/arbitration/KlerosCore.sol

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import {KlerosCoreBase, IDisputeKit, ISortitionModule, IERC20} from "./KlerosCor
1414
/// Core arbitrator contract for Kleros v2.
1515
/// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.
1616
contract KlerosCore is KlerosCoreBase {
17+
string public constant override version = "0.8.0";
18+
1719
// ************************************* //
1820
// * Constructor * //
1921
// ************************************* //

contracts/src/arbitration/KlerosCoreNeo.sol

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
1515
/// Core arbitrator contract for Kleros v2.
1616
/// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.
1717
contract KlerosCoreNeo is KlerosCoreBase {
18+
string public constant override version = "0.8.0";
19+
1820
// ************************************* //
1921
// * Storage * //
2022
// ************************************* //

contracts/src/arbitration/PolicyRegistry.sol

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import "../proxy/Initializable.sol";
77
/// @title PolicyRegistry
88
/// @dev A contract to maintain a policy for each court.
99
contract PolicyRegistry is UUPSProxiable, Initializable {
10+
string public constant override version = "0.8.0";
11+
1012
// ************************************* //
1113
// * Events * //
1214
// ************************************* //

contracts/src/arbitration/SortitionModule.sol

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ 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";
19+
1820
// ************************************* //
1921
// * Constructor * //
2022
// ************************************* //

contracts/src/arbitration/SortitionModuleNeo.sol

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ 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";
19+
1820
// ************************************* //
1921
// * Storage * //
2022
// ************************************* //

contracts/src/arbitration/devtools/KlerosCoreRuler.sol

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import "../../libraries/Constants.sol";
1313
contract KlerosCoreRuler is IArbitratorV2, UUPSProxiable, Initializable {
1414
using SafeERC20 for IERC20;
1515

16+
string public constant override version = "0.8.0";
17+
1618
// ************************************* //
1719
// * Enums / Structs * //
1820
// ************************************* //

contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import {DisputeKitClassicBase, KlerosCore} from "./DisputeKitClassicBase.sol";
1717
/// - an incentive system: equal split between coherent votes,
1818
/// - an appeal system: fund 2 choices only, vote on any choice.
1919
contract DisputeKitClassic is DisputeKitClassicBase {
20+
string public constant override version = "0.8.0";
21+
2022
// ************************************* //
2123
// * Constructor * //
2224
// ************************************* //

contracts/src/arbitration/dispute-kits/DisputeKitGated.sol

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ interface IERC1155 {
3232
/// - an incentive system: equal split between coherent votes,
3333
/// - an appeal system: fund 2 choices only, vote on any choice.
3434
contract DisputeKitGated is DisputeKitClassicBase {
35+
string public constant override version = "0.8.0";
36+
3537
// ************************************* //
3638
// * Storage * //
3739
// ************************************* //

contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ interface IProofOfHumanity {
2424
/// - an incentive system: equal split between coherent votes,
2525
/// - an appeal system: fund 2 choices only, vote on any choice.
2626
contract DisputeKitSybilResistant is DisputeKitClassicBase {
27+
string public constant override version = "0.8.0";
28+
2729
// ************************************* //
2830
// * Storage * //
2931
// ************************************* //

contracts/src/arbitration/evidence/EvidenceModule.sol

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import "../../proxy/Initializable.sol";
1616

1717
/// @title Evidence Module
1818
contract EvidenceModule is IEvidence, Initializable, UUPSProxiable {
19+
string public constant override version = "0.8.0";
20+
1921
// ************************************* //
2022
// * Storage * //
2123
// ************************************* //

contracts/src/arbitration/university/KlerosCoreUniversity.sol

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import {Initializable} from "../../proxy/Initializable.sol";
1515
contract KlerosCoreUniversity is IArbitratorV2, UUPSProxiable, Initializable {
1616
using SafeERC20 for IERC20;
1717

18+
string public constant override version = "0.8.0";
19+
1820
// ************************************* //
1921
// * Enums / Structs * //
2022
// ************************************* //

contracts/src/arbitration/university/SortitionModuleUniversity.sol

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import "../../libraries/Constants.sol";
2020
/// @title SortitionModuleUniversity
2121
/// @dev An adapted version of the SortitionModule contract for educational purposes.
2222
contract SortitionModuleUniversity is ISortitionModuleUniversity, UUPSProxiable, Initializable {
23+
string public constant override version = "0.8.0";
24+
2325
// ************************************* //
2426
// * Enums / Structs * //
2527
// ************************************* //

contracts/src/gateway/ForeignGateway.sol

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import "../libraries/Constants.sol";
1616
/// Foreign Gateway
1717
/// Counterpart of `HomeGateway`
1818
contract ForeignGateway is IForeignGateway, UUPSProxiable, Initializable {
19+
string public constant override version = "0.8.0";
20+
1921
// ************************************* //
2022
// * Enums / Structs * //
2123
// ************************************* //

contracts/src/gateway/HomeGateway.sol

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import "../proxy/Initializable.sol";
2020
contract HomeGateway is IHomeGateway, UUPSProxiable, Initializable {
2121
using SafeERC20 for IERC20;
2222

23+
string public constant override version = "0.8.0";
24+
2325
// ************************************* //
2426
// * Enums / Structs * //
2527
// ************************************* //

contracts/src/proxy/UUPSProxiable.sol

+6
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ abstract contract UUPSProxiable {
148148
return IMPLEMENTATION_SLOT;
149149
}
150150

151+
/**
152+
* @notice Returns the version of the contract.
153+
* @return Version string.
154+
*/
155+
function version() external view virtual returns (string memory);
156+
151157
// ************************************* //
152158
// * Internal Views * //
153159
// ************************************* //

contracts/src/proxy/mock/UUPSUpgradeableMocks.sol

-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ contract NonUpgradeableMock {
1616
function increment() external {
1717
_counter++;
1818
}
19-
20-
function version() external pure virtual returns (string memory) {
21-
return "NonUpgradeableMock 0.0.0";
22-
}
2319
}
2420

2521
contract UUPSUpgradeableMock is UUPSProxiable, NonUpgradeableMock {

contracts/src/proxy/mock/by-inheritance/UpgradedByInheritance.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ contract UpgradedByInheritanceV1 is UUPSProxiable, Initializable {
3333
++counter;
3434
}
3535

36-
function version() external pure virtual returns (string memory) {
36+
function version() external pure virtual override returns (string memory) {
3737
return "V1";
3838
}
3939
}

contracts/src/proxy/mock/by-rewrite/UpgradedByRewrite.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ contract UpgradedByRewrite is UUPSProxiable, Initializable {
3636
++counter;
3737
}
3838

39-
function version() external pure virtual returns (string memory) {
39+
function version() external pure virtual override returns (string memory) {
4040
return "V1";
4141
}
4242
}

contracts/src/proxy/mock/by-rewrite/UpgradedByRewriteV2.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ contract UpgradedByRewrite is UUPSProxiable, Initializable {
3636
++counter;
3737
}
3838

39-
function version() external pure virtual returns (string memory) {
39+
function version() external pure virtual override returns (string memory) {
4040
return "V2";
4141
}
4242
}

0 commit comments

Comments
 (0)