From 27a351a982cb9fed3206305f40d52402837dc4e9 Mon Sep 17 00:00:00 2001 From: Ruslan Kasheparov Date: Fri, 5 Apr 2024 08:38:22 +0200 Subject: [PATCH] Set CoreProperties upgradeable --- contracts/L1/CorePropertiesL1.sol | 14 ++++++++++---- contracts/L2/CorePropertiesL2.sol | 20 ++++++++++++++++++-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/contracts/L1/CorePropertiesL1.sol b/contracts/L1/CorePropertiesL1.sol index f6a0852..5aab225 100644 --- a/contracts/L1/CorePropertiesL1.sol +++ b/contracts/L1/CorePropertiesL1.sol @@ -1,9 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; -import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; +import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; -contract CorePropertiesL1 is Ownable { +contract CorePropertiesL1 is UUPSUpgradeable, OwnableUpgradeable { address public arbitrumGateway; address public treasuryAddress; @@ -12,12 +13,15 @@ contract CorePropertiesL1 is Ownable { mapping(address => uint256) private _fees; - constructor( + function __CorePropertiesL1_init( address arbitrumGateway_, address treasuryAddress_, address lZEnpointAddress_, uint256 destinationChainId_ - ) { + ) external initializer { + __Ownable_init(); + __UUPSUpgradeable_init(); + arbitrumGateway = arbitrumGateway_; treasuryAddress = treasuryAddress_; lZEnpointAddress = lZEnpointAddress_; @@ -49,4 +53,6 @@ contract CorePropertiesL1 is Ownable { function getDeployParams() external view returns (address, address) { return (arbitrumGateway, lZEnpointAddress); } + + function _authorizeUpgrade(address) internal override onlyOwner {} } diff --git a/contracts/L2/CorePropertiesL2.sol b/contracts/L2/CorePropertiesL2.sol index 41d3133..963adb1 100644 --- a/contracts/L2/CorePropertiesL2.sol +++ b/contracts/L2/CorePropertiesL2.sol @@ -1,13 +1,27 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; -import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; +import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; -contract CorePropertiesL2 is Ownable { +contract CorePropertiesL2 is UUPSUpgradeable, OwnableUpgradeable { address public lZEnpointAddress; address public lZGatewayAddress; uint16 public l1ChainId; + function __CorePropertiesL2_init( + address lZEnpointAddress_, + address lZGatewayAddress_, + uint16 l1ChainId_ + ) external initializer { + __Ownable_init(); + __UUPSUpgradeable_init(); + + lZEnpointAddress = lZEnpointAddress_; + lZGatewayAddress = lZGatewayAddress_; + l1ChainId = l1ChainId_; + } + function setDeployParams( address lZEnpointAddress_, address lZGatewayAddress_, @@ -21,4 +35,6 @@ contract CorePropertiesL2 is Ownable { function getDeployParams() external view returns (address, address, uint16) { return (lZEnpointAddress, lZGatewayAddress, l1ChainId); } + + function _authorizeUpgrade(address) internal override onlyOwner {} }