From 8932de802170b0a512c330a1abe7de810c59aef2 Mon Sep 17 00:00:00 2001 From: cristovaoth Date: Tue, 3 Oct 2023 08:04:10 +0200 Subject: [PATCH] Several renames --- contracts/core/{MiniAvatar.sol => BaseModifier.sol} | 6 +++++- contracts/core/GuardableModifier.sol | 8 ++++++++ .../core/{ModuleGuardable.sol => GuardableModule.sol} | 2 +- contracts/core/Modifier.sol | 8 ++------ contracts/test/TestGuard.sol | 4 ++-- contracts/test/TestModule.sol | 4 ++-- 6 files changed, 20 insertions(+), 12 deletions(-) rename contracts/core/{MiniAvatar.sol => BaseModifier.sol} (98%) create mode 100644 contracts/core/GuardableModifier.sol rename contracts/core/{ModuleGuardable.sol => GuardableModule.sol} (98%) diff --git a/contracts/core/MiniAvatar.sol b/contracts/core/BaseModifier.sol similarity index 98% rename from contracts/core/MiniAvatar.sol rename to contracts/core/BaseModifier.sol index 9293cfea..cea88dde 100644 --- a/contracts/core/MiniAvatar.sol +++ b/contracts/core/BaseModifier.sol @@ -6,7 +6,11 @@ import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "../interfaces/IAvatar.sol"; import "../signature/SignatureChecker.sol"; -abstract contract MiniAvatar is SignatureChecker, OwnableUpgradeable, IAvatar { +abstract contract BaseModifier is + SignatureChecker, + OwnableUpgradeable, + IAvatar +{ address internal constant SENTINEL_MODULES = address(0x1); /// Mapping of modules. mapping(address => address) internal modules; diff --git a/contracts/core/GuardableModifier.sol b/contracts/core/GuardableModifier.sol new file mode 100644 index 00000000..278c747c --- /dev/null +++ b/contracts/core/GuardableModifier.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: LGPL-3.0-only + +pragma solidity >=0.7.0 <0.9.0; + +import "./BaseModifier.sol"; +import "./GuardableModule.sol"; + +abstract contract GuardableModifier is GuardableModule, BaseModifier {} diff --git a/contracts/core/ModuleGuardable.sol b/contracts/core/GuardableModule.sol similarity index 98% rename from contracts/core/ModuleGuardable.sol rename to contracts/core/GuardableModule.sol index 48a1d9ea..79464618 100644 --- a/contracts/core/ModuleGuardable.sol +++ b/contracts/core/GuardableModule.sol @@ -6,7 +6,7 @@ pragma solidity >=0.7.0 <0.9.0; import "../guard/Guardable.sol"; import "./Module.sol"; -abstract contract ModuleGuardable is Module, Guardable { +abstract contract GuardableModule is Module, Guardable { /// @dev Passes a transaction to be executed by the avatar. /// @notice Can only be called by this contract. /// @param to Destination address of module transaction. diff --git a/contracts/core/Modifier.sol b/contracts/core/Modifier.sol index d7d2e3aa..c6400479 100644 --- a/contracts/core/Modifier.sol +++ b/contracts/core/Modifier.sol @@ -1,14 +1,10 @@ // SPDX-License-Identifier: LGPL-3.0-only - pragma solidity >=0.7.0 <0.9.0; -import "./MiniAvatar.sol"; import "./Module.sol"; -import "./ModuleGuardable.sol"; +import "./BaseModifier.sol"; /// @title Modifier Interface - A contract that sits between a Module and an Avatar and enforces some additional logic. -abstract contract Modifier is Module, MiniAvatar { +abstract contract Modifier is Module, BaseModifier { } - -abstract contract ModifierGuardable is ModuleGuardable, MiniAvatar {} diff --git a/contracts/test/TestGuard.sol b/contracts/test/TestGuard.sol index a50e1fe4..8dc75d70 100644 --- a/contracts/test/TestGuard.sol +++ b/contracts/test/TestGuard.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; -import "../core/ModuleGuardable.sol"; +import "../core/GuardableModule.sol"; contract TestGuard is FactoryFriendly, BaseGuard { event PreChecked(bool checked); @@ -40,7 +40,7 @@ contract TestGuard is FactoryFriendly, BaseGuard { function checkAfterExecution(bytes32, bool) public override { require( - ModuleGuardable(module).guard() == address(this), + GuardableModule(module).guard() == address(this), "Module cannot remove its own guard." ); emit PostChecked(true); diff --git a/contracts/test/TestModule.sol b/contracts/test/TestModule.sol index 36fa06db..6df4e5ea 100644 --- a/contracts/test/TestModule.sol +++ b/contracts/test/TestModule.sol @@ -3,9 +3,9 @@ /// @title Modifier Interface - A contract that sits between a Module and an Avatar and enforce some additional logic. pragma solidity >=0.7.0 <0.9.0; -import "../core/ModuleGuardable.sol"; +import "../core/GuardableModule.sol"; -contract TestModule is ModuleGuardable { +contract TestModule is GuardableModule { constructor(address _avatar, address _target) { bytes memory initParams = abi.encode(_avatar, _target); setUp(initParams);