Skip to content

Instantly share code, notes, and snippets.

@QEDK
Created July 18, 2025 22:51
Show Gist options
  • Select an option

  • Save QEDK/2a50b642a3798dbc36e7df14f2fdc8d9 to your computer and use it in GitHub Desktop.

Select an option

Save QEDK/2a50b642a3798dbc36e7df14f2fdc8d9 to your computer and use it in GitHub Desktop.
SmartAccount.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.30;
import {Account} from "@openzeppelin/community-contracts/account/Account.sol";
import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/signers/ERC7739.sol";
import {ERC7821} from "@openzeppelin/community-contracts/account/extensions/ERC7821.sol";
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import {SignerECDSA} from "@openzeppelin/community-contracts/utils/cryptography/signers/SignerECDSA.sol";
/// @custom:oz-upgrades-unsafe-allow constructor
contract SmartAccount is Initializable, Account, EIP712, ERC7739, SignerECDSA, ERC7821, ERC721Holder, ERC1155Holder {
constructor() EIP712("SmartAccount", "1") {
_disableInitializers();
}
function initializeECDSA(address signer) public initializer {
_setSigner(signer);
}
function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)
internal
view
override
returns (bool)
{
return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment