From 22add8a5cf6f9ceab5c0d382f2ad8e351dd45b13 Mon Sep 17 00:00:00 2001 From: alrxy Date: Thu, 21 Nov 2024 16:18:34 +0700 Subject: [PATCH] feat: add enabled constant var getter for extensions --- src/middleware/extensions/SharedVaults.sol | 2 ++ src/middleware/extensions/Subnetworks.sol | 2 ++ src/middleware/extensions/access-managers/NoAccessManager.sol | 2 ++ .../extensions/access-managers/OwnableAccessManager.sol | 2 ++ src/middleware/extensions/access-managers/OzAccessManaged.sol | 2 ++ src/middleware/extensions/capture-timestamps/EpochCapture.sol | 2 ++ .../extensions/capture-timestamps/TimestampCapture.sol | 2 ++ .../extensions/operators/ForcePauseSelfRegisterOperators.sol | 2 ++ src/middleware/extensions/operators/Operators.sol | 2 ++ src/middleware/extensions/operators/SelfRegisterOperators.sol | 2 ++ src/middleware/extensions/sigs/ECDSASig.sol | 2 ++ src/middleware/extensions/sigs/Ed25519Sig.sol | 2 ++ 12 files changed, 24 insertions(+) diff --git a/src/middleware/extensions/SharedVaults.sol b/src/middleware/extensions/SharedVaults.sol index 7f7bdb4..1348604 100644 --- a/src/middleware/extensions/SharedVaults.sol +++ b/src/middleware/extensions/SharedVaults.sol @@ -9,6 +9,8 @@ import {BaseMiddleware} from "../BaseMiddleware.sol"; * @dev Extends BaseMiddleware to provide access control for vault management functions */ abstract contract SharedVaults is BaseMiddleware { + bool public constant SharedVaultsEnabled = true; + /** * @notice Registers a new shared vault * @param sharedVault The address of the vault to register diff --git a/src/middleware/extensions/Subnetworks.sol b/src/middleware/extensions/Subnetworks.sol index ecda886..e4367c0 100644 --- a/src/middleware/extensions/Subnetworks.sol +++ b/src/middleware/extensions/Subnetworks.sol @@ -11,6 +11,8 @@ import {BaseMiddleware} from "../BaseMiddleware.sol"; * @dev Extends BaseMiddleware to provide access control for subnetwork management functions */ abstract contract Subnetworks is BaseMiddleware { + bool public constant SubnetworksEnabled = true; + /** * @notice Registers a new subnetwork * @param subnetwork The ID of the subnetwork to register diff --git a/src/middleware/extensions/access-managers/NoAccessManager.sol b/src/middleware/extensions/access-managers/NoAccessManager.sol index 95cdda2..940d9b9 100644 --- a/src/middleware/extensions/access-managers/NoAccessManager.sol +++ b/src/middleware/extensions/access-managers/NoAccessManager.sol @@ -9,6 +9,8 @@ import {BaseMiddleware} from "../../BaseMiddleware.sol"; * @dev Implements BaseMiddleware and always reverts on access checks */ abstract contract NoAccessManager is BaseMiddleware { + bool public constant NoAccessManagerEnabled = true; + /** * @notice Error thrown when access is denied */ diff --git a/src/middleware/extensions/access-managers/OwnableAccessManager.sol b/src/middleware/extensions/access-managers/OwnableAccessManager.sol index 926046c..d0b86dd 100644 --- a/src/middleware/extensions/access-managers/OwnableAccessManager.sol +++ b/src/middleware/extensions/access-managers/OwnableAccessManager.sol @@ -9,6 +9,8 @@ import {BaseMiddleware} from "../../BaseMiddleware.sol"; * @dev Implements BaseMiddleware with owner-based access control */ abstract contract OwnableAccessManager is BaseMiddleware { + bool public constant OwnableAccessManagerEnabled = true; + /** * @notice Error thrown when a non-owner address attempts to call a restricted function * @param sender The address that attempted the call diff --git a/src/middleware/extensions/access-managers/OzAccessManaged.sol b/src/middleware/extensions/access-managers/OzAccessManaged.sol index e0849f9..7075228 100644 --- a/src/middleware/extensions/access-managers/OzAccessManaged.sol +++ b/src/middleware/extensions/access-managers/OzAccessManaged.sol @@ -11,11 +11,13 @@ import {BaseMiddleware} from "../../BaseMiddleware.sol"; * @dev Implements BaseMiddleware with OpenZeppelin's AccessManagedUpgradeable functionality */ abstract contract OzAccessManaged is BaseMiddleware, AccessManagedUpgradeable { + bool public constant OzAccessManagedEnabled = true; /** * @notice Initializes the contract with an authority address * @param authority The address to set as the access manager authority * @dev Can only be called during initialization */ + function __OzAccessManaged_init( address authority ) internal onlyInitializing { diff --git a/src/middleware/extensions/capture-timestamps/EpochCapture.sol b/src/middleware/extensions/capture-timestamps/EpochCapture.sol index da54b6d..9ec615b 100644 --- a/src/middleware/extensions/capture-timestamps/EpochCapture.sol +++ b/src/middleware/extensions/capture-timestamps/EpochCapture.sol @@ -5,6 +5,8 @@ import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; import {BaseMiddleware} from "../../BaseMiddleware.sol"; abstract contract EpochCapture is BaseMiddleware { + bool public constant EpochCaptureEnabled = true; + struct EpochCaptureStorage { uint48 startTimestamp; uint48 epochDuration; diff --git a/src/middleware/extensions/capture-timestamps/TimestampCapture.sol b/src/middleware/extensions/capture-timestamps/TimestampCapture.sol index e3a19d5..54d37f1 100644 --- a/src/middleware/extensions/capture-timestamps/TimestampCapture.sol +++ b/src/middleware/extensions/capture-timestamps/TimestampCapture.sol @@ -5,6 +5,8 @@ import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; import {BaseMiddleware} from "../../BaseMiddleware.sol"; abstract contract TimestampCapture is BaseMiddleware { + bool public constant TimestampCaptureEnabled = true; + /* * @notice Returns the current timestamp minus 1 second. * @return timestamp The current timestamp minus 1 second. diff --git a/src/middleware/extensions/operators/ForcePauseSelfRegisterOperators.sol b/src/middleware/extensions/operators/ForcePauseSelfRegisterOperators.sol index 91705ba..154ae8b 100644 --- a/src/middleware/extensions/operators/ForcePauseSelfRegisterOperators.sol +++ b/src/middleware/extensions/operators/ForcePauseSelfRegisterOperators.sol @@ -9,6 +9,8 @@ import {SelfRegisterOperators} from "./SelfRegisterOperators.sol"; * @dev Implements force pause functionality and prevents unpausing of force-paused operators */ abstract contract ForcePauseSelfRegisterOperators is SelfRegisterOperators { + bool public constant ForcePauseSelfRegisterOperatorsEnabled = true; + struct ForcePauseSelfRegisterOperatorsStorage { mapping(address => bool) forcePaused; mapping(address => mapping(address => bool)) forcePausedVault; diff --git a/src/middleware/extensions/operators/Operators.sol b/src/middleware/extensions/operators/Operators.sol index 94c682d..330ea59 100644 --- a/src/middleware/extensions/operators/Operators.sol +++ b/src/middleware/extensions/operators/Operators.sol @@ -9,6 +9,8 @@ import {BaseMiddleware} from "../../BaseMiddleware.sol"; * @dev Provides core operator management functionality with hooks for customization */ abstract contract Operators is BaseMiddleware { + bool public constant OperatorsEnabled = true; + /** * @notice Registers a new operator with an optional vault association * @param operator The address of the operator to register diff --git a/src/middleware/extensions/operators/SelfRegisterOperators.sol b/src/middleware/extensions/operators/SelfRegisterOperators.sol index 2f2b2b9..b6b24cf 100644 --- a/src/middleware/extensions/operators/SelfRegisterOperators.sol +++ b/src/middleware/extensions/operators/SelfRegisterOperators.sol @@ -12,6 +12,8 @@ import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/Signa * @dev Extends BaseMiddleware, BaseSig, and EIP712Upgradeable to provide signature-based operator management */ abstract contract SelfRegisterOperators is BaseMiddleware, BaseSig, EIP712Upgradeable { + bool public constant SelfRegisterOperatorsEnabled = true; + error InvalidSignature(); // EIP-712 TypeHash constants diff --git a/src/middleware/extensions/sigs/ECDSASig.sol b/src/middleware/extensions/sigs/ECDSASig.sol index 2b6746a..8629d7f 100644 --- a/src/middleware/extensions/sigs/ECDSASig.sol +++ b/src/middleware/extensions/sigs/ECDSASig.sol @@ -10,6 +10,8 @@ import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; * @dev Implements BaseSig interface using OpenZeppelin's ECDSA library */ abstract contract ECDSASig is BaseSig { + bool public constant ECDSASigEnabled = true; + using ECDSA for bytes32; /** diff --git a/src/middleware/extensions/sigs/Ed25519Sig.sol b/src/middleware/extensions/sigs/Ed25519Sig.sol index a9ec404..92cc498 100644 --- a/src/middleware/extensions/sigs/Ed25519Sig.sol +++ b/src/middleware/extensions/sigs/Ed25519Sig.sol @@ -10,6 +10,8 @@ import {BaseSig} from "./BaseSig.sol"; * @dev Implements BaseSig interface using Ed25519 signature verification */ abstract contract Ed25519Sig is BaseSig { + bool public constant Ed25519SigEnabled = true; + /** * @notice Verifies that a signature was created by the owner of a key * @param operator The address of the operator that owns the key