Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(module-bases): add erc7579 constants #168

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/module-bases/ERC7579ModuleBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@
pragma solidity >=0.8.0 <0.9.0;

import { IModule as IERC7579Module } from "../accounts/common/interfaces/IERC7579Module.sol";
import {
MODULE_TYPE_VALIDATOR,
MODULE_TYPE_EXECUTOR,
MODULE_TYPE_FALLBACK,
MODULE_TYPE_HOOK,
MODULE_TYPE_POLICY,
MODULE_TYPE_SIGNER,
MODULE_TYPE_STATELESS_VALIDATOR
} from "./utils/ERC7579Constants.sol";

abstract contract ERC7579ModuleBase is IERC7579Module {
uint256 internal constant TYPE_VALIDATOR = 1;
uint256 internal constant TYPE_EXECUTOR = 2;
uint256 internal constant TYPE_FALLBACK = 3;
uint256 internal constant TYPE_HOOK = 4;
uint256 internal constant TYPE_POLICY = 7;
uint256 internal constant TYPE_VALIDATOR = MODULE_TYPE_VALIDATOR;
uint256 internal constant TYPE_EXECUTOR = MODULE_TYPE_EXECUTOR;
uint256 internal constant TYPE_FALLBACK = MODULE_TYPE_FALLBACK;
uint256 internal constant TYPE_HOOK = MODULE_TYPE_HOOK;
uint256 internal constant TYPE_POLICY = MODULE_TYPE_POLICY;
uint256 internal constant TYPE_SIGNER = MODULE_TYPE_SIGNER;
uint256 internal constant TYPE_STATELESS_VALIDATOR = MODULE_TYPE_STATELESS_VALIDATOR;
}
2 changes: 1 addition & 1 deletion src/module-bases/mocks/MockHybridValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ contract MockHybridValidator is ERC7579HybridValidatorBase {
}

function isModuleType(uint256 typeID) external pure override returns (bool) {
return typeID == TYPE_VALIDATOR || typeID == 7;
return typeID == TYPE_VALIDATOR || typeID == TYPE_STATELESS_VALIDATOR;
}

function isInitialized(
Expand Down
2 changes: 1 addition & 1 deletion src/module-bases/mocks/MockValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ contract MockValidator is ERC7579ValidatorBase {
}

function isModuleType(uint256 typeID) external pure override returns (bool) {
return typeID == TYPE_VALIDATOR || typeID == 7;
return typeID == TYPE_VALIDATOR;
}

function isInitialized(
Expand Down
10 changes: 10 additions & 0 deletions src/module-bases/utils/ERC7579Constants.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0 <0.9.0;

uint256 constant MODULE_TYPE_VALIDATOR = 1;
uint256 constant MODULE_TYPE_EXECUTOR = 2;
uint256 constant MODULE_TYPE_FALLBACK = 3;
uint256 constant MODULE_TYPE_HOOK = 4;
uint256 constant MODULE_TYPE_POLICY = 5;
uint256 constant MODULE_TYPE_SIGNER = 6;
uint256 constant MODULE_TYPE_STATELESS_VALIDATOR = 7;
Loading