Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AccountERC7579HookedUpgradeable

Inherits: Initializable, AccountERC7579Upgradeable

Extension of {AccountERC7579} with support for a single hook module (type 4). If installed, this extension will call the hook module's {IERC7579Hook-preCheck} before executing any operation with {_execute} (including {execute} and {executeFromExecutor} by default) and {IERC7579Hook-postCheck} thereafter. NOTE: Hook modules break the check-effect-interaction pattern. In particular, the {IERC7579Hook-preCheck} hook can lead to potentially dangerous reentrancy. Using the withHook() modifier is safe if no effect is performed before the preHook or after the postHook. That is the case on all functions here, but it may not be the case if functions that have this modifier are overridden. Developers should be extremely careful when implementing hook modules or further overriding functions that involve hooks.

State Variables

AccountERC7579HookedStorageLocation

bytes32 private constant AccountERC7579HookedStorageLocation =
    0x2b49b75317ffc1021ca7da4ca3423bf8403e18b223e63e6bc7abe8f39a5ed700;

Functions

_getAccountERC7579HookedStorage

function _getAccountERC7579HookedStorage() private pure returns (AccountERC7579HookedStorage storage $);

withHook

Calls IERC7579Hook-preCheck before executing the modified function and {IERC7579Hook-postCheck} thereafter.

modifier withHook();

__AccountERC7579Hooked_init

function __AccountERC7579Hooked_init() internal onlyInitializing;

__AccountERC7579Hooked_init_unchained

function __AccountERC7579Hooked_init_unchained() internal onlyInitializing;

accountId

function accountId() public view virtual override returns (string memory);

hook

Returns the hook module address if installed, or address(0) otherwise.

function hook() public view virtual returns (address);

supportsModule

Supports hook modules. See AccountERC7579-supportsModule

function supportsModule(uint256 moduleTypeId) public view virtual override returns (bool);

isModuleInstalled

function isModuleInstalled(uint256 moduleTypeId, address module, bytes calldata data)
    public
    view
    virtual
    override
    returns (bool);

_installModule

Installs a module with support for hook modules. See AccountERC7579-_installModule

function _installModule(uint256 moduleTypeId, address module, bytes memory initData)
    internal
    virtual
    override
    withHook;

_uninstallModule

Uninstalls a module with support for hook modules. See AccountERC7579-_uninstallModule

function _uninstallModule(uint256 moduleTypeId, address module, bytes memory deInitData)
    internal
    virtual
    override
    withHook;

_execute

Hooked version of AccountERC7579-_execute.

function _execute(Mode mode, bytes calldata executionCalldata)
    internal
    virtual
    override
    withHook
    returns (bytes[] memory);

_fallback

Hooked version of AccountERC7579-_fallback.

function _fallback() internal virtual override withHook returns (bytes memory);

Errors

ERC7579HookModuleAlreadyPresent

A hook module is already present. This contract only supports one hook module.

error ERC7579HookModuleAlreadyPresent(address hook);

Structs

AccountERC7579HookedStorage

Note: storage-location: erc7201:openzeppelin.storage.AccountERC7579Hooked

struct AccountERC7579HookedStorage {
    address _hook;
}