From 9cd8ff0b5856b30eea43852f48d5583b3d3d0fe8 Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 12 Mar 2024 17:17:25 +0800 Subject: [PATCH 1/2] add private --- src/user/Application.sol | 8 ++++---- src/user/UpgradeableApplication.sol | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/user/Application.sol b/src/user/Application.sol index 1d2ec7e..fd70a3e 100644 --- a/src/user/Application.sol +++ b/src/user/Application.sol @@ -21,14 +21,14 @@ import "../interfaces/IORMP.sol"; import "./AppBase.sol"; abstract contract Application is AppBase { - address public immutable ORMP; + address private immutable _ORMP; constructor(address ormp) { - ORMP = ormp; + _ORMP = ormp; } function ormpSender() public view virtual override returns (address) { - return ORMP; + return _ORMP; } function ormpRecver() public view virtual override returns (address) { @@ -36,6 +36,6 @@ abstract contract Application is AppBase { } function _setAppConfig(address oracle, address relayer) internal virtual { - IORMP(ORMP).setAppConfig(oracle, relayer); + IORMP(_ORMP).setAppConfig(oracle, relayer); } } diff --git a/src/user/UpgradeableApplication.sol b/src/user/UpgradeableApplication.sol index d8f1598..33f06f8 100644 --- a/src/user/UpgradeableApplication.sol +++ b/src/user/UpgradeableApplication.sol @@ -21,40 +21,40 @@ import "../interfaces/IORMP.sol"; import "./AppBase.sol"; abstract contract UpgradeableApplication is AppBase { - address public sender; - address public recver; + address private sender; + address private recver; event SetSender(address ormp); event SetRecver(address ormp); constructor(address ormp) { - sender = ormp; - recver = ormp; + _sender = ormp; + _recver = ormp; } function ormpSender() public view virtual override returns (address) { - return sender; + return _sender; } function ormpRecver() public view virtual override returns (address) { - return recver; + return _recver; } function _setSender(address ormp) internal virtual { - sender = ormp; + _sender = ormp; emit SetSender(ormp); } function _setRecver(address ormp) internal virtual { - recver = ormp; + _recver = ormp; emit SetRecver(ormp); } function _setSenderConfig(address oracle, address relayer) internal virtual { - IORMP(sender).setAppConfig(oracle, relayer); + IORMP(ormpSender()).setAppConfig(oracle, relayer); } function _setRecverConfig(address oracle, address relayer) internal virtual { - IORMP(recver).setAppConfig(oracle, relayer); + IORMP(ormpRecver()).setAppConfig(oracle, relayer); } } From f2453b4aebeb936dd02218a51d160e965bd7b630 Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 12 Mar 2024 17:20:09 +0800 Subject: [PATCH 2/2] add private --- src/user/Application.sol | 2 +- src/user/UpgradeableApplication.sol | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/user/Application.sol b/src/user/Application.sol index fd70a3e..101a191 100644 --- a/src/user/Application.sol +++ b/src/user/Application.sol @@ -32,7 +32,7 @@ abstract contract Application is AppBase { } function ormpRecver() public view virtual override returns (address) { - return ORMP; + return _ORMP; } function _setAppConfig(address oracle, address relayer) internal virtual { diff --git a/src/user/UpgradeableApplication.sol b/src/user/UpgradeableApplication.sol index 33f06f8..995ebce 100644 --- a/src/user/UpgradeableApplication.sol +++ b/src/user/UpgradeableApplication.sol @@ -21,8 +21,8 @@ import "../interfaces/IORMP.sol"; import "./AppBase.sol"; abstract contract UpgradeableApplication is AppBase { - address private sender; - address private recver; + address private _sender; + address private _recver; event SetSender(address ormp); event SetRecver(address ormp);