From e0aeb254ea24a1a9d79368e1cbebe9f3de5d98a8 Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 13 Mar 2024 12:23:38 +0800 Subject: [PATCH] Simply Application (#139) * simply * simply --- src/user/AppBase.sol | 6 ++++++ src/user/Application.sol | 5 ----- src/user/UpgradeableApplication.sol | 5 ----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/user/AppBase.sol b/src/user/AppBase.sol index a102a23..956d673 100644 --- a/src/user/AppBase.sol +++ b/src/user/AppBase.sol @@ -17,10 +17,16 @@ pragma solidity ^0.8.17; +import "../interfaces/IORMP.sol"; + // https://eips.ethereum.org/EIPS/eip-5164 abstract contract AppBase { function protocol() public view virtual returns (address); + function _setAppConfig(address oracle, address relayer) internal virtual { + IORMP(protocol()).setAppConfig(oracle, relayer); + } + modifier onlyORMP() { require(protocol() == msg.sender, "!ormp-recver"); _; diff --git a/src/user/Application.sol b/src/user/Application.sol index 458e470..f981bfe 100644 --- a/src/user/Application.sol +++ b/src/user/Application.sol @@ -17,7 +17,6 @@ pragma solidity ^0.8.17; -import "../interfaces/IORMP.sol"; import "./AppBase.sol"; abstract contract Application is AppBase { @@ -30,8 +29,4 @@ abstract contract Application is AppBase { function protocol() public view virtual override returns (address) { return _ORMP; } - - function _setAppConfig(address oracle, address relayer) internal virtual { - IORMP(protocol()).setAppConfig(oracle, relayer); - } } diff --git a/src/user/UpgradeableApplication.sol b/src/user/UpgradeableApplication.sol index 1f0bc47..886f2c3 100644 --- a/src/user/UpgradeableApplication.sol +++ b/src/user/UpgradeableApplication.sol @@ -17,7 +17,6 @@ pragma solidity ^0.8.17; -import "../interfaces/IORMP.sol"; import "./AppBase.sol"; abstract contract UpgradeableApplication is AppBase { @@ -37,8 +36,4 @@ abstract contract UpgradeableApplication is AppBase { _ormp = ormp; emit SetORMP(ormp); } - - function _setAppConfig(address oracle, address relayer) internal virtual { - IORMP(protocol()).setAppConfig(oracle, relayer); - } }