Skip to content
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
40 changes: 20 additions & 20 deletions src/MSAAdvanced.sol
Original file line number Diff line number Diff line change
Expand Up @@ -146,40 +146,40 @@ contract MSAAdvanced is IMSA, ExecutionHelper, ModuleManager, HookManager {
* @inheritdoc IERC7579Account
*/
function installModule(
uint256 moduleType,
uint256 moduleTypeId,
address module,
bytes calldata initData
)
external
payable
onlyEntryPointOrSelf
{
if (moduleType == MODULE_TYPE_VALIDATOR) _installValidator(module, initData);
else if (moduleType == MODULE_TYPE_EXECUTOR) _installExecutor(module, initData);
else if (moduleType == MODULE_TYPE_FALLBACK) _installFallbackHandler(module, initData);
else if (moduleType == MODULE_TYPE_HOOK) _installHook(module, initData);
else revert UnsupportedModuleType(moduleType);
emit ModuleInstalled(moduleType, module);
if (moduleTypeId == MODULE_TYPE_VALIDATOR) _installValidator(module, initData);
else if (moduleTypeId == MODULE_TYPE_EXECUTOR) _installExecutor(module, initData);
else if (moduleTypeId == MODULE_TYPE_FALLBACK) _installFallbackHandler(module, initData);
else if (moduleTypeId == MODULE_TYPE_HOOK) _installHook(module, initData);
else revert UnsupportedModuleType(moduleTypeId);
emit ModuleInstalled(moduleTypeId, module);
}

/**
* @inheritdoc IERC7579Account
*/
function uninstallModule(
uint256 moduleType,
uint256 moduleTypeId,
address module,
bytes calldata deInitData
)
external
payable
onlyEntryPointOrSelf
{
if (moduleType == MODULE_TYPE_VALIDATOR) _uninstallValidator(module, deInitData);
else if (moduleType == MODULE_TYPE_EXECUTOR) _uninstallExecutor(module, deInitData);
else if (moduleType == MODULE_TYPE_FALLBACK) _uninstallFallbackHandler(module, deInitData);
else if (moduleType == MODULE_TYPE_HOOK) _uninstallHook(module, deInitData);
else revert UnsupportedModuleType(moduleType);
emit ModuleUninstalled(moduleType, module);
if (moduleTypeId == MODULE_TYPE_VALIDATOR) _uninstallValidator(module, deInitData);
else if (moduleTypeId == MODULE_TYPE_EXECUTOR) _uninstallExecutor(module, deInitData);
else if (moduleTypeId == MODULE_TYPE_FALLBACK) _uninstallFallbackHandler(module, deInitData);
else if (moduleTypeId == MODULE_TYPE_HOOK) _uninstallHook(module, deInitData);
else revert UnsupportedModuleType(moduleTypeId);
emit ModuleUninstalled(moduleTypeId, module);
}

/**
Expand Down Expand Up @@ -240,7 +240,7 @@ contract MSAAdvanced is IMSA, ExecutionHelper, ModuleManager, HookManager {
* @inheritdoc IERC7579Account
*/
function isModuleInstalled(
uint256 moduleType,
uint256 moduleTypeId,
address module,
bytes calldata additionalContext
)
Expand All @@ -249,10 +249,10 @@ contract MSAAdvanced is IMSA, ExecutionHelper, ModuleManager, HookManager {
override
returns (bool)
{
if (moduleType == MODULE_TYPE_VALIDATOR) return _isValidatorInstalled(module);
else if (moduleType == MODULE_TYPE_EXECUTOR) return _isExecutorInstalled(module);
else if (moduleType == MODULE_TYPE_FALLBACK) return _isFallbackHandlerInstalled(module);
else if (moduleType == MODULE_TYPE_HOOK) return _isHookInstalled(module);
if (moduleTypeId == MODULE_TYPE_VALIDATOR) return _isValidatorInstalled(module);
else if (moduleTypeId == MODULE_TYPE_EXECUTOR) return _isExecutorInstalled(module);
else if (moduleTypeId == MODULE_TYPE_FALLBACK) return _isFallbackHandlerInstalled(module);
else if (moduleTypeId == MODULE_TYPE_HOOK) return _isHookInstalled(module);
else return false;
}

Expand All @@ -267,7 +267,7 @@ contract MSAAdvanced is IMSA, ExecutionHelper, ModuleManager, HookManager {
/**
* @inheritdoc IERC7579Account
*/
function supportsAccountMode(ModeCode mode)
function supportsExecutionMode(ModeCode mode)
external
view
virtual
Expand Down
34 changes: 17 additions & 17 deletions src/MSABasic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,38 +92,38 @@ contract MSABasic is IMSA, ExecutionHelper, ModuleManager {
* @inheritdoc IERC7579Account
*/
function installModule(
uint256 moduleType,
uint256 moduleTypeId,
address module,
bytes calldata initData
)
external
payable
onlyEntryPointOrSelf
{
if (moduleType == MODULE_TYPE_VALIDATOR) _installValidator(module, initData);
else if (moduleType == MODULE_TYPE_EXECUTOR) _installExecutor(module, initData);
else if (moduleType == MODULE_TYPE_FALLBACK) _installFallbackHandler(module, initData);
else revert UnsupportedModuleType(moduleType);
emit ModuleInstalled(moduleType, module);
if (moduleTypeId == MODULE_TYPE_VALIDATOR) _installValidator(module, initData);
else if (moduleTypeId == MODULE_TYPE_EXECUTOR) _installExecutor(module, initData);
else if (moduleTypeId == MODULE_TYPE_FALLBACK) _installFallbackHandler(module, initData);
else revert UnsupportedModuleType(moduleTypeId);
emit ModuleInstalled(moduleTypeId, module);
}

/**
* @inheritdoc IERC7579Account
*/
function uninstallModule(
uint256 moduleType,
uint256 moduleTypeId,
address module,
bytes calldata deInitData
)
external
payable
onlyEntryPointOrSelf
{
if (moduleType == MODULE_TYPE_VALIDATOR) _uninstallValidator(module, deInitData);
else if (moduleType == MODULE_TYPE_EXECUTOR) _uninstallExecutor(module, deInitData);
else if (moduleType == MODULE_TYPE_FALLBACK) _uninstallFallbackHandler(module, deInitData);
else revert UnsupportedModuleType(moduleType);
emit ModuleUninstalled(moduleType, module);
if (moduleTypeId == MODULE_TYPE_VALIDATOR) _uninstallValidator(module, deInitData);
else if (moduleTypeId == MODULE_TYPE_EXECUTOR) _uninstallExecutor(module, deInitData);
else if (moduleTypeId == MODULE_TYPE_FALLBACK) _uninstallFallbackHandler(module, deInitData);
else revert UnsupportedModuleType(moduleTypeId);
emit ModuleUninstalled(moduleTypeId, module);
}

/**
Expand Down Expand Up @@ -202,7 +202,7 @@ contract MSABasic is IMSA, ExecutionHelper, ModuleManager {
* stored in more complex mappings
*/
function isModuleInstalled(
uint256 moduleType,
uint256 moduleTypeId,
address module,
bytes calldata additionalContext
)
Expand All @@ -211,9 +211,9 @@ contract MSABasic is IMSA, ExecutionHelper, ModuleManager {
override
returns (bool isInstalled)
{
if (moduleType == MODULE_TYPE_VALIDATOR) return _isValidatorInstalled(module);
else if (moduleType == MODULE_TYPE_EXECUTOR) return _isExecutorInstalled(module);
else if (moduleType == MODULE_TYPE_FALLBACK) return _isFallbackHandlerInstalled(module);
if (moduleTypeId == MODULE_TYPE_VALIDATOR) return _isValidatorInstalled(module);
else if (moduleTypeId == MODULE_TYPE_EXECUTOR) return _isExecutorInstalled(module);
else if (moduleTypeId == MODULE_TYPE_FALLBACK) return _isFallbackHandlerInstalled(module);
else return false;
}

Expand All @@ -228,7 +228,7 @@ contract MSABasic is IMSA, ExecutionHelper, ModuleManager {
/**
* @inheritdoc IERC7579Account
*/
function supportsAccountMode(ModeCode mode) external view virtual override returns (bool) {
function supportsExecutionMode(ModeCode mode) external view virtual override returns (bool) {
CallType callType = mode.getCallType();
if (callType == CALLTYPE_BATCH) return true;
else if (callType == CALLTYPE_SINGLE) return true;
Expand Down
14 changes: 7 additions & 7 deletions src/interfaces/IERC7579Account.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ interface IERC7579Account {
/**
* @dev installs a Module of a certain type on the smart account
* @dev Implement Authorization control of your chosing
* @param moduleType the module type ID according the ERC-7579 spec
* @param moduleTypeId the module type ID according the ERC-7579 spec
* @param module the module address
* @param initData arbitrary data that may be required on the module during `onInstall`
* initialization.
*/
function installModule(
uint256 moduleType,
uint256 moduleTypeId,
address module,
bytes calldata initData
)
Expand All @@ -101,13 +101,13 @@ interface IERC7579Account {
/**
* @dev uninstalls a Module of a certain type on the smart account
* @dev Implement Authorization control of your chosing
* @param moduleType the module type ID according the ERC-7579 spec
* @param moduleTypeId the module type ID according the ERC-7579 spec
* @param module the module address
* @param deInitData arbitrary data that may be required on the module during `onUninstall`
* de-initialization.
*/
function uninstallModule(
uint256 moduleType,
uint256 moduleTypeId,
address module,
bytes calldata deInitData
)
Expand All @@ -118,7 +118,7 @@ interface IERC7579Account {
* Function to check if the account supports a certain CallType or ExecType (see ModeLib.sol)
* @param encodedMode the encoded mode
*/
function supportsAccountMode(ModeCode encodedMode) external view returns (bool);
function supportsExecutionMode(ModeCode encodedMode) external view returns (bool);

/**
* Function to check if the account supports installation of a certain module type Id
Expand All @@ -128,7 +128,7 @@ interface IERC7579Account {

/**
* Function to check if the account has a certain module installed
* @param moduleType the module type ID according the ERC-7579 spec
* @param moduleTypeId the module type ID according the ERC-7579 spec
* Note: keep in mind that some contracts can be multiple module types at the same time. It
* thus may be necessary to query multiple module types
* @param module the module address
Expand All @@ -138,7 +138,7 @@ interface IERC7579Account {
* are stored in mappings, this param might be needed
*/
function isModuleInstalled(
uint256 moduleType,
uint256 moduleTypeId,
address module,
bytes calldata additionalContext
)
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/IERC7579Module.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ interface IModule {

/**
* @dev Returns boolean value if module is a certain type
* @param typeID the module type ID according the ERC-7579 spec
* @param moduleTypeId the module type ID according the ERC-7579 spec
*
* MUST return true if the module is of the given type and false otherwise
*/
function isModuleType(uint256 typeID) external view returns (bool);
function isModuleType(uint256 moduleTypeId) external view returns (bool);

/**
* @dev Returns if the module was already initialized for a provided smartaccount
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IMSA.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CallType, ExecType, ModeCode } from "../lib/ModeLib.sol";

interface IMSA is IERC7579Account {
// Error thrown when an unsupported ModuleType is requested
error UnsupportedModuleType(uint256 moduleType);
error UnsupportedModuleType(uint256 moduleTypeId);
// Error thrown when an execution with an unsupported CallType was made
error UnsupportedCallType(CallType callType);
// Error thrown when an execution with an unsupported ExecType was made
Expand Down
4 changes: 2 additions & 2 deletions src/modules/SimpleExecutionValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ contract SimpleExecutionValidator is IValidator {
return _initialized[smartAccount];
}

function isModuleType(uint256 typeID) external view override returns (bool) {
return typeID == MODULE_TYPE_VALIDATOR;
function isModuleType(uint256 moduleTypeId) external view override returns (bool) {
return moduleTypeId == MODULE_TYPE_VALIDATOR;
}

function validateUserOp(
Expand Down
4 changes: 2 additions & 2 deletions test/mocks/MockExecutor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ contract MockExecutor is IExecutor {
);
}

function isModuleType(uint256 typeID) external view returns (bool) {
return typeID == MODULE_TYPE_EXECUTOR;
function isModuleType(uint256 moduleTypeId) external view returns (bool) {
return moduleTypeId == MODULE_TYPE_EXECUTOR;
}

function isInitialized(address smartAccount) external view returns (bool) {
Expand Down
4 changes: 2 additions & 2 deletions test/mocks/MockHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ contract MockHook is IHook {
{ }
function postCheck(bytes calldata hookData) external returns (bool success) { }

function isModuleType(uint256 typeID) external view returns (bool) {
return typeID == MODULE_TYPE_HOOK;
function isModuleType(uint256 moduleTypeId) external view returns (bool) {
return moduleTypeId == MODULE_TYPE_HOOK;
}

function isInitialized(address smartAccount) external view returns (bool) {
Expand Down
4 changes: 2 additions & 2 deletions test/mocks/MockValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ contract MockValidator is IValidator {
returns (bytes4)
{ }

function isModuleType(uint256 typeID) external view returns (bool) {
return typeID == MODULE_TYPE_VALIDATOR;
function isModuleType(uint256 moduleTypeId) external view returns (bool) {
return moduleTypeId == MODULE_TYPE_VALIDATOR;
}

function isInitialized(address smartAccount) external view returns (bool) {
Expand Down