-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add 7702 compitable semi modular account
- Loading branch information
1 parent
c23dec6
commit 1e1c931
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.26; | ||
|
||
import {IModularAccount} from "@erc6900/reference-implementation/interfaces/IModularAccount.sol"; | ||
import {IEntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol"; | ||
import {LibClone} from "solady/utils/LibClone.sol"; | ||
|
||
import {SemiModularAccountBase} from "./SemiModularAccountBase.sol"; | ||
|
||
/// @title Semi-Modular Account for EIP-7702 EOAs | ||
/// @author Alchemy | ||
/// @notice An implementation of a semi-modular account which reads the signer as the address(this). | ||
/// @dev Inherits SemiModularAccountBase. This account can be used as the delegate contract of an EOA with | ||
/// EIP-7702, where address(this) (aka the EOA address) is the default fallback signer. | ||
contract SemiModularAccount7702 is SemiModularAccountBase { | ||
constructor(IEntryPoint anEntryPoint) SemiModularAccountBase(anEntryPoint) {} | ||
|
||
/// @inheritdoc IModularAccount | ||
function accountId() external pure override returns (string memory) { | ||
return "alchemy.sma-7702.1.0.0"; | ||
} | ||
|
||
/// @dev If the fallback signer is set in storage, means the fallback signer has been updated. We ignore the | ||
/// address(this) EOA signer. | ||
function _retrieveFallbackSignerUnchecked(SemiModularAccountStorage storage _storage) | ||
internal | ||
view | ||
override | ||
returns (address) | ||
{ | ||
address storageFallbackSigner = _storage.fallbackSigner; | ||
if (storageFallbackSigner != address(0)) { | ||
return storageFallbackSigner; | ||
} | ||
|
||
return address(this); | ||
} | ||
} |