Skip to content

Commit

Permalink
feat: update accountId and moduleId to use period delimiters
Browse files Browse the repository at this point in the history
  • Loading branch information
jaypaik committed Aug 26, 2024
1 parent b5b8264 commit f9660c7
Show file tree
Hide file tree
Showing 18 changed files with 732 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/account/ReferenceModularAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ contract ReferenceModularAccount is

/// @inheritdoc IModularAccount
function accountId() external pure virtual returns (string memory) {
return "erc6900/reference-modular-account/0.8.0";
return "erc6900.reference-modular-account.0.8.0";
}

/// @inheritdoc UUPSUpgradeable
Expand Down
2 changes: 1 addition & 1 deletion src/account/SemiModularAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ contract SemiModularAccount is ReferenceModularAccount {

/// @inheritdoc IModularAccount
function accountId() external pure override returns (string memory) {
return "erc6900/reference-semi-modular-account/0.8.0";
return "erc6900.reference-semi-modular-account.0.8.0";
}

function replaySafeHash(bytes32 hash) public view virtual returns (bytes32) {
Expand Down
711 changes: 711 additions & 0 deletions src/account/UpgradeableModularAccount.sol

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/interfaces/IModularAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ interface IModularAccount {
) external;

/// @notice Return a unique identifier for the account implementation.
/// @dev This function MUST return a string in the format "vendor/account/semver".
/// @dev This function MUST return a string in the format "vendor.account.semver". The vendor and account
/// names MUST NOT contain a period character.
/// @return The account ID.
function accountId() external view returns (string memory);
}
3 changes: 2 additions & 1 deletion src/interfaces/IModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ interface IModule is IERC165 {
function onUninstall(bytes calldata data) external;

/// @notice Return a unique identifier for the module.
/// @dev This function MUST return a string in the format "vendor/module/semver".
/// @dev This function MUST return a string in the format "vendor.module.semver". The vendor and module
/// names MUST NOT contain a period character.
/// @return The module ID.
function moduleId() external view returns (string memory);
}
2 changes: 1 addition & 1 deletion src/modules/ERC20TokenLimitModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ contract ERC20TokenLimitModule is BaseModule, IExecutionHookModule {

/// @inheritdoc IModule
function moduleId() external pure returns (string memory) {
return "erc6900/erc20-token-limit-module/1.0.0";
return "erc6900.erc20-token-limit-module.1.0.0";
}

/// @inheritdoc BaseModule
Expand Down
2 changes: 1 addition & 1 deletion src/modules/NativeTokenLimitModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ contract NativeTokenLimitModule is BaseModule, IExecutionHookModule, IValidation

/// @inheritdoc IModule
function moduleId() external pure returns (string memory) {
return "erc6900/native-token-limit-module/1.0.0";
return "erc6900.native-token-limit-module.1.0.0";
}

// ┏━━━━━━━━━━━━━━━┓
Expand Down
2 changes: 1 addition & 1 deletion src/modules/TokenReceiverModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ contract TokenReceiverModule is BaseModule, IExecutionModule, IERC721Receiver, I

/// @inheritdoc IModule
function moduleId() external pure returns (string memory) {
return "erc6900/token-receiver-module/1.0.0";
return "erc6900.token-receiver-module.1.0.0";
}
}
2 changes: 1 addition & 1 deletion src/modules/permissionhooks/AllowlistModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ contract AllowlistModule is IValidationHookModule, BaseModule {

/// @inheritdoc IModule
function moduleId() external pure returns (string memory) {
return "erc6900/allowlist-module/0.0.1";
return "erc6900.allowlist-module.0.0.1";
}

function setAllowlistTarget(uint32 entityId, address target, bool allowed, bool hasSelectorAllowlist) public {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/validation/SingleSignerValidationModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ contract SingleSignerValidationModule is ISingleSignerValidationModule, ReplaySa

/// @inheritdoc IModule
function moduleId() external pure returns (string memory) {
return "erc6900/single-signer-validation-module/1.0.0";
return "erc6900.single-signer-validation-module.1.0.0";
}

function supportsInterface(bytes4 interfaceId)
Expand Down
4 changes: 2 additions & 2 deletions test/account/ReferenceModularAccount.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ contract ReferenceModularAccountTest is AccountTestBase {
assertEq(
accountId,
vm.envOr("SMA_TEST", false)
? "erc6900/reference-semi-modular-account/0.8.0"
: "erc6900/reference-modular-account/0.8.0"
? "erc6900.reference-semi-modular-account.0.8.0"
: "erc6900.reference-modular-account.0.8.0"
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/mocks/MockModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ contract MockModule is ERC165 {
}

function moduleId() external pure returns (string memory) {
return "erc6900/mock-module/1.0.0";
return "erc6900.mock-module.1.0.0";
}

/// @dev Returns true if this contract implements the interface defined by
Expand Down
2 changes: 1 addition & 1 deletion test/mocks/modules/ComprehensiveModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,6 @@ contract ComprehensiveModule is
}

function moduleId() external pure returns (string memory) {
return "erc6900/comprehensive-module/1.0.0";
return "erc6900.comprehensive-module.1.0.0";
}
}
2 changes: 1 addition & 1 deletion test/mocks/modules/DirectCallModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract DirectCallModule is BaseModule, IExecutionHookModule {
}

function moduleId() external pure returns (string memory) {
return "erc6900/direct-call-module/1.0.0";
return "erc6900.direct-call-module.1.0.0";
}

function preExecutionHook(uint32, address sender, uint256, bytes calldata)
Expand Down
2 changes: 1 addition & 1 deletion test/mocks/modules/MockAccessControlHookModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ contract MockAccessControlHookModule is IValidationHookModule, BaseModule {
}

function moduleId() external pure returns (string memory) {
return "erc6900/mock-access-control-hook-module/1.0.0";
return "erc6900.mock-access-control-hook-module.1.0.0";
}

function supportsInterface(bytes4 interfaceId)
Expand Down
2 changes: 1 addition & 1 deletion test/mocks/modules/PermittedCallMocks.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract PermittedCallerModule is IExecutionModule, BaseModule {
}

function moduleId() external pure returns (string memory) {
return "erc6900/permitted-caller-module/1.0.0";
return "erc6900.permitted-caller-module.1.0.0";
}

// The manifest requested access to use the module-defined method "foo"
Expand Down
4 changes: 2 additions & 2 deletions test/mocks/modules/ReturnDataModuleMocks.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ contract ResultCreatorModule is IExecutionModule, BaseModule {
}

function moduleId() external pure returns (string memory) {
return "erc6900/result-creator-module/1.0.0";
return "erc6900.result-creator-module.1.0.0";
}
}

Expand Down Expand Up @@ -139,6 +139,6 @@ contract ResultConsumerModule is IExecutionModule, BaseModule, IValidationModule
}

function moduleId() external pure returns (string memory) {
return "erc6900/result-consumer-module/1.0.0";
return "erc6900.result-consumer-module.1.0.0";
}
}
2 changes: 1 addition & 1 deletion test/mocks/modules/ValidationModuleMocks.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ abstract contract MockBaseUserOpValidationModule is
}

function moduleId() external pure returns (string memory) {
return "erc6900/mock-user-op-validation-module/1.0.0";
return "erc6900.mock-user-op-validation-module.1.0.0";
}

// Empty stubs
Expand Down

0 comments on commit f9660c7

Please sign in to comment.