diff --git a/accounts/safe7579/src/SafeERC7579.sol b/accounts/safe7579/src/SafeERC7579.sol index 4b6bbb5a..82f1f0ce 100644 --- a/accounts/safe7579/src/SafeERC7579.sol +++ b/accounts/safe7579/src/SafeERC7579.sol @@ -269,8 +269,11 @@ contract SafeERC7579 is ISafeOp, IERC7579Account, AccessControl, IMSA, HookManag /** * @inheritdoc IERC7579Account */ - function accountId() external pure override returns (string memory accountImplementationId) { - return "safe-erc7579.v0.0.0"; + function accountId() external view override returns (string memory accountImplementationId) { + string memory version = ISafe(msg.sender).VERSION(); + + accountImplementationId = + string(abi.encodePacked("safe", abi.encodePacked(version), ".erc7579.v0.0.1")); } /** diff --git a/accounts/safe7579/src/interfaces/ISafe.sol b/accounts/safe7579/src/interfaces/ISafe.sol index 04c6b4a5..8dcec479 100644 --- a/accounts/safe7579/src/interfaces/ISafe.sol +++ b/accounts/safe7579/src/interfaces/ISafe.sol @@ -59,6 +59,8 @@ interface ISafe { */ function domainSeparator() external view returns (bytes32); + function VERSION() external pure returns (string memory); + function getStorageAt(uint256 offset, uint256 length) external view returns (bytes memory); /** diff --git a/accounts/safe7579/test/SafeERC7579.t.sol b/accounts/safe7579/test/SafeERC7579.t.sol index fe8c6baa..f9862dcf 100644 --- a/accounts/safe7579/test/SafeERC7579.t.sol +++ b/accounts/safe7579/test/SafeERC7579.t.sol @@ -6,6 +6,8 @@ import "erc7579/lib/ModeLib.sol"; import "erc7579/lib/ExecutionLib.sol"; import { TestBaseUtil, MockTarget, MockFallback } from "./Base.t.sol"; +import "forge-std/console2.sol"; + contract MSATest is TestBaseUtil { function setUp() public override { super.setUp(); @@ -117,4 +119,10 @@ contract MSATest is TestBaseUtil { assertEq(erc2771Sender, address(this)); assertEq(msgSender, address(safe)); } + + function test_accountId() public { + string memory id = IERC7579Account(address(safe)).accountId(); + + assertEq(id, "safe1.4.1.erc7579.v0.0.1"); + } }