Skip to content

Commit bfe5d75

Browse files
authored
feat: fix IModularAccount to return address of the account for native functions (#208)
The reference implementation currently returns `address(this)` which is the address of the account for `ExecutionDataView`'s `module` field. However, the standard currently contradicts this by saying we should return `address(0)` for native functions. The better design seems to be to return the address of the account since the zero address would also be returned for nonexistent selectors, and it would be difficult to differentiate in those cases. The client should have the address of the account handy so it'd be easy to compare it against what is returned to check if it's a native function or not. Thanks @0xrubes for bringing this up!
1 parent fc91fa5 commit bfe5d75

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/interfaces/IModularAccountView.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {HookConfig, ModuleEntity, ValidationFlags} from "../interfaces/IModularA
66
/// @dev Represents data associated with a specific function selector.
77
struct ExecutionDataView {
88
// The module that implements this execution function.
9-
// If this is a native function, the address must remain address(0).
9+
// If this is a native function, the address must be the address of the account.
1010
address module;
1111
// Whether or not the function needs runtime validation, or can be called by anyone. The function can still be
1212
// state changing if this flag is set to true.

standard/ERCs/erc-6900.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ Module inspection interface. Modular accounts MAY implement this interface to su
226226
/// @dev Represents data associated with a specific function selector.
227227
struct ExecutionDataView {
228228
// The module that implements this execution function.
229-
// If this is a native function, the address must remain address(0).
229+
// If this is a native function, the address must be the address of the account.
230230
address module;
231231
// Whether or not the function needs runtime validation, or can be called by anyone. The function can still be
232232
// state changing if this flag is set to true.

0 commit comments

Comments
 (0)