diff --git a/packages/core/solidity/src/account.test.ts b/packages/core/solidity/src/account.test.ts index 97611cee9..f68aaf9b3 100644 --- a/packages/core/solidity/src/account.test.ts +++ b/packages/core/solidity/src/account.test.ts @@ -2,7 +2,7 @@ import test from 'ava'; import { account } from '.'; import type { AccountOptions } from './account'; -import { buildAccount } from './account'; +import { buildAccount, buildFactory } from './account'; import { printContract } from './print'; /** @@ -10,20 +10,24 @@ import { printContract } from './print'; */ function testAPIEquivalence(title: string, opts?: AccountOptions) { test(title, t => { - t.is( - account.print(opts), - printContract( - buildAccount({ - name: 'MyAccount', - signatureValidation: 'ERC7739', - ERC721Holder: true, - ERC1155Holder: true, - batchedExecution: false, - ERC7579Modules: false, - ...opts, - }), - ), - ); + const withDefaultOpts: AccountOptions = { + name: 'MyAccount', + signatureValidation: 'ERC7739', + ERC721Holder: true, + ERC1155Holder: true, + batchedExecution: false, + ERC7579Modules: false, + factory: false, + ...opts, + }; + if (withDefaultOpts.factory) { + const accountContract = buildAccount(withDefaultOpts); + const factoryContract = buildFactory(accountContract, withDefaultOpts); + t.is(account.print(opts), printContract([accountContract, factoryContract])); + } else { + const accountContract = buildAccount(withDefaultOpts); + t.is(account.print(opts), printContract(accountContract)); + } }); } @@ -37,11 +41,22 @@ function testAccount(title: string, opts: Partial) { ERC7579: false as const, ...opts, }; + test(title, t => { - const c = buildAccount(fullOpts); - t.snapshot(printContract(c)); + t.snapshot(account.print({ ...fullOpts, factory: false })); }); - testAPIEquivalence(`${title} API equivalence`, fullOpts); + testAPIEquivalence(`${title} - API equivalence`, { ...fullOpts, factory: false }); + + if ( + (fullOpts.upgradeable == 'transparent' || fullOpts.upgradeable == 'uups') && + (fullOpts.signer || fullOpts.ERC7579Modules) && + fullOpts.signer !== 'ERC7702' + ) { + test(`${title} with factory`, t => { + t.snapshot(account.print({ ...fullOpts, factory: true })); + }); + testAPIEquivalence(`${title} with factory - API equivalence`, { ...fullOpts, factory: true }); + } } testAPIEquivalence('account API default'); diff --git a/packages/core/solidity/src/account.test.ts.md b/packages/core/solidity/src/account.test.ts.md index 1ea211d9d..c49946130 100644 --- a/packages/core/solidity/src/account.test.ts.md +++ b/packages/core/solidity/src/account.test.ts.md @@ -225,6 +225,8 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ contract MyAccount is Account, EIP712, ERC7739, AccountERC7579 {␊ @@ -270,6 +272,8 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ contract MyAccount is Account, IERC1271, AccountERC7579 {␊ @@ -311,6 +315,8 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ contract MyAccount is Account, EIP712, ERC7739, AccountERC7579 {␊ @@ -358,6 +364,8 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked {␊ @@ -721,6 +729,8 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ @@ -771,6 +781,106 @@ Generated by [AVA](https://avajs.dev). }␊ ` +## Account with ERC7579 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(uint256 moduleTypeId, address module, bytes calldata initData)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __UUPSUpgradeable_init();␊ + ␊ + require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ + _installModule(moduleTypeId, module, initData);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (moduleTypeId, module, initData));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (moduleTypeId, module, initData)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + ## Account with ERC7579 with ERC1271 upgradeable uups > Snapshot 1 @@ -783,8 +893,73 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(uint256 moduleTypeId, address module, bytes calldata initData)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __UUPSUpgradeable_init();␊ + ␊ + require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ + _installModule(moduleTypeId, module, initData);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + }␊ + ` + +## Account with ERC7579 with ERC1271 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ @@ -828,6 +1003,39 @@ Generated by [AVA](https://avajs.dev). return super.isValidSignature(hash, signature);␊ }␊ }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (moduleTypeId, module, initData));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (moduleTypeId, module, initData)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ ` ## Account with ERC7579 with ERC7739 upgradeable uups @@ -843,6 +1051,8 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ @@ -893,7 +1103,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with ERC7579 hooks upgradeable uups +## Account with ERC7579 with ERC7739 upgradeable uups with factory > Snapshot 1 @@ -903,14 +1113,17 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, UUPSUpgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ @@ -920,7 +1133,7 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ - __AccountERC7579Hooked_init();␊ + __AccountERC7579_init();␊ __UUPSUpgradeable_init();␊ ␊ require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ @@ -955,40 +1168,42 @@ Generated by [AVA](https://avajs.dev). return super._validateUserOp(userOp, userOpHash);␊ }␊ }␊ - ` - -## Account named upgradeable transparent - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ ␊ - contract CustomAccount is Initializable, Account, EIP712, ERC7739 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount", "1") {␊ - _disableInitializers();␊ + function deploy(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (moduleTypeId, module, initData));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function predict(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (moduleTypeId, module, initData)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ internal␊ view␊ - override␊ - returns (bool)␊ + returns (address)␊ {␊ - // Custom validation logic␊ - return false;␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with ERC1271 upgradeable transparent +## Account with ERC7579 hooks upgradeable uups > Snapshot 1 @@ -997,37 +1212,64 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountERC1271 is Initializable, Account, IERC1271 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(uint256 moduleTypeId, address module, bytes calldata initData)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579Hooked_init();␊ + __UUPSUpgradeable_init();␊ + ␊ + require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ + _installModule(moduleTypeId, module, initData);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override␊ + override(AccountERC7579Upgradeable, ERC7739)␊ returns (bytes4)␊ {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function _authorizeUpgrade(address newImplementation)␊ internal␊ - view␊ override␊ - returns (bool)␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ {␊ - // Custom validation logic␊ - return false;␊ + return super._validateUserOp(userOp, userOpHash);␊ }␊ }␊ ` -## Account with ERC7739 upgradeable transparent +## Account with ERC7579 hooks upgradeable uups with factory > Snapshot 1 @@ -1036,27 +1278,198 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountERC7739 is Initializable, Account, EIP712, ERC7739 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccountERC7739", "1") {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override␊ - returns (bool)␊ + function initialize(uint256 moduleTypeId, address module, bytes calldata initData)␊ + public␊ + initializer␊ {␊ - // Custom validation logic␊ - return false;␊ - }␊ - }␊ - ` + __AccountERC7579Hooked_init();␊ + __UUPSUpgradeable_init();␊ + ␊ + require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ + _installModule(moduleTypeId, module, initData);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (moduleTypeId, module, initData));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (moduleTypeId, module, initData)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account named upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + ␊ + contract CustomAccount is Initializable, Account, EIP712, ERC7739 {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ + }␊ + }␊ + ` + +## Account with ERC1271 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + ␊ + contract CustomAccountERC1271 is Initializable, Account, IERC1271 {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + ␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ + }␊ + }␊ + ` + +## Account with ERC7739 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + ␊ + contract CustomAccountERC7739 is Initializable, Account, EIP712, ERC7739 {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccountERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ + }␊ + }␊ + ` ## Account with ERC721Holder upgradeable transparent @@ -1209,6 +1622,8 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable {␊ @@ -1251,7 +1666,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with ERC7579 with ERC1271 upgradeable transparent +## Account with ERC7579 upgradeable transparent with factory > Snapshot 1 @@ -1261,13 +1676,17 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ @@ -1280,6 +1699,18 @@ Generated by [AVA](https://avajs.dev). require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ _installModule(moduleTypeId, module, initData);␊ }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -1290,19 +1721,44 @@ Generated by [AVA](https://avajs.dev). {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ + }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(moduleTypeId, module, initData, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(moduleTypeId, module, initData);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ public␊ view␊ - override(IERC1271, AccountERC7579Upgradeable)␊ - returns (bytes4)␊ + returns (address)␊ {␊ - return super.isValidSignature(hash, signature);␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(moduleTypeId, module, initData, salt));␊ + }␊ + ␊ + function _salt(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(moduleTypeId, module, initData, salt));␊ }␊ }␊ ` -## Account with ERC7579 with ERC7739 upgradeable transparent +## Account with ERC7579 with ERC1271 upgradeable transparent > Snapshot 1 @@ -1312,14 +1768,15 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable {␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() {␊ _disableInitializers();␊ }␊ ␊ @@ -1332,18 +1789,6 @@ Generated by [AVA](https://avajs.dev). require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ _installModule(moduleTypeId, module, initData);␊ }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ - {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -1354,10 +1799,19 @@ Generated by [AVA](https://avajs.dev). {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ }␊ ` -## Account with ERC7579 hooks upgradeable transparent +## Account with ERC7579 with ERC1271 upgradeable transparent with factory > Snapshot 1 @@ -1367,15 +1821,16 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable {␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() {␊ _disableInitializers();␊ }␊ ␊ @@ -1383,23 +1838,11 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ - __AccountERC7579Hooked_init();␊ + __AccountERC7579_init();␊ ␊ require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ _installModule(moduleTypeId, module, initData);␊ }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ - {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -1410,89 +1853,53 @@ Generated by [AVA](https://avajs.dev). {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ - }␊ - ` - -## Account with SignerERC7702 named non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ - ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ - contract CustomAccountWithSignerERC7702 is Account, EIP712, ERC7739, SignerERC7702 {␊ - constructor() EIP712("CustomAccount with SignerERC7702", "1") {}␊ - }␊ - ` - -## Account with SignerERC7702 with ERC1271 non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ - ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ - ␊ - contract CustomAccountWithSignerERC7702ERC1271 is Account, IERC1271, SignerERC7702 {␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override␊ + override(IERC1271, AccountERC7579Upgradeable)␊ returns (bytes4)␊ {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + return super.isValidSignature(hash, signature);␊ }␊ }␊ - ` - -## Account with SignerERC7702 with ERC7739 non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ ␊ - contract CustomAccountWithSignerERC7702ERC7739 is Account, EIP712, ERC7739, SignerERC7702 {␊ - constructor() EIP712("CustomAccount with SignerERC7702ERC7739", "1") {}␊ - }␊ - ` - -## Account with SignerERC7702 with ERC721Holder non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ + function deploy(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(moduleTypeId, module, initData, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(moduleTypeId, module, initData);␊ + }␊ + return instance;␊ + ␊ + }␊ ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + function predict(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(moduleTypeId, module, initData, salt));␊ + }␊ ␊ - contract CustomAccountWithSignerERC7702ERC721Holder is Account, EIP712, ERC7739, SignerERC7702, ERC721Holder {␊ - constructor() EIP712("CustomAccount with SignerERC7702ERC721Holder", "1") {}␊ + function _salt(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(moduleTypeId, module, initData, salt));␊ + }␊ }␊ ` -## Account with SignerERC7702 with ERC1155Holder non-upgradeable +## Account with ERC7579 with ERC7739 upgradeable transparent > Snapshot 1 @@ -1501,67 +1908,55 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract CustomAccountWithSignerERC7702ERC1155Holder is Account, EIP712, ERC7739, SignerERC7702, ERC1155Holder {␊ - constructor() EIP712("CustomAccount with SignerERC7702ERC1155Holder", "1") {}␊ - }␊ - ` - -## Account with SignerERC7702 with ERC721Holder and ERC1155Holder non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ ␊ - import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + function initialize(uint256 moduleTypeId, address module, bytes calldata initData)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ ␊ - contract CustomAccountWithSignerERC7702ERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerERC7702, ERC721Holder, ERC1155Holder {␊ - constructor()␊ - EIP712("CustomAccount with SignerERC7702ERC721HolderERC1155Holder", "1")␊ - {}␊ - }␊ - ` - -## Account with SignerERC7702 with ERC7821 Execution non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ + require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ + _installModule(moduleTypeId, module, initData);␊ + }␊ ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ - import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, SignerERC7702, ERC7821 {␊ - constructor() EIP712("MyAccount", "1") {}␊ + // The following functions are overrides required by Solidity.␊ ␊ - function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - view␊ - override␊ - returns (bool)␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ {␊ - return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + return super._validateUserOp(userOp, userOpHash);␊ }␊ }␊ ` -## Account with SignerERC7702 with ERC7579 non-upgradeable +## Account with ERC7579 with ERC7739 upgradeable transparent with factory > Snapshot 1 @@ -1569,105 +1964,91 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerERC7702 {␊ - constructor() EIP712("MyAccount", "1") {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(uint256 moduleTypeId, address module, bytes calldata initData)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + ␊ + require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ + _installModule(moduleTypeId, module, initData);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579, ERC7739)␊ + override(AccountERC7579Upgradeable, ERC7739)␊ returns (bytes4)␊ {␊ // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ - ␊ - // IMPORTANT: Make sure SignerERC7702 is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerERC7702)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(SignerERC7702, AbstractSigner, AccountERC7579)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ }␊ - ` - -## Account with SignerERC7702 with ERC7579 with ERC1271 non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ - ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ - contract MyAccount is Account, IERC1271, AccountERC7579, SignerERC7702 {␊ - // The following functions are overrides required by Solidity.␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579)␊ - returns (uint256)␊ + function deploy(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ + returns (address)␊ {␊ - return super._validateUserOp(userOp, userOpHash);␊ + bytes32 effectiveSalt = _salt(moduleTypeId, module, initData, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(moduleTypeId, module, initData);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function predict(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ public␊ view␊ - override(IERC1271, AccountERC7579)␊ - returns (bytes4)␊ + returns (address)␊ {␊ - return super.isValidSignature(hash, signature);␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(moduleTypeId, module, initData, salt));␊ }␊ ␊ - // IMPORTANT: Make sure SignerERC7702 is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerERC7702)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function _salt(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ internal␊ - view␊ - override(SignerERC7702, AbstractSigner, AccountERC7579)␊ - returns (bool)␊ + pure␊ + returns (bytes32)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return keccak256(abi.encode(moduleTypeId, module, initData, salt));␊ }␊ }␊ ` -## Account with SignerERC7702 with ERC7579 with ERC7739 non-upgradeable +## Account with ERC7579 hooks upgradeable transparent > Snapshot 1 @@ -1675,55 +2056,57 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerERC7702 {␊ - constructor() EIP712("MyAccount", "1") {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(uint256 moduleTypeId, address module, bytes calldata initData)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579Hooked_init();␊ + ␊ + require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ + _installModule(moduleTypeId, module, initData);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579, ERC7739)␊ + override(AccountERC7579Upgradeable, ERC7739)␊ returns (bytes4)␊ {␊ // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ - ␊ - // IMPORTANT: Make sure SignerERC7702 is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerERC7702)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(SignerERC7702, AbstractSigner, AccountERC7579)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ }␊ ` -## Account with SignerERC7702 with ERC7579 hooks non-upgradeable +## Account with ERC7579 hooks upgradeable transparent with factory > Snapshot 1 @@ -1731,56 +2114,92 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ - import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MODULE_TYPE_EXECUTOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ + import {MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerERC7702 {␊ - constructor() EIP712("MyAccount", "1") {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(uint256 moduleTypeId, address module, bytes calldata initData)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579Hooked_init();␊ + ␊ + require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ + _installModule(moduleTypeId, module, initData);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579, ERC7739)␊ + override(AccountERC7579Upgradeable, ERC7739)␊ returns (bytes4)␊ {␊ // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ + }␊ ␊ - // IMPORTANT: Make sure SignerERC7702 is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerERC7702)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(moduleTypeId, module, initData, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(moduleTypeId, module, initData);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + public␊ view␊ - override(SignerERC7702, AbstractSigner, AccountERC7579)␊ - returns (bool)␊ + returns (address)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(moduleTypeId, module, initData, salt));␊ + }␊ + ␊ + function _salt(uint256 moduleTypeId, address module, bytes calldata initData, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(moduleTypeId, module, initData, salt));␊ }␊ }␊ ` -## Account with SignerECDSA named non-upgradeable +## Account with SignerERC7702 named non-upgradeable > Snapshot 1 @@ -1791,17 +2210,14 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ - contract CustomAccountWithSignerECDSA is Account, EIP712, ERC7739, SignerECDSA {␊ - constructor(address signer)␊ - EIP712("CustomAccount with SignerECDSA", "1")␊ - SignerECDSA(signer)␊ - {}␊ + contract CustomAccountWithSignerERC7702 is Account, EIP712, ERC7739, SignerERC7702 {␊ + constructor() EIP712("CustomAccount with SignerERC7702", "1") {}␊ }␊ ` -## Account with SignerECDSA with ERC1271 non-upgradeable +## Account with SignerERC7702 with ERC1271 non-upgradeable > Snapshot 1 @@ -1811,11 +2227,9 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ - ␊ - contract CustomAccountWithSignerECDSAERC1271 is Account, IERC1271, SignerECDSA {␊ - constructor(address signer) SignerECDSA(signer) {}␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ + contract CustomAccountWithSignerERC7702ERC1271 is Account, IERC1271, SignerERC7702 {␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ @@ -1827,7 +2241,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerECDSA with ERC7739 non-upgradeable +## Account with SignerERC7702 with ERC7739 non-upgradeable > Snapshot 1 @@ -1838,17 +2252,14 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC7739 is Account, EIP712, ERC7739, SignerECDSA {␊ - constructor(address signer)␊ - EIP712("CustomAccount with SignerECDSAERC7739", "1")␊ - SignerECDSA(signer)␊ - {}␊ + contract CustomAccountWithSignerERC7702ERC7739 is Account, EIP712, ERC7739, SignerERC7702 {␊ + constructor() EIP712("CustomAccount with SignerERC7702ERC7739", "1") {}␊ }␊ ` -## Account with SignerECDSA with ERC721Holder non-upgradeable +## Account with SignerERC7702 with ERC721Holder non-upgradeable > Snapshot 1 @@ -1860,17 +2271,14 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC721Holder is Account, EIP712, ERC7739, SignerECDSA, ERC721Holder {␊ - constructor(address signer)␊ - EIP712("CustomAccount with SignerECDSAERC721Holder", "1")␊ - SignerECDSA(signer)␊ - {}␊ + contract CustomAccountWithSignerERC7702ERC721Holder is Account, EIP712, ERC7739, SignerERC7702, ERC721Holder {␊ + constructor() EIP712("CustomAccount with SignerERC7702ERC721Holder", "1") {}␊ }␊ ` -## Account with SignerECDSA with ERC1155Holder non-upgradeable +## Account with SignerERC7702 with ERC1155Holder non-upgradeable > Snapshot 1 @@ -1882,17 +2290,14 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC1155Holder is Account, EIP712, ERC7739, SignerECDSA, ERC1155Holder {␊ - constructor(address signer)␊ - EIP712("CustomAccount with SignerECDSAERC1155Holder", "1")␊ - SignerECDSA(signer)␊ - {}␊ + contract CustomAccountWithSignerERC7702ERC1155Holder is Account, EIP712, ERC7739, SignerERC7702, ERC1155Holder {␊ + constructor() EIP712("CustomAccount with SignerERC7702ERC1155Holder", "1") {}␊ }␊ ` -## Account with SignerECDSA with ERC721Holder and ERC1155Holder non-upgradeable +## Account with SignerERC7702 with ERC721Holder and ERC1155Holder non-upgradeable > Snapshot 1 @@ -1905,17 +2310,16 @@ Generated by [AVA](https://avajs.dev). import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerECDSA, ERC721Holder, ERC1155Holder {␊ - constructor(address signer)␊ - EIP712("CustomAccount with SignerECDSAERC721HolderERC1155Holder", "1")␊ - SignerECDSA(signer)␊ + contract CustomAccountWithSignerERC7702ERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerERC7702, ERC721Holder, ERC1155Holder {␊ + constructor()␊ + EIP712("CustomAccount with SignerERC7702ERC721HolderERC1155Holder", "1")␊ {}␊ }␊ ` -## Account with SignerECDSA with ERC7821 Execution non-upgradeable +## Account with SignerERC7702 with ERC7821 Execution non-upgradeable > Snapshot 1 @@ -1927,10 +2331,10 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ - import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, SignerECDSA, ERC7821 {␊ - constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {}␊ + contract MyAccount is Account, EIP712, ERC7739, SignerERC7702, ERC7821 {␊ + constructor() EIP712("MyAccount", "1") {}␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ internal␊ @@ -1943,7 +2347,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerECDSA with ERC7579 non-upgradeable +## Account with SignerERC7702 with ERC7579 non-upgradeable > Snapshot 1 @@ -1957,10 +2361,10 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerECDSA {␊ - constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {}␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerERC7702 {␊ + constructor() EIP712("MyAccount", "1") {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -1984,14 +2388,14 @@ Generated by [AVA](https://avajs.dev). return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerECDSA is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ + // IMPORTANT: Make sure SignerERC7702 is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerERC7702)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerECDSA, AbstractSigner, AccountERC7579)␊ + override(SignerERC7702, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -1999,7 +2403,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerECDSA with ERC7579 with ERC1271 non-upgradeable +## Account with SignerERC7702 with ERC7579 with ERC1271 non-upgradeable > Snapshot 1 @@ -2012,11 +2416,9 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ - ␊ - contract MyAccount is Account, IERC1271, AccountERC7579, SignerECDSA {␊ - constructor(address signer) SignerECDSA(signer) {}␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ + contract MyAccount is Account, IERC1271, AccountERC7579, SignerERC7702 {␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ @@ -2036,14 +2438,14 @@ Generated by [AVA](https://avajs.dev). return super.isValidSignature(hash, signature);␊ }␊ ␊ - // IMPORTANT: Make sure SignerECDSA is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ + // IMPORTANT: Make sure SignerERC7702 is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerERC7702)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerECDSA, AbstractSigner, AccountERC7579)␊ + override(SignerERC7702, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -2051,7 +2453,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerECDSA with ERC7579 with ERC7739 non-upgradeable +## Account with SignerERC7702 with ERC7579 with ERC7739 non-upgradeable > Snapshot 1 @@ -2065,10 +2467,10 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerECDSA {␊ - constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {}␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerERC7702 {␊ + constructor() EIP712("MyAccount", "1") {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -2092,14 +2494,14 @@ Generated by [AVA](https://avajs.dev). return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerECDSA is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ + // IMPORTANT: Make sure SignerERC7702 is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerERC7702)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerECDSA, AbstractSigner, AccountERC7579)␊ + override(SignerERC7702, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -2107,7 +2509,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerECDSA with ERC7579 hooks non-upgradeable +## Account with SignerERC7702 with ERC7579 hooks non-upgradeable > Snapshot 1 @@ -2122,10 +2524,10 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerECDSA {␊ - constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {}␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerERC7702 {␊ + constructor() EIP712("MyAccount", "1") {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -2149,14 +2551,14 @@ Generated by [AVA](https://avajs.dev). return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerECDSA is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ + // IMPORTANT: Make sure SignerERC7702 is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerERC7702)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerECDSA, AbstractSigner, AccountERC7579)␊ + override(SignerERC7702, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -2164,7 +2566,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerECDSA named upgradeable uups +## Account with SignerECDSA named non-upgradeable > Snapshot 1 @@ -2175,30 +2577,17 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ - ␊ - contract CustomAccountWithSignerECDSA is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerECDSA", "1") {␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - __UUPSUpgradeable_init();␊ - }␊ + import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ + contract CustomAccountWithSignerECDSA is Account, EIP712, ERC7739, SignerECDSA {␊ + constructor(address signer)␊ + EIP712("CustomAccount with SignerECDSA", "1")␊ + SignerECDSA(signer)␊ {}␊ }␊ ` -## Account with SignerECDSA with ERC1271 upgradeable uups +## Account with SignerECDSA with ERC1271 non-upgradeable > Snapshot 1 @@ -2208,20 +2597,10 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ - ␊ - contract CustomAccountWithSignerECDSAERC1271 is Initializable, Account, IERC1271, SignerECDSAUpgradeable, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ - _disableInitializers();␊ - }␊ + import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - __UUPSUpgradeable_init();␊ - }␊ + contract CustomAccountWithSignerECDSAERC1271 is Account, IERC1271, SignerECDSA {␊ + constructor(address signer) SignerECDSA(signer) {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -2231,16 +2610,10 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ }␊ ` -## Account with SignerECDSA with ERC7739 upgradeable uups +## Account with SignerECDSA with ERC7739 non-upgradeable > Snapshot 1 @@ -2251,30 +2624,17 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ - ␊ - contract CustomAccountWithSignerECDSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerECDSAERC7739", "1") {␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - __UUPSUpgradeable_init();␊ - }␊ + import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ + contract CustomAccountWithSignerECDSAERC7739 is Account, EIP712, ERC7739, SignerECDSA {␊ + constructor(address signer)␊ + EIP712("CustomAccount with SignerECDSAERC7739", "1")␊ + SignerECDSA(signer)␊ {}␊ }␊ ` -## Account with SignerECDSA with ERC721Holder upgradeable uups +## Account with SignerECDSA with ERC721Holder non-upgradeable > Snapshot 1 @@ -2286,30 +2646,17 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ - ␊ - contract CustomAccountWithSignerECDSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerECDSAERC721Holder", "1") {␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - __UUPSUpgradeable_init();␊ - }␊ + import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ + contract CustomAccountWithSignerECDSAERC721Holder is Account, EIP712, ERC7739, SignerECDSA, ERC721Holder {␊ + constructor(address signer)␊ + EIP712("CustomAccount with SignerECDSAERC721Holder", "1")␊ + SignerECDSA(signer)␊ {}␊ }␊ ` -## Account with SignerECDSA with ERC1155Holder upgradeable uups +## Account with SignerECDSA with ERC1155Holder non-upgradeable > Snapshot 1 @@ -2321,30 +2668,17 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ - ␊ - contract CustomAccountWithSignerECDSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC1155Holder, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerECDSAERC1155Holder", "1") {␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - __UUPSUpgradeable_init();␊ - }␊ + import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ + contract CustomAccountWithSignerECDSAERC1155Holder is Account, EIP712, ERC7739, SignerECDSA, ERC1155Holder {␊ + constructor(address signer)␊ + EIP712("CustomAccount with SignerECDSAERC1155Holder", "1")␊ + SignerECDSA(signer)␊ {}␊ }␊ ` -## Account with SignerECDSA with ERC721Holder and ERC1155Holder upgradeable uups +## Account with SignerECDSA with ERC721Holder and ERC1155Holder non-upgradeable > Snapshot 1 @@ -2357,32 +2691,17 @@ Generated by [AVA](https://avajs.dev). import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor()␊ + contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerECDSA, ERC721Holder, ERC1155Holder {␊ + constructor(address signer)␊ EIP712("CustomAccount with SignerECDSAERC721HolderERC1155Holder", "1")␊ - {␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - __UUPSUpgradeable_init();␊ - }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ + SignerECDSA(signer)␊ {}␊ }␊ ` -## Account with SignerECDSA with ERC7821 Execution upgradeable uups +## Account with SignerECDSA with ERC7821 Execution non-upgradeable > Snapshot 1 @@ -2394,20 +2713,10 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ - ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC7821, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ - _disableInitializers();␊ - }␊ + import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - __UUPSUpgradeable_init();␊ - }␊ + contract MyAccount is Account, EIP712, ERC7739, SignerECDSA, ERC7821 {␊ + constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {}␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ internal␊ @@ -2417,16 +2726,10 @@ Generated by [AVA](https://avajs.dev). {␊ return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ }␊ ` -## Account with SignerECDSA with ERC7579 upgradeable uups +## Account with SignerECDSA with ERC7579 non-upgradeable > Snapshot 1 @@ -2436,62 +2739,45 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ - ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ - _disableInitializers();␊ - }␊ + import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - function initialize(address signer) public initializer {␊ - __AccountERC7579_init();␊ - __SignerECDSA_init(signer);␊ - __UUPSUpgradeable_init();␊ - }␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerECDSA {␊ + constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ + override(AccountERC7579, ERC7739)␊ returns (bytes4)␊ {␊ // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579Upgradeable)␊ + override(Account, AccountERC7579)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ + // IMPORTANT: Make sure SignerECDSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + override(SignerECDSA, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -2499,7 +2785,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerECDSA with ERC7579 with ERC1271 upgradeable uups +## Account with SignerECDSA with ERC7579 with ERC1271 non-upgradeable > Snapshot 1 @@ -2509,36 +2795,19 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ - ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - __AccountERC7579_init();␊ - __SignerECDSA_init(signer);␊ - __UUPSUpgradeable_init();␊ - }␊ + import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ + contract MyAccount is Account, IERC1271, AccountERC7579, SignerECDSA {␊ + constructor(address signer) SignerECDSA(signer) {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579Upgradeable)␊ + override(Account, AccountERC7579)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ @@ -2547,20 +2816,20 @@ Generated by [AVA](https://avajs.dev). function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(IERC1271, AccountERC7579Upgradeable)␊ + override(IERC1271, AccountERC7579)␊ returns (bytes4)␊ {␊ return super.isValidSignature(hash, signature);␊ }␊ ␊ - // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ + // IMPORTANT: Make sure SignerECDSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + override(SignerECDSA, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -2568,7 +2837,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerECDSA with ERC7579 with ERC7739 upgradeable uups +## Account with SignerECDSA with ERC7579 with ERC7739 non-upgradeable > Snapshot 1 @@ -2578,62 +2847,45 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ - ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ - _disableInitializers();␊ - }␊ + import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - function initialize(address signer) public initializer {␊ - __AccountERC7579_init();␊ - __SignerECDSA_init(signer);␊ - __UUPSUpgradeable_init();␊ - }␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerECDSA {␊ + constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ + override(AccountERC7579, ERC7739)␊ returns (bytes4)␊ {␊ // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579Upgradeable)␊ + override(Account, AccountERC7579)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ + // IMPORTANT: Make sure SignerECDSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + override(SignerECDSA, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -2641,7 +2893,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerECDSA with ERC7579 hooks upgradeable uups +## Account with SignerECDSA with ERC7579 hooks non-upgradeable > Snapshot 1 @@ -2651,63 +2903,46 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ - ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ - _disableInitializers();␊ - }␊ + import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - function initialize(address signer) public initializer {␊ - __AccountERC7579Hooked_init();␊ - __SignerECDSA_init(signer);␊ - __UUPSUpgradeable_init();␊ - }␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerECDSA {␊ + constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ + override(AccountERC7579, ERC7739)␊ returns (bytes4)␊ {␊ // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579Upgradeable)␊ + override(Account, AccountERC7579)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ + // IMPORTANT: Make sure SignerECDSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + override(SignerECDSA, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -2715,7 +2950,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerECDSA named upgradeable transparent +## Account with SignerECDSA named upgradeable uups > Snapshot 1 @@ -2728,8 +2963,9 @@ Generated by [AVA](https://avajs.dev). import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerECDSA is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable {␊ + contract CustomAccountWithSignerECDSA is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() EIP712("CustomAccount with SignerECDSA", "1") {␊ _disableInitializers();␊ @@ -2737,11 +2973,18 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerECDSA with ERC1271 upgradeable transparent +## Account with SignerECDSA named upgradeable uups with factory > Snapshot 1 @@ -2750,32 +2993,60 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC1271 is Initializable, Account, IERC1271, SignerECDSAUpgradeable {␊ + contract CustomAccountWithSignerECDSA is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor() EIP712("CustomAccount with SignerECDSA", "1") {␊ _disableInitializers();␊ }␊ ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ override␊ - returns (bytes4)␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerECDSAFactory {␊ + CustomAccountWithSignerECDSA public immutable implementation = new CustomAccountWithSignerECDSA();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerECDSA.initialize, (signer));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerECDSA.initialize, (signer)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerECDSA with ERC7739 upgradeable transparent +## Account with SignerECDSA with ERC1271 upgradeable uups > Snapshot 1 @@ -2784,24 +3055,40 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable {␊ + contract CustomAccountWithSignerECDSAERC1271 is Initializable, Account, IERC1271, SignerECDSAUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerECDSAERC7739", "1") {␊ + constructor() {␊ _disableInitializers();␊ }␊ ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerECDSA with ERC721Holder upgradeable transparent +## Account with SignerECDSA with ERC1271 upgradeable uups with factory > Snapshot 1 @@ -2810,25 +3097,68 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder {␊ + contract CustomAccountWithSignerECDSAERC1271 is Initializable, Account, IERC1271, SignerECDSAUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerECDSAERC721Holder", "1") {␊ + constructor() {␊ _disableInitializers();␊ }␊ ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerECDSAERC1271Factory {␊ + CustomAccountWithSignerECDSAERC1271 public immutable implementation = new CustomAccountWithSignerECDSAERC1271();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerECDSAERC1271.initialize, (signer));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerECDSAERC1271.initialize, (signer)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerECDSA with ERC1155Holder upgradeable transparent +## Account with SignerECDSA with ERC7739 upgradeable uups > Snapshot 1 @@ -2838,24 +3168,31 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC1155Holder {␊ + contract CustomAccountWithSignerECDSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerECDSAERC1155Holder", "1") {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC7739", "1") {␊ _disableInitializers();␊ }␊ ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerECDSA with ERC721Holder and ERC1155Holder upgradeable transparent +## Account with SignerECDSA with ERC7739 upgradeable uups with factory > Snapshot 1 @@ -2865,27 +3202,59 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder, ERC1155Holder {␊ + contract CustomAccountWithSignerECDSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor()␊ - EIP712("CustomAccount with SignerECDSAERC721HolderERC1155Holder", "1")␊ - {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC7739", "1") {␊ _disableInitializers();␊ }␊ ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerECDSAERC7739Factory {␊ + CustomAccountWithSignerECDSAERC7739 public immutable implementation = new CustomAccountWithSignerECDSAERC7739();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerECDSAERC7739.initialize, (signer));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerECDSAERC7739.initialize, (signer)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerECDSA with ERC7821 Execution upgradeable transparent +## Account with SignerECDSA with ERC721Holder upgradeable uups > Snapshot 1 @@ -2895,33 +3264,32 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC7821 {␊ + contract CustomAccountWithSignerECDSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC721Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ - function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + function _authorizeUpgrade(address newImplementation)␊ internal␊ - view␊ override␊ - returns (bool)␊ - {␊ - return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ - }␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerECDSA with ERC7579 upgradeable transparent +## Account with SignerECDSA with ERC721Holder upgradeable uups with factory > Snapshot 1 @@ -2929,64 +3297,62 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable {␊ + contract CustomAccountWithSignerECDSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC721Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ function initialize(address signer) public initializer {␊ - __AccountERC7579_init();␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ - {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ - }␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ ␊ - // The following functions are overrides required by Solidity.␊ + contract CustomAccountWithSignerECDSAERC721HolderFactory {␊ + CustomAccountWithSignerECDSAERC721Holder public immutable implementation = new CustomAccountWithSignerECDSAERC721Holder();␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerECDSAERC721Holder.initialize, (signer));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerECDSAERC721Holder.initialize, (signer)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ internal␊ view␊ - override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ + returns (address)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerECDSA with ERC7579 with ERC1271 upgradeable transparent +## Account with SignerECDSA with ERC1155Holder upgradeable uups > Snapshot 1 @@ -2994,60 +3360,34 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerECDSAUpgradeable {␊ + contract CustomAccountWithSignerECDSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC1155Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC1155Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ function initialize(address signer) public initializer {␊ - __AccountERC7579_init();␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ - // The following functions are overrides required by Solidity.␊ - ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + function _authorizeUpgrade(address newImplementation)␊ internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ - }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(IERC1271, AccountERC7579Upgradeable)␊ - returns (bytes4)␊ - {␊ - return super.isValidSignature(hash, signature);␊ - }␊ - ␊ - // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerECDSA with ERC7579 with ERC7739 upgradeable transparent +## Account with SignerECDSA with ERC1155Holder upgradeable uups with factory > Snapshot 1 @@ -3055,64 +3395,62 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable {␊ + contract CustomAccountWithSignerECDSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC1155Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC1155Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ function initialize(address signer) public initializer {␊ - __AccountERC7579_init();␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ - {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ - }␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ ␊ - // The following functions are overrides required by Solidity.␊ + contract CustomAccountWithSignerECDSAERC1155HolderFactory {␊ + CustomAccountWithSignerECDSAERC1155Holder public immutable implementation = new CustomAccountWithSignerECDSAERC1155Holder();␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerECDSAERC1155Holder.initialize, (signer));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerECDSAERC1155Holder.initialize, (signer)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ internal␊ view␊ - override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ + returns (address)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerECDSA with ERC7579 hooks upgradeable transparent +## Account with SignerECDSA with ERC721Holder and ERC1155Holder upgradeable uups > Snapshot 1 @@ -3120,65 +3458,37 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerECDSAUpgradeable {␊ + contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerECDSAERC721HolderERC1155Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ function initialize(address signer) public initializer {␊ - __AccountERC7579Hooked_init();␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ - {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ - }␊ - ␊ - // The following functions are overrides required by Solidity.␊ - ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ - }␊ - ␊ - // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function _authorizeUpgrade(address newImplementation)␊ internal␊ - view␊ - override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerP256 named non-upgradeable +## Account with SignerECDSA with ERC721Holder and ERC1155Holder upgradeable uups with factory > Snapshot 1 @@ -3188,44 +3498,63 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountWithSignerP256 is Account, EIP712, ERC7739, SignerP256 {␊ - constructor(bytes32 qx, bytes32 qy)␊ - EIP712("CustomAccount with SignerP256", "1")␊ - SignerP256(qx, qy)␊ + contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor()␊ + EIP712("CustomAccount with SignerECDSAERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ {}␊ }␊ - ` - -## Account with SignerP256 with ERC1271 non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + contract CustomAccountWithSignerECDSAERC721HolderERC1155HolderFactory {␊ + CustomAccountWithSignerECDSAERC721HolderERC1155Holder public immutable implementation = new CustomAccountWithSignerECDSAERC721HolderERC1155Holder();␊ ␊ - contract CustomAccountWithSignerP256ERC1271 is Account, IERC1271, SignerP256 {␊ - constructor(bytes32 qx, bytes32 qy) SignerP256(qx, qy) {}␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerECDSAERC721HolderERC1155Holder.initialize, (signer));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerECDSAERC721HolderERC1155Holder.initialize, (signer)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ view␊ - override␊ - returns (bytes4)␊ + returns (address)␊ {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerP256 with ERC7739 non-upgradeable +## Account with SignerECDSA with ERC7821 Execution upgradeable uups > Snapshot 1 @@ -3236,17 +3565,40 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC7739 is Account, EIP712, ERC7739, SignerP256 {␊ - constructor(bytes32 qx, bytes32 qy)␊ - EIP712("CustomAccount with SignerP256ERC7739", "1")␊ - SignerP256(qx, qy)␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC7821, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ {}␊ }␊ ` -## Account with SignerP256 with ERC721Holder non-upgradeable +## Account with SignerECDSA with ERC7821 Execution upgradeable uups with factory > Snapshot 1 @@ -3256,19 +3608,69 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC721Holder is Account, EIP712, ERC7739, SignerP256, ERC721Holder {␊ - constructor(bytes32 qx, bytes32 qy)␊ - EIP712("CustomAccount with SignerP256ERC721Holder", "1")␊ - SignerP256(qx, qy)␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC7821, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ {}␊ }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signer));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signer)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ ` -## Account with SignerP256 with ERC1155Holder non-upgradeable +## Account with SignerECDSA with ERC7579 upgradeable uups > Snapshot 1 @@ -3276,75 +3678,72 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC1155Holder is Account, EIP712, ERC7739, SignerP256, ERC1155Holder {␊ - constructor(bytes32 qx, bytes32 qy)␊ - EIP712("CustomAccount with SignerP256ERC1155Holder", "1")␊ - SignerP256(qx, qy)␊ - {}␊ - }␊ - ` - -## Account with SignerP256 with ERC721Holder and ERC1155Holder non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ ␊ - import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ + __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ - contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerP256, ERC721Holder, ERC1155Holder {␊ - constructor(bytes32 qx, bytes32 qy)␊ - EIP712("CustomAccount with SignerP256ERC721HolderERC1155Holder", "1")␊ - SignerP256(qx, qy)␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ {}␊ - }␊ - ` - -## Account with SignerP256 with ERC7821 Execution non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ - import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + // The following functions are overrides required by Solidity.␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, SignerP256, ERC7821 {␊ - constructor(bytes32 qx, bytes32 qy)␊ - EIP712("MyAccount", "1")␊ - SignerP256(qx, qy)␊ - {}␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ ␊ - function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ - return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + return super._rawSignatureValidation(hash, signature);␊ }␊ }␊ ` -## Account with SignerP256 with ERC7579 non-upgradeable +## Account with SignerECDSA with ERC7579 upgradeable uups with factory > Snapshot 1 @@ -3354,56 +3753,98 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerP256 {␊ - constructor(bytes32 qx, bytes32 qy)␊ - EIP712("MyAccount", "1")␊ - SignerP256(qx, qy)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ + __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579, ERC7739)␊ + override(AccountERC7579Upgradeable, ERC7739)␊ returns (bytes4)␊ {␊ // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerP256 is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerP256)␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerP256, AbstractSigner, AccountERC7579)␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ }␊ }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signer));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signer)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ ` -## Account with SignerP256 with ERC7579 with ERC1271 non-upgradeable +## Account with SignerECDSA with ERC7579 with ERC1271 upgradeable uups > Snapshot 1 @@ -3413,19 +3854,36 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Account, IERC1271, AccountERC7579, SignerP256 {␊ - constructor(bytes32 qx, bytes32 qy) SignerP256(qx, qy) {}␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ + __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ @@ -3434,20 +3892,20 @@ Generated by [AVA](https://avajs.dev). function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(IERC1271, AccountERC7579)␊ + override(IERC1271, AccountERC7579Upgradeable)␊ returns (bytes4)␊ {␊ return super.isValidSignature(hash, signature);␊ }␊ ␊ - // IMPORTANT: Make sure SignerP256 is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerP256)␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerP256, AbstractSigner, AccountERC7579)␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -3455,7 +3913,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerP256 with ERC7579 with ERC7739 non-upgradeable +## Account with SignerECDSA with ERC7579 with ERC1271 upgradeable uups with factory > Snapshot 1 @@ -3465,56 +3923,94 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerP256 {␊ - constructor(bytes32 qx, bytes32 qy)␊ - EIP712("MyAccount", "1")␊ - SignerP256(qx, qy)␊ - {}␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(AccountERC7579, ERC7739)␊ - returns (bytes4)␊ - {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ + __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerP256 is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerP256)␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerP256, AbstractSigner, AccountERC7579)␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ }␊ }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signer));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signer)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ ` -## Account with SignerP256 with ERC7579 hooks non-upgradeable +## Account with SignerECDSA with ERC7579 with ERC7739 upgradeable uups > Snapshot 1 @@ -3524,49 +4020,62 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ - import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerP256 {␊ - constructor(bytes32 qx, bytes32 qy)␊ - EIP712("MyAccount", "1")␊ - SignerP256(qx, qy)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ + __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579, ERC7739)␊ + override(AccountERC7579Upgradeable, ERC7739)␊ returns (bytes4)␊ {␊ // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerP256 is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerP256)␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerP256, AbstractSigner, AccountERC7579)␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -3574,7 +4083,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerP256 named upgradeable uups +## Account with SignerECDSA with ERC7579 with ERC7739 upgradeable uups with factory > Snapshot 1 @@ -3582,33 +4091,100 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountWithSignerP256 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, UUPSUpgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerP256", "1") {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ + __SignerECDSA_init(signer);␊ __UUPSUpgradeable_init();␊ }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ override␊ onlyEntryPointOrSelf␊ {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signer));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signer)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ }␊ ` -## Account with SignerP256 with ERC1271 upgradeable uups +## Account with SignerECDSA with ERC7579 hooks upgradeable uups > Snapshot 1 @@ -3616,30 +4192,39 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC1271 is Initializable, Account, IERC1271, SignerP256Upgradeable, UUPSUpgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerECDSA_init(signer);␊ __UUPSUpgradeable_init();␊ }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override␊ + override(AccountERC7579Upgradeable, ERC7739)␊ returns (bytes4)␊ {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -3647,10 +4232,33 @@ Generated by [AVA](https://avajs.dev). override␊ onlyEntryPointOrSelf␊ {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ }␊ ` -## Account with SignerP256 with ERC7739 upgradeable uups +## Account with SignerECDSA with ERC7579 hooks upgradeable uups with factory > Snapshot 1 @@ -3658,33 +4266,101 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC7739 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, UUPSUpgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerP256ERC7739", "1") {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerECDSA_init(signer);␊ __UUPSUpgradeable_init();␊ }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ override␊ onlyEntryPointOrSelf␊ {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signer));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signer)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ }␊ ` -## Account with SignerP256 with ERC721Holder upgradeable uups +## Account with SignerECDSA named upgradeable transparent > Snapshot 1 @@ -3694,32 +4370,23 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC721Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder, UUPSUpgradeable {␊ + contract CustomAccountWithSignerECDSA is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerP256ERC721Holder", "1") {␊ + constructor() EIP712("CustomAccount with SignerECDSA", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ - __UUPSUpgradeable_init();␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ }␊ ` -## Account with SignerP256 with ERC1155Holder upgradeable uups +## Account with SignerECDSA named upgradeable transparent with factory > Snapshot 1 @@ -3729,70 +4396,47 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC1155Holder, UUPSUpgradeable {␊ + contract CustomAccountWithSignerECDSA is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerP256ERC1155Holder", "1") {␊ + constructor() EIP712("CustomAccount with SignerECDSA", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ - __UUPSUpgradeable_init();␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ }␊ + }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ - }␊ - ` - -## Account with SignerP256 with ERC721Holder and ERC1155Holder upgradeable uups - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ - ␊ - import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + contract CustomAccountWithSignerECDSAFactory {␊ + CustomAccountWithSignerECDSA public immutable implementation = new CustomAccountWithSignerECDSA();␊ ␊ - contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor()␊ - EIP712("CustomAccount with SignerP256ERC721HolderERC1155Holder", "1")␊ - {␊ - _disableInitializers();␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(signer, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerECDSA(instance).initialize(signer);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ - __UUPSUpgradeable_init();␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signer, salt));␊ }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ + function _salt(address signer, bytes32 salt) internal pure returns (bytes32) {␊ + return keccak256(abi.encode(signer, salt));␊ + }␊ }␊ ` -## Account with SignerP256 with ERC7821 Execution upgradeable uups +## Account with SignerECDSA with ERC1271 upgradeable transparent > Snapshot 1 @@ -3801,42 +4445,32 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC7821, UUPSUpgradeable {␊ + contract CustomAccountWithSignerECDSAERC1271 is Initializable, Account, IERC1271, SignerECDSAUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ - __UUPSUpgradeable_init();␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ }␊ ␊ - function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ - internal␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ view␊ override␊ - returns (bool)␊ + returns (bytes4)␊ {␊ - return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ }␊ ` -## Account with SignerP256 with ERC7579 upgradeable uups +## Account with SignerECDSA with ERC1271 upgradeable transparent with factory > Snapshot 1 @@ -3844,72 +4478,57 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerECDSAERC1271 is Initializable, Account, IERC1271, SignerECDSAUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __AccountERC7579_init();␊ - __SignerP256_init(qx, qy);␊ - __UUPSUpgradeable_init();␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ + override␊ returns (bytes4)␊ {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ + }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ + contract CustomAccountWithSignerECDSAERC1271Factory {␊ + CustomAccountWithSignerECDSAERC1271 public immutable implementation = new CustomAccountWithSignerECDSAERC1271();␊ ␊ - // The following functions are overrides required by Solidity.␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(signer, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerECDSAERC1271(instance).initialize(signer);␊ + }␊ + return instance;␊ + ␊ + }␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signer, salt));␊ }␊ ␊ - // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ + function _salt(address signer, bytes32 salt) internal pure returns (bytes32) {␊ + return keccak256(abi.encode(signer, salt));␊ }␊ }␊ ` -## Account with SignerP256 with ERC7579 with ERC1271 upgradeable uups +## Account with SignerECDSA with ERC7739 upgradeable transparent > Snapshot 1 @@ -3917,68 +4536,25 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerECDSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC7739", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __AccountERC7579_init();␊ - __SignerP256_init(qx, qy);␊ - __UUPSUpgradeable_init();␊ - }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ - ␊ - // The following functions are overrides required by Solidity.␊ - ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ - }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(IERC1271, AccountERC7579Upgradeable)␊ - returns (bytes4)␊ - {␊ - return super.isValidSignature(hash, signature);␊ - }␊ - ␊ - // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ }␊ }␊ ` -## Account with SignerP256 with ERC7579 with ERC7739 upgradeable uups +## Account with SignerECDSA with ERC7739 upgradeable transparent with factory > Snapshot 1 @@ -3986,72 +4562,49 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerECDSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC7739", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __AccountERC7579_init();␊ - __SignerP256_init(qx, qy);␊ - __UUPSUpgradeable_init();␊ - }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ - {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ }␊ + }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ + contract CustomAccountWithSignerECDSAERC7739Factory {␊ + CustomAccountWithSignerECDSAERC7739 public immutable implementation = new CustomAccountWithSignerECDSAERC7739();␊ ␊ - // The following functions are overrides required by Solidity.␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(signer, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerECDSAERC7739(instance).initialize(signer);␊ + }␊ + return instance;␊ + ␊ + }␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signer, salt));␊ }␊ ␊ - // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ + function _salt(address signer, bytes32 salt) internal pure returns (bytes32) {␊ + return keccak256(abi.encode(signer, salt));␊ }␊ }␊ ` -## Account with SignerP256 with ERC7579 hooks upgradeable uups +## Account with SignerECDSA with ERC721Holder upgradeable transparent > Snapshot 1 @@ -4059,73 +4612,26 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerECDSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC721Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __AccountERC7579Hooked_init();␊ - __SignerP256_init(qx, qy);␊ - __UUPSUpgradeable_init();␊ - }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ - {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ - }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ - ␊ - // The following functions are overrides required by Solidity.␊ - ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ - }␊ - ␊ - // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ }␊ }␊ ` -## Account with SignerP256 named upgradeable transparent +## Account with SignerECDSA with ERC721Holder upgradeable transparent with factory > Snapshot 1 @@ -4135,23 +4641,48 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerP256 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable {␊ + contract CustomAccountWithSignerECDSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerP256", "1") {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC721Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerECDSAERC721HolderFactory {␊ + CustomAccountWithSignerECDSAERC721Holder public immutable implementation = new CustomAccountWithSignerECDSAERC721Holder();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(signer, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerECDSAERC721Holder(instance).initialize(signer);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signer, salt));␊ + }␊ + ␊ + function _salt(address signer, bytes32 salt) internal pure returns (bytes32) {␊ + return keccak256(abi.encode(signer, salt));␊ }␊ }␊ ` -## Account with SignerP256 with ERC1271 upgradeable transparent +## Account with SignerECDSA with ERC1155Holder upgradeable transparent > Snapshot 1 @@ -4160,32 +4691,25 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC1271 is Initializable, Account, IERC1271, SignerP256Upgradeable {␊ + contract CustomAccountWithSignerECDSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC1155Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC1155Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ - }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override␊ - returns (bytes4)␊ - {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ }␊ }␊ ` -## Account with SignerP256 with ERC7739 upgradeable transparent +## Account with SignerECDSA with ERC1155Holder upgradeable transparent with factory > Snapshot 1 @@ -4195,23 +4719,48 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC7739 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable {␊ + contract CustomAccountWithSignerECDSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC1155Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerP256ERC7739", "1") {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC1155Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerECDSAERC1155HolderFactory {␊ + CustomAccountWithSignerECDSAERC1155Holder public immutable implementation = new CustomAccountWithSignerECDSAERC1155Holder();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(signer, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerECDSAERC1155Holder(instance).initialize(signer);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signer, salt));␊ + }␊ + ␊ + function _salt(address signer, bytes32 salt) internal pure returns (bytes32) {␊ + return keccak256(abi.encode(signer, salt));␊ }␊ }␊ ` -## Account with SignerP256 with ERC721Holder upgradeable transparent +## Account with SignerECDSA with ERC721Holder and ERC1155Holder upgradeable transparent > Snapshot 1 @@ -4221,24 +4770,27 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC721Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder {␊ + contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder, ERC1155Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerP256ERC721Holder", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerECDSAERC721HolderERC1155Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ }␊ }␊ ` -## Account with SignerP256 with ERC1155Holder upgradeable transparent +## Account with SignerECDSA with ERC721Holder and ERC1155Holder upgradeable transparent with factory > Snapshot 1 @@ -4249,23 +4801,50 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC1155Holder {␊ + contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder, ERC1155Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerP256ERC1155Holder", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerECDSAERC721HolderERC1155Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerECDSAERC721HolderERC1155HolderFactory {␊ + CustomAccountWithSignerECDSAERC721HolderERC1155Holder public immutable implementation = new CustomAccountWithSignerECDSAERC721HolderERC1155Holder();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(signer, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerECDSAERC721HolderERC1155Holder(instance).initialize(signer);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signer, salt));␊ + }␊ + ␊ + function _salt(address signer, bytes32 salt) internal pure returns (bytes32) {␊ + return keccak256(abi.encode(signer, salt));␊ }␊ }␊ ` -## Account with SignerP256 with ERC721Holder and ERC1155Holder upgradeable transparent +## Account with SignerECDSA with ERC7821 Execution upgradeable transparent > Snapshot 1 @@ -4275,27 +4854,33 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder, ERC1155Holder {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC7821 {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor()␊ - EIP712("CustomAccount with SignerP256ERC721HolderERC1155Holder", "1")␊ - {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ }␊ }␊ ` -## Account with SignerP256 with ERC7821 Execution upgradeable transparent +## Account with SignerECDSA with ERC7821 Execution upgradeable transparent with factory > Snapshot 1 @@ -4308,16 +4893,17 @@ Generated by [AVA](https://avajs.dev). import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC7821 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC7821 {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ }␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ @@ -4329,9 +4915,32 @@ Generated by [AVA](https://avajs.dev). return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ }␊ }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(signer, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signer);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signer, salt));␊ + }␊ + ␊ + function _salt(address signer, bytes32 salt) internal pure returns (bytes32) {␊ + return keccak256(abi.encode(signer, salt));␊ + }␊ + }␊ ` -## Account with SignerP256 with ERC7579 upgradeable transparent +## Account with SignerECDSA with ERC7579 upgradeable transparent > Snapshot 1 @@ -4346,17 +4955,17 @@ Generated by [AVA](https://avajs.dev). import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + function initialize(address signer) public initializer {␊ __AccountERC7579_init();␊ - __SignerP256_init(qx, qy);␊ + __SignerECDSA_init(signer);␊ }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ @@ -4381,14 +4990,14 @@ Generated by [AVA](https://avajs.dev). return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -4396,7 +5005,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerP256 with ERC7579 with ERC1271 upgradeable transparent +## Account with SignerECDSA with ERC7579 upgradeable transparent with factory > Snapshot 1 @@ -4407,20 +5016,34 @@ Generated by [AVA](https://avajs.dev). import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerP256Upgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + function initialize(address signer) public initializer {␊ __AccountERC7579_init();␊ - __SignerP256_init(qx, qy);␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ // The following functions are overrides required by Solidity.␊ @@ -4433,31 +5056,45 @@ Generated by [AVA](https://avajs.dev). return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(IERC1271, AccountERC7579Upgradeable)␊ - returns (bytes4)␊ - {␊ - return super.isValidSignature(hash, signature);␊ - }␊ - ␊ - // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ }␊ }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(signer, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signer);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signer, salt));␊ + }␊ + ␊ + function _salt(address signer, bytes32 salt) internal pure returns (bytes32) {␊ + return keccak256(abi.encode(signer, salt));␊ + }␊ + }␊ ` -## Account with SignerP256 with ERC7579 with ERC7739 upgradeable transparent +## Account with SignerECDSA with ERC7579 with ERC1271 upgradeable transparent > Snapshot 1 @@ -4468,33 +5105,82 @@ Generated by [AVA](https://avajs.dev). import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable {␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerECDSAUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + function initialize(address signer) public initializer {␊ __AccountERC7579_init();␊ - __SignerP256_init(qx, qy);␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ + override(IERC1271, AccountERC7579Upgradeable)␊ returns (bytes4)␊ {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC7579 with ERC1271 upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerECDSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ + __SignerECDSA_init(signer);␊ }␊ ␊ // The following functions are overrides required by Solidity.␊ @@ -4507,22 +5193,54 @@ Generated by [AVA](https://avajs.dev). return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ }␊ }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(signer, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signer);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signer, salt));␊ + }␊ + ␊ + function _salt(address signer, bytes32 salt) internal pure returns (bytes32) {␊ + return keccak256(abi.encode(signer, salt));␊ + }␊ + }␊ ` -## Account with SignerP256 with ERC7579 hooks upgradeable transparent +## Account with SignerECDSA with ERC7579 with ERC7739 upgradeable transparent > Snapshot 1 @@ -4533,22 +5251,21 @@ Generated by [AVA](https://avajs.dev). import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerP256Upgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __AccountERC7579Hooked_init();␊ - __SignerP256_init(qx, qy);␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ + __SignerECDSA_init(signer);␊ }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ @@ -4573,14 +5290,14 @@ Generated by [AVA](https://avajs.dev). return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -4588,7 +5305,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA named non-upgradeable +## Account with SignerECDSA with ERC7579 with ERC7739 upgradeable transparent with factory > Snapshot 1 @@ -4596,46 +5313,88 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ - ␊ - contract CustomAccountWithSignerRSA is Account, EIP712, ERC7739, SignerRSA {␊ - constructor(bytes memory e, bytes memory n)␊ - EIP712("CustomAccount with SignerRSA", "1")␊ - SignerRSA(e, n)␊ - {}␊ - }␊ - ` - -## Account with SignerRSA with ERC1271 non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ ␊ - contract CustomAccountWithSignerRSAERC1271 is Account, IERC1271, SignerRSA {␊ - constructor(bytes memory e, bytes memory n) SignerRSA(e, n) {}␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ + __SignerECDSA_init(signer);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override␊ + override(AccountERC7579Upgradeable, ERC7739)␊ returns (bytes4)␊ {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(signer, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signer);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signer, salt));␊ + }␊ + ␊ + function _salt(address signer, bytes32 salt) internal pure returns (bytes32) {␊ + return keccak256(abi.encode(signer, salt));␊ }␊ }␊ ` -## Account with SignerRSA with ERC7739 non-upgradeable +## Account with SignerECDSA with ERC7579 hooks upgradeable transparent > Snapshot 1 @@ -4643,20 +5402,65 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC7739 is Account, EIP712, ERC7739, SignerRSA {␊ - constructor(bytes memory e, bytes memory n)␊ - EIP712("CustomAccount with SignerRSAERC7739", "1")␊ - SignerRSA(e, n)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerECDSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ }␊ ` -## Account with SignerRSA with ERC721Holder non-upgradeable +## Account with SignerECDSA with ERC7579 hooks upgradeable transparent with factory > Snapshot 1 @@ -4664,21 +5468,179 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC721Holder is Account, EIP712, ERC7739, SignerRSA, ERC721Holder {␊ - constructor(bytes memory e, bytes memory n)␊ - EIP712("CustomAccount with SignerRSAERC721Holder", "1")␊ - SignerRSA(e, n)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerECDSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerECDSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerECDSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerECDSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(address signer, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(signer, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signer);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(address signer, bytes32 salt) public view returns (address) {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signer, salt));␊ + }␊ + ␊ + function _salt(address signer, bytes32 salt) internal pure returns (bytes32) {␊ + return keccak256(abi.encode(signer, salt));␊ + }␊ }␊ ` -## Account with SignerRSA with ERC1155Holder non-upgradeable +## Account with SignerP256 named non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + ␊ + contract CustomAccountWithSignerP256 is Account, EIP712, ERC7739, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy)␊ + EIP712("CustomAccount with SignerP256", "1")␊ + SignerP256(qx, qy)␊ + {}␊ + }␊ + ` + +## Account with SignerP256 with ERC1271 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC1271 is Account, IERC1271, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy) SignerP256(qx, qy) {}␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7739 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC7739 is Account, EIP712, ERC7739, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy)␊ + EIP712("CustomAccount with SignerP256ERC7739", "1")␊ + SignerP256(qx, qy)␊ + {}␊ + }␊ + ` + +## Account with SignerP256 with ERC721Holder non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC721Holder is Account, EIP712, ERC7739, SignerP256, ERC721Holder {␊ + constructor(bytes32 qx, bytes32 qy)␊ + EIP712("CustomAccount with SignerP256ERC721Holder", "1")␊ + SignerP256(qx, qy)␊ + {}␊ + }␊ + ` + +## Account with SignerP256 with ERC1155Holder non-upgradeable > Snapshot 1 @@ -4690,17 +5652,17 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC1155Holder is Account, EIP712, ERC7739, SignerRSA, ERC1155Holder {␊ - constructor(bytes memory e, bytes memory n)␊ - EIP712("CustomAccount with SignerRSAERC1155Holder", "1")␊ - SignerRSA(e, n)␊ + contract CustomAccountWithSignerP256ERC1155Holder is Account, EIP712, ERC7739, SignerP256, ERC1155Holder {␊ + constructor(bytes32 qx, bytes32 qy)␊ + EIP712("CustomAccount with SignerP256ERC1155Holder", "1")␊ + SignerP256(qx, qy)␊ {}␊ }␊ ` -## Account with SignerRSA with ERC721Holder and ERC1155Holder non-upgradeable +## Account with SignerP256 with ERC721Holder and ERC1155Holder non-upgradeable > Snapshot 1 @@ -4713,17 +5675,17 @@ Generated by [AVA](https://avajs.dev). import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerRSA, ERC721Holder, ERC1155Holder {␊ - constructor(bytes memory e, bytes memory n)␊ - EIP712("CustomAccount with SignerRSAERC721HolderERC1155Holder", "1")␊ - SignerRSA(e, n)␊ + contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerP256, ERC721Holder, ERC1155Holder {␊ + constructor(bytes32 qx, bytes32 qy)␊ + EIP712("CustomAccount with SignerP256ERC721HolderERC1155Holder", "1")␊ + SignerP256(qx, qy)␊ {}␊ }␊ ` -## Account with SignerRSA with ERC7821 Execution non-upgradeable +## Account with SignerP256 with ERC7821 Execution non-upgradeable > Snapshot 1 @@ -4735,12 +5697,12 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ - import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, SignerRSA, ERC7821 {␊ - constructor(bytes memory e, bytes memory n)␊ + contract MyAccount is Account, EIP712, ERC7739, SignerP256, ERC7821 {␊ + constructor(bytes32 qx, bytes32 qy)␊ EIP712("MyAccount", "1")␊ - SignerRSA(e, n)␊ + SignerP256(qx, qy)␊ {}␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ @@ -4754,7 +5716,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC7579 non-upgradeable +## Account with SignerP256 with ERC7579 non-upgradeable > Snapshot 1 @@ -4768,12 +5730,12 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerRSA {␊ - constructor(bytes memory e, bytes memory n)␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy)␊ EIP712("MyAccount", "1")␊ - SignerRSA(e, n)␊ + SignerP256(qx, qy)␊ {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ @@ -4798,14 +5760,14 @@ Generated by [AVA](https://avajs.dev). return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerRSA is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerRSA)␊ + // IMPORTANT: Make sure SignerP256 is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerP256)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerRSA, AbstractSigner, AccountERC7579)␊ + override(SignerP256, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -4813,7 +5775,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC7579 with ERC1271 non-upgradeable +## Account with SignerP256 with ERC7579 with ERC1271 non-upgradeable > Snapshot 1 @@ -4826,10 +5788,10 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract MyAccount is Account, IERC1271, AccountERC7579, SignerRSA {␊ - constructor(bytes memory e, bytes memory n) SignerRSA(e, n) {}␊ + contract MyAccount is Account, IERC1271, AccountERC7579, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy) SignerP256(qx, qy) {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -4850,14 +5812,14 @@ Generated by [AVA](https://avajs.dev). return super.isValidSignature(hash, signature);␊ }␊ ␊ - // IMPORTANT: Make sure SignerRSA is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerRSA)␊ + // IMPORTANT: Make sure SignerP256 is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerP256)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerRSA, AbstractSigner, AccountERC7579)␊ + override(SignerP256, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -4865,7 +5827,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC7579 with ERC7739 non-upgradeable +## Account with SignerP256 with ERC7579 with ERC7739 non-upgradeable > Snapshot 1 @@ -4879,12 +5841,12 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerRSA {␊ - constructor(bytes memory e, bytes memory n)␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy)␊ EIP712("MyAccount", "1")␊ - SignerRSA(e, n)␊ + SignerP256(qx, qy)␊ {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ @@ -4909,14 +5871,14 @@ Generated by [AVA](https://avajs.dev). return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerRSA is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerRSA)␊ + // IMPORTANT: Make sure SignerP256 is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerP256)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerRSA, AbstractSigner, AccountERC7579)␊ + override(SignerP256, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -4924,7 +5886,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC7579 hooks non-upgradeable +## Account with SignerP256 with ERC7579 hooks non-upgradeable > Snapshot 1 @@ -4939,12 +5901,12 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerRSA {␊ - constructor(bytes memory e, bytes memory n)␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy)␊ EIP712("MyAccount", "1")␊ - SignerRSA(e, n)␊ + SignerP256(qx, qy)␊ {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ @@ -4969,14 +5931,14 @@ Generated by [AVA](https://avajs.dev). return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerRSA is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerRSA)␊ + // IMPORTANT: Make sure SignerP256 is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerP256)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerRSA, AbstractSigner, AccountERC7579)␊ + override(SignerP256, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -4984,7 +5946,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA named upgradeable uups +## Account with SignerP256 named upgradeable uups > Snapshot 1 @@ -4996,17 +5958,17 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerRSA is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerP256 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerRSA", "1") {␊ + constructor() EIP712("CustomAccount with SignerP256", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ __UUPSUpgradeable_init();␊ }␊ ␊ @@ -5018,7 +5980,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC1271 upgradeable uups +## Account with SignerP256 named upgradeable uups with factory > Snapshot 1 @@ -5027,19 +5989,85 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC1271 is Initializable, Account, IERC1271, SignerRSAUpgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerP256 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerP256", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerP256Factory {␊ + CustomAccountWithSignerP256 public immutable implementation = new CustomAccountWithSignerP256();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerP256.initialize, (qx, qy));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerP256.initialize, (qx, qy)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC1271 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC1271 is Initializable, Account, IERC1271, SignerP256Upgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ __UUPSUpgradeable_init();␊ }␊ ␊ @@ -5060,7 +6088,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC7739 upgradeable uups +## Account with SignerP256 with ERC1271 upgradeable uups with factory > Snapshot 1 @@ -5069,22 +6097,32 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerP256ERC1271 is Initializable, Account, IERC1271, SignerP256Upgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerRSAERC7739", "1") {␊ + constructor() {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ __UUPSUpgradeable_init();␊ }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ @@ -5092,9 +6130,39 @@ Generated by [AVA](https://avajs.dev). onlyEntryPointOrSelf␊ {}␊ }␊ + ␊ + contract CustomAccountWithSignerP256ERC1271Factory {␊ + CustomAccountWithSignerP256ERC1271 public immutable implementation = new CustomAccountWithSignerP256ERC1271();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerP256ERC1271.initialize, (qx, qy));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerP256ERC1271.initialize, (qx, qy)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ ` -## Account with SignerRSA with ERC721Holder upgradeable uups +## Account with SignerP256 with ERC7739 upgradeable uups > Snapshot 1 @@ -5104,20 +6172,19 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder, UUPSUpgradeable {␊ + contract CustomAccountWithSignerP256ERC7739 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerRSAERC721Holder", "1") {␊ + constructor() EIP712("CustomAccount with SignerP256ERC7739", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ __UUPSUpgradeable_init();␊ }␊ ␊ @@ -5129,7 +6196,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC1155Holder upgradeable uups +## Account with SignerP256 with ERC7739 upgradeable uups with factory > Snapshot 1 @@ -5139,20 +6206,21 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC1155Holder, UUPSUpgradeable {␊ + contract CustomAccountWithSignerP256ERC7739 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerRSAERC1155Holder", "1") {␊ + constructor() EIP712("CustomAccount with SignerP256ERC7739", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ __UUPSUpgradeable_init();␊ }␊ ␊ @@ -5162,9 +6230,39 @@ Generated by [AVA](https://avajs.dev). onlyEntryPointOrSelf␊ {}␊ }␊ + ␊ + contract CustomAccountWithSignerP256ERC7739Factory {␊ + CustomAccountWithSignerP256ERC7739 public immutable implementation = new CustomAccountWithSignerP256ERC7739();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerP256ERC7739.initialize, (qx, qy));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerP256ERC7739.initialize, (qx, qy)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ ` -## Account with SignerRSA with ERC721Holder and ERC1155Holder upgradeable uups +## Account with SignerP256 with ERC721Holder upgradeable uups > Snapshot 1 @@ -5174,23 +6272,20 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + contract CustomAccountWithSignerP256ERC721Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor()␊ - EIP712("CustomAccount with SignerRSAERC721HolderERC1155Holder", "1")␊ - {␊ + constructor() EIP712("CustomAccount with SignerP256ERC721Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ __UUPSUpgradeable_init();␊ }␊ ␊ @@ -5202,7 +6297,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC7821 Execution upgradeable uups +## Account with SignerP256 with ERC721Holder upgradeable uups with factory > Snapshot 1 @@ -5212,30 +6307,88 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC7821, UUPSUpgradeable {␊ + contract CustomAccountWithSignerP256ERC721Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() EIP712("CustomAccount with SignerP256ERC721Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ __UUPSUpgradeable_init();␊ }␊ ␊ - function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + function _authorizeUpgrade(address newImplementation)␊ internal␊ - view␊ override␊ - returns (bool)␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerP256ERC721HolderFactory {␊ + CustomAccountWithSignerP256ERC721Holder public immutable implementation = new CustomAccountWithSignerP256ERC721Holder();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerP256ERC721Holder.initialize, (qx, qy));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ {␊ - return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerP256ERC721Holder.initialize, (qx, qy)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC1155Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC1155Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerP256ERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -5246,7 +6399,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC7579 upgradeable uups +## Account with SignerP256 with ERC1155Holder upgradeable uups with factory > Snapshot 1 @@ -5254,72 +6407,66 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerP256ERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC1155Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() EIP712("CustomAccount with SignerP256ERC1155Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __AccountERC7579_init();␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ __UUPSUpgradeable_init();␊ }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ - {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ - }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ override␊ onlyEntryPointOrSelf␊ {}␊ + }␊ ␊ - // The following functions are overrides required by Solidity.␊ + contract CustomAccountWithSignerP256ERC1155HolderFactory {␊ + CustomAccountWithSignerP256ERC1155Holder public immutable implementation = new CustomAccountWithSignerP256ERC1155Holder();␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerP256ERC1155Holder.initialize, (qx, qy));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ {␊ - return super._validateUserOp(userOp, userOpHash);␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerP256ERC1155Holder.initialize, (qx, qy)));␊ }␊ ␊ - // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function _predict(bytes32 salt, bytes memory initcall)␊ internal␊ view␊ - override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ + returns (address)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerRSA with ERC7579 with ERC1271 upgradeable uups +## Account with SignerP256 with ERC721Holder and ERC1155Holder upgradeable uups > Snapshot 1 @@ -5327,68 +6474,8004 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor()␊ + EIP712("CustomAccount with SignerP256ERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerP256 with ERC721Holder and ERC1155Holder upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor()␊ + EIP712("CustomAccount with SignerP256ERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerP256ERC721HolderERC1155HolderFactory {␊ + CustomAccountWithSignerP256ERC721HolderERC1155Holder public immutable implementation = new CustomAccountWithSignerP256ERC721HolderERC1155Holder();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerP256ERC721HolderERC1155Holder.initialize, (qx, qy));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerP256ERC721HolderERC1155Holder.initialize, (qx, qy)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7821 Execution upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC7821, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerP256 with ERC7821 Execution upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC7821, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (qx, qy));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (qx, qy)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ __AccountERC7579_init();␊ - __SignerRSA_init(e, n);␊ + __SignerP256_init(qx, qy);␊ __UUPSUpgradeable_init();␊ }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (qx, qy));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (qx, qy)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC1271 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC1271 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (qx, qy));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (qx, qy)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC7739 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC7739 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (qx, qy));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (qx, qy)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 hooks upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 hooks upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (qx, qy));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (qx, qy)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerP256 named upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerP256 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerP256", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ` + +## Account with SignerP256 named upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerP256 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerP256", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerP256Factory {␊ + CustomAccountWithSignerP256 public immutable implementation = new CustomAccountWithSignerP256();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(qx, qy, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerP256(instance).initialize(qx, qy);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(qx, qy, salt));␊ + }␊ + ␊ + function _salt(bytes32 qx, bytes32 qy, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(qx, qy, salt));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC1271 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC1271 is Initializable, Account, IERC1271, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC1271 upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC1271 is Initializable, Account, IERC1271, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerP256ERC1271Factory {␊ + CustomAccountWithSignerP256ERC1271 public immutable implementation = new CustomAccountWithSignerP256ERC1271();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(qx, qy, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerP256ERC1271(instance).initialize(qx, qy);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(qx, qy, salt));␊ + }␊ + ␊ + function _salt(bytes32 qx, bytes32 qy, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(qx, qy, salt));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7739 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC7739 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerP256ERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7739 upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC7739 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerP256ERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerP256ERC7739Factory {␊ + CustomAccountWithSignerP256ERC7739 public immutable implementation = new CustomAccountWithSignerP256ERC7739();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(qx, qy, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerP256ERC7739(instance).initialize(qx, qy);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(qx, qy, salt));␊ + }␊ + ␊ + function _salt(bytes32 qx, bytes32 qy, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(qx, qy, salt));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC721Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC721Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerP256ERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC721Holder upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC721Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerP256ERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerP256ERC721HolderFactory {␊ + CustomAccountWithSignerP256ERC721Holder public immutable implementation = new CustomAccountWithSignerP256ERC721Holder();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(qx, qy, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerP256ERC721Holder(instance).initialize(qx, qy);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(qx, qy, salt));␊ + }␊ + ␊ + function _salt(bytes32 qx, bytes32 qy, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(qx, qy, salt));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC1155Holder {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerP256ERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC1155Holder upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC1155Holder {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerP256ERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerP256ERC1155HolderFactory {␊ + CustomAccountWithSignerP256ERC1155Holder public immutable implementation = new CustomAccountWithSignerP256ERC1155Holder();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(qx, qy, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerP256ERC1155Holder(instance).initialize(qx, qy);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(qx, qy, salt));␊ + }␊ + ␊ + function _salt(bytes32 qx, bytes32 qy, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(qx, qy, salt));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC721Holder and ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder, ERC1155Holder {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor()␊ + EIP712("CustomAccount with SignerP256ERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC721Holder and ERC1155Holder upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder, ERC1155Holder {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor()␊ + EIP712("CustomAccount with SignerP256ERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerP256ERC721HolderERC1155HolderFactory {␊ + CustomAccountWithSignerP256ERC721HolderERC1155Holder public immutable implementation = new CustomAccountWithSignerP256ERC721HolderERC1155Holder();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(qx, qy, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerP256ERC721HolderERC1155Holder(instance).initialize(qx, qy);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(qx, qy, salt));␊ + }␊ + ␊ + function _salt(bytes32 qx, bytes32 qy, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(qx, qy, salt));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7821 Execution upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC7821 {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7821 Execution upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC7821 {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(qx, qy, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(qx, qy);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(qx, qy, salt));␊ + }␊ + ␊ + function _salt(bytes32 qx, bytes32 qy, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(qx, qy, salt));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(qx, qy, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(qx, qy);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(qx, qy, salt));␊ + }␊ + ␊ + function _salt(bytes32 qx, bytes32 qy, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(qx, qy, salt));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC1271 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC1271 upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(qx, qy, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(qx, qy);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(qx, qy, salt));␊ + }␊ + ␊ + function _salt(bytes32 qx, bytes32 qy, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(qx, qy, salt));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC7739 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC7739 upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(qx, qy, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(qx, qy);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(qx, qy, salt));␊ + }␊ + ␊ + function _salt(bytes32 qx, bytes32 qy, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(qx, qy, salt));␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 hooks upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 hooks upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerP256Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerP256Upgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerP256Upgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerP256Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes32 qx, bytes32 qy, bytes32 salt) public returns (address) {␊ + bytes32 effectiveSalt = _salt(qx, qy, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(qx, qy);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes32 qx, bytes32 qy, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(qx, qy, salt));␊ + }␊ + ␊ + function _salt(bytes32 qx, bytes32 qy, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(qx, qy, salt));␊ + }␊ + }␊ + ` + +## Account with SignerRSA named non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + ␊ + contract CustomAccountWithSignerRSA is Account, EIP712, ERC7739, SignerRSA {␊ + constructor(bytes memory e, bytes memory n)␊ + EIP712("CustomAccount with SignerRSA", "1")␊ + SignerRSA(e, n)␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC1271 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC1271 is Account, IERC1271, SignerRSA {␊ + constructor(bytes memory e, bytes memory n) SignerRSA(e, n) {}␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7739 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC7739 is Account, EIP712, ERC7739, SignerRSA {␊ + constructor(bytes memory e, bytes memory n)␊ + EIP712("CustomAccount with SignerRSAERC7739", "1")␊ + SignerRSA(e, n)␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC721Holder non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC721Holder is Account, EIP712, ERC7739, SignerRSA, ERC721Holder {␊ + constructor(bytes memory e, bytes memory n)␊ + EIP712("CustomAccount with SignerRSAERC721Holder", "1")␊ + SignerRSA(e, n)␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC1155Holder non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC1155Holder is Account, EIP712, ERC7739, SignerRSA, ERC1155Holder {␊ + constructor(bytes memory e, bytes memory n)␊ + EIP712("CustomAccount with SignerRSAERC1155Holder", "1")␊ + SignerRSA(e, n)␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC721Holder and ERC1155Holder non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerRSA, ERC721Holder, ERC1155Holder {␊ + constructor(bytes memory e, bytes memory n)␊ + EIP712("CustomAccount with SignerRSAERC721HolderERC1155Holder", "1")␊ + SignerRSA(e, n)␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC7821 Execution non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + ␊ + contract MyAccount is Account, EIP712, ERC7739, SignerRSA, ERC7821 {␊ + constructor(bytes memory e, bytes memory n)␊ + EIP712("MyAccount", "1")␊ + SignerRSA(e, n)␊ + {}␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + ␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerRSA {␊ + constructor(bytes memory e, bytes memory n)␊ + EIP712("MyAccount", "1")␊ + SignerRSA(e, n)␊ + {}␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerRSA)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSA, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 with ERC1271 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + ␊ + contract MyAccount is Account, IERC1271, AccountERC7579, SignerRSA {␊ + constructor(bytes memory e, bytes memory n) SignerRSA(e, n) {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerRSA)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSA, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 with ERC7739 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + ␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerRSA {␊ + constructor(bytes memory e, bytes memory n)␊ + EIP712("MyAccount", "1")␊ + SignerRSA(e, n)␊ + {}␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerRSA)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSA, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 hooks non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + ␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerRSA {␊ + constructor(bytes memory e, bytes memory n)␊ + EIP712("MyAccount", "1")␊ + SignerRSA(e, n)␊ + {}␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerRSA)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSA, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerRSA named upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerRSA is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSA", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA named upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract CustomAccountWithSignerRSA is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSA", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerRSAFactory {␊ + CustomAccountWithSignerRSA public immutable implementation = new CustomAccountWithSignerRSA();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerRSA.initialize, (e, n));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerRSA.initialize, (e, n)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC1271 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC1271 is Initializable, Account, IERC1271, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC1271 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC1271 is Initializable, Account, IERC1271, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerRSAERC1271Factory {␊ + CustomAccountWithSignerRSAERC1271 public immutable implementation = new CustomAccountWithSignerRSAERC1271();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerRSAERC1271.initialize, (e, n));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerRSAERC1271.initialize, (e, n)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7739 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSAERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC7739 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSAERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerRSAERC7739Factory {␊ + CustomAccountWithSignerRSAERC7739 public immutable implementation = new CustomAccountWithSignerRSAERC7739();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerRSAERC7739.initialize, (e, n));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerRSAERC7739.initialize, (e, n)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC721Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSAERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC721Holder upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSAERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerRSAERC721HolderFactory {␊ + CustomAccountWithSignerRSAERC721Holder public immutable implementation = new CustomAccountWithSignerRSAERC721Holder();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerRSAERC721Holder.initialize, (e, n));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerRSAERC721Holder.initialize, (e, n)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC1155Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC1155Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSAERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC1155Holder upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC1155Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSAERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerRSAERC1155HolderFactory {␊ + CustomAccountWithSignerRSAERC1155Holder public immutable implementation = new CustomAccountWithSignerRSAERC1155Holder();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerRSAERC1155Holder.initialize, (e, n));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerRSAERC1155Holder.initialize, (e, n)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC721Holder and ERC1155Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor()␊ + EIP712("CustomAccount with SignerRSAERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC721Holder and ERC1155Holder upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor()␊ + EIP712("CustomAccount with SignerRSAERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerRSAERC721HolderERC1155HolderFactory {␊ + CustomAccountWithSignerRSAERC721HolderERC1155Holder public immutable implementation = new CustomAccountWithSignerRSAERC721HolderERC1155Holder();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerRSAERC721HolderERC1155Holder.initialize, (e, n));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerRSAERC721HolderERC1155Holder.initialize, (e, n)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7821 Execution upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC7821, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC7821 Execution upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC7821, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (e, n));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (e, n)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (e, n));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (e, n)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 with ERC1271 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 with ERC1271 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (e, n));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (e, n)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 with ERC7739 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 with ERC7739 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (e, n));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (e, n)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 hooks upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 hooks upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (e, n));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (e, n)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerRSA named upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerRSA is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSA", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + }␊ + ` + +## Account with SignerRSA named upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerRSA is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSA", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerRSAFactory {␊ + CustomAccountWithSignerRSA public immutable implementation = new CustomAccountWithSignerRSA();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(e, n, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerRSA(instance).initialize(e, n);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(e, n, salt));␊ + }␊ + ␊ + function _salt(bytes memory e, bytes memory n, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(e, n, salt));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC1271 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC1271 is Initializable, Account, IERC1271, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC1271 upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC1271 is Initializable, Account, IERC1271, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerRSAERC1271Factory {␊ + CustomAccountWithSignerRSAERC1271 public immutable implementation = new CustomAccountWithSignerRSAERC1271();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(e, n, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerRSAERC1271(instance).initialize(e, n);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(e, n, salt));␊ + }␊ + ␊ + function _salt(bytes memory e, bytes memory n, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(e, n, salt));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7739 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSAERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7739 upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSAERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerRSAERC7739Factory {␊ + CustomAccountWithSignerRSAERC7739 public immutable implementation = new CustomAccountWithSignerRSAERC7739();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(e, n, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerRSAERC7739(instance).initialize(e, n);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(e, n, salt));␊ + }␊ + ␊ + function _salt(bytes memory e, bytes memory n, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(e, n, salt));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC721Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSAERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC721Holder upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSAERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerRSAERC721HolderFactory {␊ + CustomAccountWithSignerRSAERC721Holder public immutable implementation = new CustomAccountWithSignerRSAERC721Holder();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(e, n, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerRSAERC721Holder(instance).initialize(e, n);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(e, n, salt));␊ + }␊ + ␊ + function _salt(bytes memory e, bytes memory n, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(e, n, salt));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC1155Holder {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSAERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC1155Holder upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC1155Holder {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerRSAERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerRSAERC1155HolderFactory {␊ + CustomAccountWithSignerRSAERC1155Holder public immutable implementation = new CustomAccountWithSignerRSAERC1155Holder();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(e, n, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerRSAERC1155Holder(instance).initialize(e, n);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(e, n, salt));␊ + }␊ + ␊ + function _salt(bytes memory e, bytes memory n, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(e, n, salt));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC721Holder and ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder, ERC1155Holder {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor()␊ + EIP712("CustomAccount with SignerRSAERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC721Holder and ERC1155Holder upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder, ERC1155Holder {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor()␊ + EIP712("CustomAccount with SignerRSAERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerRSAERC721HolderERC1155HolderFactory {␊ + CustomAccountWithSignerRSAERC721HolderERC1155Holder public immutable implementation = new CustomAccountWithSignerRSAERC721HolderERC1155Holder();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(e, n, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerRSAERC721HolderERC1155Holder(instance).initialize(e, n);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(e, n, salt));␊ + }␊ + ␊ + function _salt(bytes memory e, bytes memory n, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(e, n, salt));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7821 Execution upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC7821 {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7821 Execution upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC7821 {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(e, n, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(e, n);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(e, n, salt));␊ + }␊ + ␊ + function _salt(bytes memory e, bytes memory n, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(e, n, salt));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(e, n, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(e, n);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(e, n, salt));␊ + }␊ + ␊ + function _salt(bytes memory e, bytes memory n, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(e, n, salt));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 with ERC1271 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 with ERC1271 upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(e, n, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(e, n);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(e, n, salt));␊ + }␊ + ␊ + function _salt(bytes memory e, bytes memory n, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(e, n, salt));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 with ERC7739 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 with ERC7739 upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(e, n, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(e, n);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(e, n, salt));␊ + }␊ + ␊ + function _salt(bytes memory e, bytes memory n, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(e, n, salt));␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 hooks upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 hooks upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerRSAUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(e, n, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(e, n);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes memory e, bytes memory n, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(e, n, salt));␊ + }␊ + ␊ + function _salt(bytes memory e, bytes memory n, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(e, n, salt));␊ + }␊ + }␊ + ` + +## Account with SignerMultisig named non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + ␊ + contract CustomAccountWithSignerMultisig is Account, EIP712, ERC7739, MultiSignerERC7913 {␊ + constructor(bytes[] memory signers, uint64 threshold)␊ + EIP712("CustomAccount with SignerMultisig", "1")␊ + MultiSignerERC7913(signers, threshold)␊ + {}␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC1271 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC1271 is Account, IERC1271, MultiSignerERC7913 {␊ + constructor(bytes[] memory signers, uint64 threshold)␊ + MultiSignerERC7913(signers, threshold)␊ + {}␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7739 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC7739 is Account, EIP712, ERC7739, MultiSignerERC7913 {␊ + constructor(bytes[] memory signers, uint64 threshold)␊ + EIP712("CustomAccount with SignerMultisigERC7739", "1")␊ + MultiSignerERC7913(signers, threshold)␊ + {}␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC721Holder non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC721Holder is Account, EIP712, ERC7739, MultiSignerERC7913, ERC721Holder {␊ + constructor(bytes[] memory signers, uint64 threshold)␊ + EIP712("CustomAccount with SignerMultisigERC721Holder", "1")␊ + MultiSignerERC7913(signers, threshold)␊ + {}␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC1155Holder non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC1155Holder is Account, EIP712, ERC7739, MultiSignerERC7913, ERC1155Holder {␊ + constructor(bytes[] memory signers, uint64 threshold)␊ + EIP712("CustomAccount with SignerMultisigERC1155Holder", "1")␊ + MultiSignerERC7913(signers, threshold)␊ + {}␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC721Holder and ERC1155Holder non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC721HolderERC1155Holder is Account, EIP712, ERC7739, MultiSignerERC7913, ERC721Holder, ERC1155Holder {␊ + constructor(bytes[] memory signers, uint64 threshold)␊ + EIP712("CustomAccount with SignerMultisigERC721HolderERC1155Holder", "1")␊ + MultiSignerERC7913(signers, threshold)␊ + {}␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7821 Execution non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + ␊ + contract MyAccount is Account, EIP712, ERC7739, MultiSignerERC7913, ERC7821 {␊ + constructor(bytes[] memory signers, uint64 threshold)␊ + EIP712("MyAccount", "1")␊ + MultiSignerERC7913(signers, threshold)␊ + {}␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7579 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + ␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913 {␊ + constructor(bytes[] memory signers, uint64 threshold)␊ + EIP712("MyAccount", "1")␊ + MultiSignerERC7913(signers, threshold)␊ + {}␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisig is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisig)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7579 with ERC1271 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + ␊ + contract MyAccount is Account, IERC1271, AccountERC7579, MultiSignerERC7913 {␊ + constructor(bytes[] memory signers, uint64 threshold)␊ + MultiSignerERC7913(signers, threshold)␊ + {}␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisig is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisig)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7579 with ERC7739 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + ␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913 {␊ + constructor(bytes[] memory signers, uint64 threshold)␊ + EIP712("MyAccount", "1")␊ + MultiSignerERC7913(signers, threshold)␊ + {}␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisig is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisig)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7579 hooks non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + ␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, MultiSignerERC7913 {␊ + constructor(bytes[] memory signers, uint64 threshold)␊ + EIP712("MyAccount", "1")␊ + MultiSignerERC7913(signers, threshold)␊ + {}␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisig is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisig)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig named upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerMultisig is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerMultisig", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerMultisig named upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract CustomAccountWithSignerMultisig is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerMultisig", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigFactory {␊ + CustomAccountWithSignerMultisig public immutable implementation = new CustomAccountWithSignerMultisig();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerMultisig.initialize, (signers, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerMultisig.initialize, (signers, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC1271 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerMultisig with ERC1271 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigERC1271Factory {␊ + CustomAccountWithSignerMultisigERC1271 public immutable implementation = new CustomAccountWithSignerMultisigERC1271();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerMultisigERC1271.initialize, (signers, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerMultisigERC1271.initialize, (signers, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7739 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerMultisigERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerMultisig with ERC7739 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerMultisigERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigERC7739Factory {␊ + CustomAccountWithSignerMultisigERC7739 public immutable implementation = new CustomAccountWithSignerMultisigERC7739();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerMultisigERC7739.initialize, (signers, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerMultisigERC7739.initialize, (signers, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC721Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerMultisigERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerMultisig with ERC721Holder upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerMultisigERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigERC721HolderFactory {␊ + CustomAccountWithSignerMultisigERC721Holder public immutable implementation = new CustomAccountWithSignerMultisigERC721Holder();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerMultisigERC721Holder.initialize, (signers, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerMultisigERC721Holder.initialize, (signers, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC1155Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC1155Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerMultisigERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerMultisig with ERC1155Holder upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC1155Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerMultisigERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigERC1155HolderFactory {␊ + CustomAccountWithSignerMultisigERC1155Holder public immutable implementation = new CustomAccountWithSignerMultisigERC1155Holder();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerMultisigERC1155Holder.initialize, (signers, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerMultisigERC1155Holder.initialize, (signers, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC721Holder and ERC1155Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerMultisig with ERC721Holder and ERC1155Holder upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigERC721HolderERC1155HolderFactory {␊ + CustomAccountWithSignerMultisigERC721HolderERC1155Holder public immutable implementation = new CustomAccountWithSignerMultisigERC721HolderERC1155Holder();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerMultisigERC721HolderERC1155Holder.initialize, (signers, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerMultisigERC721HolderERC1155Holder.initialize, (signers, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7821 Execution upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC7821, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerMultisig with ERC7821 Execution upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC7821, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signers, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signers, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7579 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7579 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signers, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signers, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7579 with ERC1271 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7579 with ERC1271 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signers, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signers, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7579 with ERC7739 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7579 with ERC7739 upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signers, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signers, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7579 hooks upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579Hooked_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7579 hooks upgradeable uups with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579Hooked_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signers, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signers, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ + ` + +## Account with SignerMultisig named upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerMultisig is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerMultisig", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig named upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerMultisig is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("CustomAccount with SignerMultisig", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigFactory {␊ + CustomAccountWithSignerMultisig public immutable implementation = new CustomAccountWithSignerMultisig();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerMultisig(instance).initialize(signers, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, threshold, salt));␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC1271 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC1271 upgradeable transparent with factory + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.4.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ ␊ - // The following functions are overrides required by Solidity.␊ + contract CustomAccountWithSignerMultisigERC1271Factory {␊ + CustomAccountWithSignerMultisigERC1271 public immutable implementation = new CustomAccountWithSignerMultisigERC1271();␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ {␊ - return super._validateUserOp(userOp, userOpHash);␊ + bytes32 effectiveSalt = _salt(signers, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerMultisigERC1271(instance).initialize(signers, threshold);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ public␊ view␊ - override(IERC1271, AccountERC7579Upgradeable)␊ - returns (bytes4)␊ + returns (address)␊ {␊ - return super.isValidSignature(hash, signature);␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, threshold, salt));␊ }␊ ␊ - // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function _salt(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ internal␊ - view␊ - override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ + pure␊ + returns (bytes32)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return keccak256(abi.encode(signers, threshold, salt));␊ }␊ }␊ ` -## Account with SignerRSA with ERC7579 with ERC7739 upgradeable uups +## Account with SignerMultisig with ERC7739 upgradeable transparent > Snapshot 1 @@ -5396,72 +14479,40 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() EIP712("CustomAccount with SignerMultisigERC7739", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __AccountERC7579_init();␊ - __SignerRSA_init(e, n);␊ - __UUPSUpgradeable_init();␊ - }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ + initializer␊ {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + __MultiSignerERC7913_init(signers, threshold);␊ }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ - ␊ - // The following functions are overrides required by Solidity.␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ }␊ ␊ - // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ }␊ }␊ ` -## Account with SignerRSA with ERC7579 hooks upgradeable uups +## Account with SignerMultisig with ERC7739 upgradeable transparent with factory > Snapshot 1 @@ -5469,73 +14520,75 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() EIP712("CustomAccount with SignerMultisigERC7739", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __AccountERC7579Hooked_init();␊ - __SignerRSA_init(e, n);␊ - __UUPSUpgradeable_init();␊ - }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ + initializer␊ {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + __MultiSignerERC7913_init(signers, threshold);␊ }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ ␊ - // The following functions are overrides required by Solidity.␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigERC7739Factory {␊ + CustomAccountWithSignerMultisigERC7739 public immutable implementation = new CustomAccountWithSignerMultisigERC7739();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ {␊ - return super._validateUserOp(userOp, userOpHash);␊ + bytes32 effectiveSalt = _salt(signers, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerMultisigERC7739(instance).initialize(signers, threshold);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ view␊ - override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ + returns (address)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, threshold, salt));␊ }␊ }␊ ` -## Account with SignerRSA named upgradeable transparent +## Account with SignerMultisig with ERC721Holder upgradeable transparent > Snapshot 1 @@ -5545,23 +14598,39 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ ␊ - contract CustomAccountWithSignerRSA is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable {␊ + contract CustomAccountWithSignerMultisigERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerRSA", "1") {␊ + constructor() EIP712("CustomAccount with SignerMultisigERC721Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ }␊ }␊ ` -## Account with SignerRSA with ERC1271 upgradeable transparent +## Account with SignerMultisig with ERC721Holder upgradeable transparent with factory > Snapshot 1 @@ -5570,32 +14639,75 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC1271 is Initializable, Account, IERC1271, SignerRSAUpgradeable {␊ + contract CustomAccountWithSignerMultisigERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor() EIP712("CustomAccount with SignerMultisigERC721Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigERC721HolderFactory {␊ + CustomAccountWithSignerMultisigERC721Holder public immutable implementation = new CustomAccountWithSignerMultisigERC721Holder();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerMultisigERC721Holder(instance).initialize(signers, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ public␊ view␊ - override␊ - returns (bytes4)␊ + returns (address)␊ {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, threshold, salt));␊ }␊ }␊ ` -## Account with SignerRSA with ERC7739 upgradeable transparent +## Account with SignerMultisig with ERC1155Holder upgradeable transparent > Snapshot 1 @@ -5605,23 +14717,39 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable {␊ + contract CustomAccountWithSignerMultisigERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC1155Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerRSAERC7739", "1") {␊ + constructor() EIP712("CustomAccount with SignerMultisigERC1155Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ }␊ }␊ ` -## Account with SignerRSA with ERC721Holder upgradeable transparent +## Account with SignerMultisig with ERC1155Holder upgradeable transparent with factory > Snapshot 1 @@ -5631,24 +14759,74 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder {␊ + contract CustomAccountWithSignerMultisigERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC1155Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerRSAERC721Holder", "1") {␊ + constructor() EIP712("CustomAccount with SignerMultisigERC1155Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigERC1155HolderFactory {␊ + CustomAccountWithSignerMultisigERC1155Holder public immutable implementation = new CustomAccountWithSignerMultisigERC1155Holder();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerMultisigERC1155Holder(instance).initialize(signers, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, threshold, salt));␊ }␊ }␊ ` -## Account with SignerRSA with ERC1155Holder upgradeable transparent +## Account with SignerMultisig with ERC721Holder and ERC1155Holder upgradeable transparent > Snapshot 1 @@ -5659,23 +14837,41 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC1155Holder {␊ + contract CustomAccountWithSignerMultisigERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder, ERC1155Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerRSAERC1155Holder", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigERC721HolderERC1155Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ }␊ }␊ ` -## Account with SignerRSA with ERC721Holder and ERC1155Holder upgradeable transparent +## Account with SignerMultisig with ERC721Holder and ERC1155Holder upgradeable transparent with factory > Snapshot 1 @@ -5689,23 +14885,73 @@ Generated by [AVA](https://avajs.dev). import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder, ERC1155Holder {␊ + contract CustomAccountWithSignerMultisigERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder, ERC1155Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor()␊ - EIP712("CustomAccount with SignerRSAERC721HolderERC1155Holder", "1")␊ + EIP712("CustomAccount with SignerMultisigERC721HolderERC1155Holder", "1")␊ {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigERC721HolderERC1155HolderFactory {␊ + CustomAccountWithSignerMultisigERC721HolderERC1155Holder public immutable implementation = new CustomAccountWithSignerMultisigERC721HolderERC1155Holder();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerMultisigERC721HolderERC1155Holder(instance).initialize(signers, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, threshold, salt));␊ }␊ }␊ ` -## Account with SignerRSA with ERC7821 Execution upgradeable transparent +## Account with SignerMultisig with ERC7821 Execution upgradeable transparent > Snapshot 1 @@ -5718,16 +14964,31 @@ Generated by [AVA](https://avajs.dev). import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC7821 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC7821 {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ }␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ @@ -5741,7 +15002,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC7579 upgradeable transparent +## Account with SignerMultisig with ERC7821 Execution upgradeable transparent with factory > Snapshot 1 @@ -5749,125 +15010,85 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC7821 {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __AccountERC7579_init();␊ - __SignerRSA_init(e, n);␊ - }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ + initializer␊ {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + __MultiSignerERC7913_init(signers, threshold);␊ }␊ ␊ - // The following functions are overrides required by Solidity.␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ }␊ ␊ - // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ internal␊ view␊ - override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + override␊ returns (bool)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ }␊ }␊ - ` - -## Account with SignerRSA with ERC7579 with ERC1271 upgradeable transparent - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ - ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ - ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, SignerRSAUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __AccountERC7579_init();␊ - __SignerRSA_init(e, n);␊ - }␊ ␊ - // The following functions are overrides required by Solidity.␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ {␊ - return super._validateUserOp(userOp, userOpHash);␊ + bytes32 effectiveSalt = _salt(signers, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signers, threshold);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ public␊ view␊ - override(IERC1271, AccountERC7579Upgradeable)␊ - returns (bytes4)␊ + returns (address)␊ {␊ - return super.isValidSignature(hash, signature);␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, threshold, salt));␊ }␊ ␊ - // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function _salt(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ internal␊ - view␊ - override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ + pure␊ + returns (bytes32)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return keccak256(abi.encode(signers, threshold, salt));␊ }␊ }␊ ` -## Account with SignerRSA with ERC7579 with ERC7739 upgradeable transparent +## Account with SignerMultisig with ERC7579 upgradeable transparent > Snapshot 1 @@ -5881,18 +15102,21 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ __AccountERC7579_init();␊ - __SignerRSA_init(e, n);␊ + __MultiSignerERC7913_init(signers, threshold);␊ }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ @@ -5906,6 +15130,18 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -5917,14 +15153,14 @@ Generated by [AVA](https://avajs.dev). return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -5932,7 +15168,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC7579 hooks upgradeable transparent +## Account with SignerMultisig with ERC7579 upgradeable transparent with factory > Snapshot 1 @@ -5943,22 +15179,25 @@ Generated by [AVA](https://avajs.dev). import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerRSAUpgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __AccountERC7579Hooked_init();␊ - __SignerRSA_init(e, n);␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ @@ -5972,6 +15211,18 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ + }␊ + ␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ + }␊ + ␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -5983,55 +15234,56 @@ Generated by [AVA](https://avajs.dev). return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerRSAUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerRSAUpgradeable)␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ // to ensure the correct order of function resolution.␊ // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(SignerRSAUpgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ }␊ }␊ - ` - -## Account with SignerMultisig named non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ - ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ ␊ - contract CustomAccountWithSignerMultisig is Account, EIP712, ERC7739, MultiSignerERC7913 {␊ - constructor(bytes[] memory signers, uint64 threshold)␊ - EIP712("CustomAccount with SignerMultisig", "1")␊ - MultiSignerERC7913(signers, threshold)␊ - {}␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ ␊ - function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ - _addSigners(signers);␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signers, threshold);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ - _removeSigners(signers);␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, threshold, salt));␊ }␊ ␊ - function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ - _setThreshold(threshold);␊ + function _salt(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, threshold, salt));␊ }␊ }␊ ` -## Account with SignerMultisig with ERC1271 non-upgradeable +## Account with SignerMultisig with ERC7579 with ERC1271 upgradeable transparent > Snapshot 1 @@ -6039,22 +15291,26 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC1271 is Account, IERC1271, MultiSignerERC7913 {␊ - constructor(bytes[] memory signers, uint64 threshold)␊ - MultiSignerERC7913(signers, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ public␊ - view␊ - override␊ - returns (bytes4)␊ + initializer␊ {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6068,10 +15324,42 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ }␊ ` -## Account with SignerMultisig with ERC7739 non-upgradeable +## Account with SignerMultisig with ERC7579 with ERC1271 upgradeable transparent with factory > Snapshot 1 @@ -6079,16 +15367,28 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC7739 is Account, EIP712, ERC7739, MultiSignerERC7913 {␊ - constructor(bytes[] memory signers, uint64 threshold)␊ - EIP712("CustomAccount with SignerMultisigERC7739", "1")␊ - MultiSignerERC7913(signers, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6101,44 +15401,76 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - }␊ - ` - -## Account with SignerMultisig with ERC721Holder non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + // The following functions are overrides required by Solidity.␊ ␊ - contract CustomAccountWithSignerMultisigERC721Holder is Account, EIP712, ERC7739, MultiSignerERC7913, ERC721Holder {␊ - constructor(bytes[] memory signers, uint64 threshold)␊ - EIP712("CustomAccount with SignerMultisigERC721Holder", "1")␊ - MultiSignerERC7913(signers, threshold)␊ - {}␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ ␊ - function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ - _addSigners(signers);␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ }␊ ␊ - function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ - _removeSigners(signers);␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ }␊ + }␊ ␊ - function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ - _setThreshold(threshold);␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signers, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, threshold, salt));␊ }␊ }␊ ` -## Account with SignerMultisig with ERC1155Holder non-upgradeable +## Account with SignerMultisig with ERC7579 with ERC7739 upgradeable transparent > Snapshot 1 @@ -6146,17 +15478,40 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC1155Holder is Account, EIP712, ERC7739, MultiSignerERC7913, ERC1155Holder {␊ - constructor(bytes[] memory signers, uint64 threshold)␊ - EIP712("CustomAccount with SignerMultisigERC1155Holder", "1")␊ - MultiSignerERC7913(signers, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6169,10 +15524,33 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ }␊ ` -## Account with SignerMultisig with ERC721Holder and ERC1155Holder non-upgradeable +## Account with SignerMultisig with ERC7579 with ERC7739 upgradeable transparent with factory > Snapshot 1 @@ -6180,18 +15558,41 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC721HolderERC1155Holder is Account, EIP712, ERC7739, MultiSignerERC7913, ERC721Holder, ERC1155Holder {␊ - constructor(bytes[] memory signers, uint64 threshold)␊ - EIP712("CustomAccount with SignerMultisigERC721HolderERC1155Holder", "1")␊ - MultiSignerERC7913(signers, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6204,53 +15605,67 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - }␊ - ` - -## Account with SignerMultisig with ERC7821 Execution non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + // The following functions are overrides required by Solidity.␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, MultiSignerERC7913, ERC7821 {␊ - constructor(bytes[] memory signers, uint64 threshold)␊ - EIP712("MyAccount", "1")␊ - MultiSignerERC7913(signers, threshold)␊ - {}␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ ␊ - function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ - _addSigners(signers);␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ }␊ + }␊ ␊ - function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ - _removeSigners(signers);␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signers, threshold);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ - _setThreshold(threshold);␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, threshold, salt));␊ }␊ ␊ - function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + function _salt(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ internal␊ - view␊ - override␊ - returns (bool)␊ + pure␊ + returns (bytes32)␊ {␊ - return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + return keccak256(abi.encode(signers, threshold, salt));␊ }␊ }␊ ` -## Account with SignerMultisig with ERC7579 non-upgradeable +## Account with SignerMultisig with ERC7579 hooks upgradeable transparent > Snapshot 1 @@ -6260,28 +15675,38 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913 {␊ - constructor(bytes[] memory signers, uint64 threshold)␊ - EIP712("MyAccount", "1")␊ - MultiSignerERC7913(signers, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579Hooked_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579, ERC7739)␊ + override(AccountERC7579Upgradeable, ERC7739)␊ returns (bytes4)␊ {␊ // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6300,20 +15725,20 @@ Generated by [AVA](https://avajs.dev). ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerMultisig is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisig)␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -6321,7 +15746,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisig with ERC7579 with ERC1271 non-upgradeable +## Account with SignerMultisig with ERC7579 hooks upgradeable transparent with factory > Snapshot 1 @@ -6331,15 +15756,40 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Account, IERC1271, AccountERC7579, MultiSignerERC7913 {␊ - constructor(bytes[] memory signers, uint64 threshold)␊ - MultiSignerERC7913(signers, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913Upgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579Hooked_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6357,37 +15807,62 @@ Generated by [AVA](https://avajs.dev). ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(IERC1271, AccountERC7579)␊ - returns (bytes4)␊ - {␊ - return super.isValidSignature(hash, signature);␊ - }␊ - ␊ - // IMPORTANT: Make sure SignerMultisig is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisig)␊ + // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ }␊ }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signers, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, threshold, salt));␊ + }␊ + }␊ ` -## Account with SignerMultisig with ERC7579 with ERC7739 non-upgradeable +## Account with SignerMultisigWeighted named non-upgradeable > Snapshot 1 @@ -6395,30 +15870,22 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913 {␊ - constructor(bytes[] memory signers, uint64 threshold)␊ - EIP712("MyAccount", "1")␊ - MultiSignerERC7913(signers, threshold)␊ + contract CustomAccountWithSignerMultisigWeighted is Account, EIP712, ERC7739, MultiSignerERC7913Weighted {␊ + constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + EIP712("CustomAccount with SignerMultisigWeighted", "1")␊ + MultiSignerERC7913Weighted(signers, weights, threshold)␊ {}␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - view␊ - override(AccountERC7579, ERC7739)␊ - returns (bytes4)␊ + onlyEntryPointOrSelf␊ {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6432,33 +15899,10 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - ␊ - // The following functions are overrides required by Solidity.␊ - ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ - }␊ - ␊ - // IMPORTANT: Make sure SignerMultisig is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisig)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ }␊ ` -## Account with SignerMultisig with ERC7579 hooks non-upgradeable +## Account with SignerMultisigWeighted with ERC1271 non-upgradeable > Snapshot 1 @@ -6466,31 +15910,29 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ - import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, MultiSignerERC7913 {␊ - constructor(bytes[] memory signers, uint64 threshold)␊ - EIP712("MyAccount", "1")␊ - MultiSignerERC7913(signers, threshold)␊ + contract CustomAccountWithSignerMultisigWeightedERC1271 is Account, IERC1271, MultiSignerERC7913Weighted {␊ + constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + MultiSignerERC7913Weighted(signers, weights, threshold)␊ {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579, ERC7739)␊ + override␊ returns (bytes4)␊ {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6504,33 +15946,10 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - ␊ - // The following functions are overrides required by Solidity.␊ - ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ - }␊ - ␊ - // IMPORTANT: Make sure SignerMultisig is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisig)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ }␊ ` -## Account with SignerMultisig named upgradeable uups +## Account with SignerMultisigWeighted with ERC7739 non-upgradeable > Snapshot 1 @@ -6541,22 +15960,19 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract CustomAccountWithSignerMultisig is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerMultisig", "1") {␊ - _disableInitializers();␊ - }␊ + contract CustomAccountWithSignerMultisigWeightedERC7739 is Account, EIP712, ERC7739, MultiSignerERC7913Weighted {␊ + constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + EIP712("CustomAccount with SignerMultisigWeightedERC7739", "1")␊ + MultiSignerERC7913Weighted(signers, weights, threshold)␊ + {}␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - initializer␊ + onlyEntryPointOrSelf␊ {␊ - __MultiSignerERC7913_init(signers, threshold);␊ - __UUPSUpgradeable_init();␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6570,16 +15986,10 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ }␊ ` -## Account with SignerMultisig with ERC1271 upgradeable uups +## Account with SignerMultisigWeighted with ERC721Holder non-upgradeable > Snapshot 1 @@ -6588,32 +15998,22 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ - ␊ - contract CustomAccountWithSignerMultisigERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ - _disableInitializers();␊ - }␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __MultiSignerERC7913_init(signers, threshold);␊ - __UUPSUpgradeable_init();␊ - }␊ + contract CustomAccountWithSignerMultisigWeightedERC721Holder is Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC721Holder {␊ + constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + EIP712("CustomAccount with SignerMultisigWeightedERC721Holder", "1")␊ + MultiSignerERC7913Weighted(signers, weights, threshold)␊ + {}␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - view␊ - override␊ - returns (bytes4)␊ + onlyEntryPointOrSelf␊ {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6627,16 +16027,10 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ }␊ ` -## Account with SignerMultisig with ERC7739 upgradeable uups +## Account with SignerMultisigWeighted with ERC1155Holder non-upgradeable > Snapshot 1 @@ -6646,23 +16040,21 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerMultisigERC7739", "1") {␊ - _disableInitializers();␊ - }␊ + contract CustomAccountWithSignerMultisigWeightedERC1155Holder is Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC1155Holder {␊ + constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + EIP712("CustomAccount with SignerMultisigWeightedERC1155Holder", "1")␊ + MultiSignerERC7913Weighted(signers, weights, threshold)␊ + {}␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - initializer␊ + onlyEntryPointOrSelf␊ {␊ - __MultiSignerERC7913_init(signers, threshold);␊ - __UUPSUpgradeable_init();␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6676,16 +16068,10 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ }␊ ` -## Account with SignerMultisig with ERC721Holder upgradeable uups +## Account with SignerMultisigWeighted with ERC721Holder and ERC1155Holder non-upgradeable > Snapshot 1 @@ -6695,24 +16081,22 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerMultisigERC721Holder", "1") {␊ - _disableInitializers();␊ - }␊ + contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder is Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC721Holder, ERC1155Holder {␊ + constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + EIP712("CustomAccount with SignerMultisigWeightedERC721HolderERC1155Holder", "1")␊ + MultiSignerERC7913Weighted(signers, weights, threshold)␊ + {}␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - initializer␊ + onlyEntryPointOrSelf␊ {␊ - __MultiSignerERC7913_init(signers, threshold);␊ - __UUPSUpgradeable_init();␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6726,16 +16110,10 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ }␊ ` -## Account with SignerMultisig with ERC1155Holder upgradeable uups +## Account with SignerMultisigWeighted with ERC7821 Execution non-upgradeable > Snapshot 1 @@ -6745,24 +16123,21 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC1155Holder, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerMultisigERC1155Holder", "1") {␊ - _disableInitializers();␊ - }␊ + contract MyAccount is Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC7821 {␊ + constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + EIP712("MyAccount", "1")␊ + MultiSignerERC7913Weighted(signers, weights, threshold)␊ + {}␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - initializer␊ + onlyEntryPointOrSelf␊ {␊ - __MultiSignerERC7913_init(signers, threshold);␊ - __UUPSUpgradeable_init();␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6777,15 +16152,18 @@ Generated by [AVA](https://avajs.dev). _setThreshold(threshold);␊ }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ internal␊ + view␊ override␊ - onlyEntryPointOrSelf␊ - {}␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ }␊ ` -## Account with SignerMultisig with ERC721Holder and ERC1155Holder upgradeable uups +## Account with SignerMultisigWeighted with ERC7579 non-upgradeable > Snapshot 1 @@ -6793,29 +16171,38 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor()␊ - EIP712("CustomAccount with SignerMultisigERC721HolderERC1155Holder", "1")␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913Weighted {␊ + constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + EIP712("MyAccount", "1")␊ + MultiSignerERC7913Weighted(signers, weights, threshold)␊ + {}␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579, ERC7739)␊ + returns (bytes4)␊ {␊ - _disableInitializers();␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - initializer␊ + onlyEntryPointOrSelf␊ {␊ - __MultiSignerERC7913_init(signers, threshold);␊ - __UUPSUpgradeable_init();␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6830,15 +16217,32 @@ Generated by [AVA](https://avajs.dev). _setThreshold(threshold);␊ }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ + override(Account, AccountERC7579)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigWeighted is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisigWeighted)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ }␊ ` -## Account with SignerMultisig with ERC7821 Execution upgradeable uups +## Account with SignerMultisigWeighted with ERC7579 with ERC1271 non-upgradeable > Snapshot 1 @@ -6846,26 +16250,24 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC7821, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ - _disableInitializers();␊ - }␊ + contract MyAccount is Account, IERC1271, AccountERC7579, MultiSignerERC7913Weighted {␊ + constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + MultiSignerERC7913Weighted(signers, weights, threshold)␊ + {}␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - initializer␊ + onlyEntryPointOrSelf␊ {␊ - __MultiSignerERC7913_init(signers, threshold);␊ - __UUPSUpgradeable_init();␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6880,24 +16282,41 @@ Generated by [AVA](https://avajs.dev). _setThreshold(threshold);␊ }␊ ␊ - function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ + override(Account, AccountERC7579)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ view␊ - override␊ - returns (bool)␊ + override(IERC1271, AccountERC7579)␊ + returns (bytes4)␊ {␊ - return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + return super.isValidSignature(hash, signature);␊ }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ + // IMPORTANT: Make sure SignerMultisigWeighted is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisigWeighted)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ + view␊ + override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ }␊ ` -## Account with SignerMultisig with ERC7579 upgradeable uups +## Account with SignerMultisigWeighted with ERC7579 with ERC7739 non-upgradeable > Snapshot 1 @@ -6907,39 +16326,36 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ - ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ - _disableInitializers();␊ - }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __AccountERC7579_init();␊ - __MultiSignerERC7913_init(signers, threshold);␊ - __UUPSUpgradeable_init();␊ - }␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913Weighted {␊ + constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + EIP712("MyAccount", "1")␊ + MultiSignerERC7913Weighted(signers, weights, threshold)␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ + override(AccountERC7579, ERC7739)␊ returns (bytes4)␊ {␊ // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6953,31 +16369,25 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579Upgradeable)␊ + override(Account, AccountERC7579)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // IMPORTANT: Make sure SignerMultisigWeighted is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisigWeighted)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -6985,7 +16395,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisig with ERC7579 with ERC1271 upgradeable uups +## Account with SignerMultisigWeighted with ERC7579 hooks non-upgradeable > Snapshot 1 @@ -6995,26 +16405,37 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ - _disableInitializers();␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, MultiSignerERC7913Weighted {␊ + constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + EIP712("MyAccount", "1")␊ + MultiSignerERC7913Weighted(signers, weights, threshold)␊ + {}␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - initializer␊ + onlyEntryPointOrSelf␊ {␊ - __AccountERC7579_init();␊ - __MultiSignerERC7913_init(signers, threshold);␊ - __UUPSUpgradeable_init();␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7028,40 +16449,25 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579Upgradeable)␊ + override(Account, AccountERC7579)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(IERC1271, AccountERC7579Upgradeable)␊ - returns (bytes4)␊ - {␊ - return super.isValidSignature(hash, signature);␊ - }␊ - ␊ - // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ + // IMPORTANT: Make sure SignerMultisigWeighted is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisigWeighted)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + // AccountERC7579 returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -7069,7 +16475,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisig with ERC7579 with ERC7739 upgradeable uups +## Account with SignerMultisigWeighted named upgradeable uups > Snapshot 1 @@ -7077,41 +16483,32 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeighted is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() EIP712("CustomAccount with SignerMultisigWeighted", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - __AccountERC7579_init();␊ - __MultiSignerERC7913_init(signers, threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ __UUPSUpgradeable_init();␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ + onlyEntryPointOrSelf␊ {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7131,33 +16528,10 @@ Generated by [AVA](https://avajs.dev). override␊ onlyEntryPointOrSelf␊ {}␊ - ␊ - // The following functions are overrides required by Solidity.␊ - ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ - }␊ - ␊ - // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ }␊ ` -## Account with SignerMultisig with ERC7579 hooks upgradeable uups +## Account with SignerMultisigWeighted named upgradeable uups with factory > Snapshot 1 @@ -7165,42 +16539,34 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeighted is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() EIP712("CustomAccount with SignerMultisigWeighted", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - __AccountERC7579Hooked_init();␊ - __MultiSignerERC7913_init(signers, threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ __UUPSUpgradeable_init();␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ + onlyEntryPointOrSelf␊ {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7220,33 +16586,43 @@ Generated by [AVA](https://avajs.dev). override␊ onlyEntryPointOrSelf␊ {}␊ + }␊ ␊ - // The following functions are overrides required by Solidity.␊ + contract CustomAccountWithSignerMultisigWeightedFactory {␊ + CustomAccountWithSignerMultisigWeighted public immutable implementation = new CustomAccountWithSignerMultisigWeighted();␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ {␊ - return super._validateUserOp(userOp, userOpHash);␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerMultisigWeighted.initialize, (signers, weights, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerMultisigWeighted.initialize, (signers, weights, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ internal␊ view␊ - override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ + returns (address)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerMultisig named upgradeable transparent +## Account with SignerMultisigWeighted with ERC1271 upgradeable uups > Snapshot 1 @@ -7255,22 +16631,39 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerMultisig is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerMultisig", "1") {␊ + constructor() {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - __MultiSignerERC7913_init(signers, threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7284,10 +16677,16 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerMultisig with ERC1271 upgradeable transparent +## Account with SignerMultisigWeighted with ERC1271 upgradeable uups with factory > Snapshot 1 @@ -7298,19 +16697,23 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913Upgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - __MultiSignerERC7913_init(signers, threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ @@ -7321,6 +16724,13 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ + }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -7333,10 +16743,49 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigWeightedERC1271Factory {␊ + CustomAccountWithSignerMultisigWeightedERC1271 public immutable implementation = new CustomAccountWithSignerMultisigWeightedERC1271();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerMultisigWeightedERC1271.initialize, (signers, weights, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerMultisigWeightedERC1271.initialize, (signers, weights, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ }␊ ` -## Account with SignerMultisig with ERC7739 upgradeable transparent +## Account with SignerMultisigWeighted with ERC7739 upgradeable uups > Snapshot 1 @@ -7348,19 +16797,30 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerMultisigERC7739", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC7739", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - __MultiSignerERC7913_init(signers, threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7374,10 +16834,16 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerMultisig with ERC721Holder upgradeable transparent +## Account with SignerMultisigWeighted with ERC7739 upgradeable uups with factory > Snapshot 1 @@ -7387,22 +16853,34 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder {␊ + contract CustomAccountWithSignerMultisigWeightedERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerMultisigERC721Holder", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC7739", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - __MultiSignerERC7913_init(signers, threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7416,52 +16894,49 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - }␊ - ` - -## Account with SignerMultisig with ERC1155Holder upgradeable transparent - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - ␊ - contract CustomAccountWithSignerMultisigERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC1155Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerMultisigERC1155Holder", "1") {␊ - _disableInitializers();␊ - }␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __MultiSignerERC7913_init(signers, threshold);␊ - }␊ + contract CustomAccountWithSignerMultisigWeightedERC7739Factory {␊ + CustomAccountWithSignerMultisigWeightedERC7739 public immutable implementation = new CustomAccountWithSignerMultisigWeightedERC7739();␊ ␊ - function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ - _addSigners(signers);␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerMultisigWeightedERC7739.initialize, (signers, weights, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ - _removeSigners(signers);␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerMultisigWeightedERC7739.initialize, (signers, weights, threshold)));␊ }␊ ␊ - function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ - _setThreshold(threshold);␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerMultisig with ERC721Holder and ERC1155Holder upgradeable transparent +## Account with SignerMultisigWeighted with ERC721Holder upgradeable uups > Snapshot 1 @@ -7471,25 +16946,33 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder, ERC1155Holder {␊ + contract CustomAccountWithSignerMultisigWeightedERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor()␊ - EIP712("CustomAccount with SignerMultisigERC721HolderERC1155Holder", "1")␊ + EIP712("CustomAccount with SignerMultisigWeightedERC721Holder", "1")␊ {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - __MultiSignerERC7913_init(signers, threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7503,10 +16986,16 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerMultisig with ERC7821 Execution upgradeable transparent +## Account with SignerMultisigWeighted with ERC721Holder upgradeable uups with factory > Snapshot 1 @@ -7516,22 +17005,35 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC7821 {␊ + contract CustomAccountWithSignerMultisigWeightedERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC721Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - __MultiSignerERC7913_init(signers, threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7546,18 +17048,48 @@ Generated by [AVA](https://avajs.dev). _setThreshold(threshold);␊ }␊ ␊ - function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + function _authorizeUpgrade(address newImplementation)␊ internal␊ - view␊ override␊ - returns (bool)␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigWeightedERC721HolderFactory {␊ + CustomAccountWithSignerMultisigWeightedERC721Holder public immutable implementation = new CustomAccountWithSignerMultisigWeightedERC721Holder();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ {␊ - return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerMultisigWeightedERC721Holder.initialize, (signers, weights, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerMultisigWeightedERC721Holder.initialize, (signers, weights, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerMultisig with ERC7579 upgradeable transparent +## Account with SignerMultisigWeighted with ERC1155Holder upgradeable uups > Snapshot 1 @@ -7565,39 +17097,35 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC1155Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC1155Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - __AccountERC7579_init();␊ - __MultiSignerERC7913_init(signers, threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ + onlyEntryPointOrSelf␊ {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7612,32 +17140,15 @@ Generated by [AVA](https://avajs.dev). _setThreshold(threshold);␊ }␊ ␊ - // The following functions are overrides required by Solidity.␊ - ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ - }␊ - ␊ - // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function _authorizeUpgrade(address newImplementation)␊ internal␊ - view␊ - override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerMultisig with ERC7579 with ERC1271 upgradeable transparent +## Account with SignerMultisigWeighted with ERC1155Holder upgradeable uups with factory > Snapshot 1 @@ -7645,26 +17156,37 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC1155Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC1155Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - __AccountERC7579_init();␊ - __MultiSignerERC7913_init(signers, threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7679,41 +17201,48 @@ Generated by [AVA](https://avajs.dev). _setThreshold(threshold);␊ }␊ ␊ - // The following functions are overrides required by Solidity.␊ - ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + function _authorizeUpgrade(address newImplementation)␊ internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigWeightedERC1155HolderFactory {␊ + CustomAccountWithSignerMultisigWeightedERC1155Holder public immutable implementation = new CustomAccountWithSignerMultisigWeightedERC1155Holder();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ {␊ - return super._validateUserOp(userOp, userOpHash);␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerMultisigWeightedERC1155Holder.initialize, (signers, weights, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ public␊ view␊ - override(IERC1271, AccountERC7579Upgradeable)␊ - returns (bytes4)␊ + returns (address)␊ {␊ - return super.isValidSignature(hash, signature);␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerMultisigWeightedERC1155Holder.initialize, (signers, weights, threshold)));␊ }␊ ␊ - // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function _predict(bytes32 salt, bytes memory initcall)␊ internal␊ view␊ - override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ + returns (address)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerMultisig with ERC7579 with ERC7739 upgradeable transparent +## Account with SignerMultisigWeighted with ERC721Holder and ERC1155Holder upgradeable uups > Snapshot 1 @@ -7721,39 +17250,36 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC721HolderERC1155Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - __AccountERC7579_init();␊ - __MultiSignerERC7913_init(signers, threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ + onlyEntryPointOrSelf␊ {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7768,32 +17294,15 @@ Generated by [AVA](https://avajs.dev). _setThreshold(threshold);␊ }␊ ␊ - // The following functions are overrides required by Solidity.␊ - ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ - }␊ - ␊ - // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerMultisig with ERC7579 hooks upgradeable transparent +## Account with SignerMultisigWeighted with ERC721Holder and ERC1155Holder upgradeable uups with factory > Snapshot 1 @@ -7801,40 +17310,38 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913Upgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC721HolderERC1155Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - __AccountERC7579Hooked_init();␊ - __MultiSignerERC7913_init(signers, threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ + onlyEntryPointOrSelf␊ {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7849,32 +17356,48 @@ Generated by [AVA](https://avajs.dev). _setThreshold(threshold);␊ }␊ ␊ - // The following functions are overrides required by Solidity.␊ - ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + function _authorizeUpgrade(address newImplementation)␊ internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155HolderFactory {␊ + CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder public immutable implementation = new CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ {␊ - return super._validateUserOp(userOp, userOpHash);␊ + bytes memory initcall = abi.encodeCall(CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder.initialize, (signers, weights, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - // IMPORTANT: Make sure SignerMultisigUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder.initialize, (signers, weights, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ internal␊ view␊ - override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ + returns (address)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerMultisigWeighted named non-upgradeable +## Account with SignerMultisigWeighted with ERC7821 Execution upgradeable uups > Snapshot 1 @@ -7885,13 +17408,24 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeighted is Account, EIP712, ERC7739, MultiSignerERC7913Weighted {␊ - constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - EIP712("CustomAccount with SignerMultisigWeighted", "1")␊ - MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC7821, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -7911,10 +17445,25 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerMultisigWeighted with ERC1271 non-upgradeable +## Account with SignerMultisigWeighted with ERC7821 Execution upgradeable uups with factory > Snapshot 1 @@ -7923,21 +17472,27 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC1271 is Account, IERC1271, MultiSignerERC7913Weighted {␊ - constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC7821, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ - view␊ - override␊ - returns (bytes4)␊ + initializer␊ {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -7958,10 +17513,58 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signers, weights, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signers, weights, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7739 non-upgradeable +## Account with SignerMultisigWeighted with ERC7579 upgradeable uups > Snapshot 1 @@ -7969,16 +17572,43 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC7739 is Account, EIP712, ERC7739, MultiSignerERC7913Weighted {␊ - constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - EIP712("CustomAccount with SignerMultisigWeightedERC7739", "1")␊ - MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -7998,10 +17628,39 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC721Holder non-upgradeable +## Account with SignerMultisigWeighted with ERC7579 upgradeable uups with factory > Snapshot 1 @@ -8009,17 +17668,45 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ + ␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC721Holder is Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC721Holder {␊ - constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - EIP712("CustomAccount with SignerMultisigWeightedERC721Holder", "1")␊ - MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {}␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8039,51 +17726,72 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - }␊ - ` - -## Account with SignerMultisigWeighted with ERC1155Holder non-upgradeable - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.4.0␊ - pragma solidity ^0.8.27;␊ - ␊ - import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC1155Holder is Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC1155Holder {␊ - constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - EIP712("CustomAccount with SignerMultisigWeightedERC1155Holder", "1")␊ - MultiSignerERC7913Weighted(signers, weights, threshold)␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ {}␊ ␊ - function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ - public␊ - onlyEntryPointOrSelf␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ {␊ - _setSignerWeights(signers, weights);␊ + return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ - _addSigners(signers);␊ + // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ }␊ + }␊ ␊ - function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ - _removeSigners(signers);␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signers, weights, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ }␊ ␊ - function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ - _setThreshold(threshold);␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signers, weights, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC721Holder and ERC1155Holder non-upgradeable +## Account with SignerMultisigWeighted with ERC7579 with ERC1271 upgradeable uups > Snapshot 1 @@ -8091,18 +17799,30 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder is Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC721Holder, ERC1155Holder {␊ - constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - EIP712("CustomAccount with SignerMultisigWeightedERC721HolderERC1155Holder", "1")␊ - MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8122,10 +17842,48 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7821 Execution non-upgradeable +## Account with SignerMultisigWeighted with ERC7579 with ERC1271 upgradeable uups with factory > Snapshot 1 @@ -8133,17 +17891,32 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC7821 {␊ - constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - EIP712("MyAccount", "1")␊ - MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8164,18 +17937,80 @@ Generated by [AVA](https://avajs.dev). _setThreshold(threshold);␊ }␊ ␊ - function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + function _authorizeUpgrade(address newImplementation)␊ internal␊ - view␊ override␊ + onlyEntryPointOrSelf␊ + {}␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ - return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signers, weights, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signers, weights, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7579 non-upgradeable +## Account with SignerMultisigWeighted with ERC7579 with ERC7739 upgradeable uups > Snapshot 1 @@ -8185,29 +18020,40 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913Weighted {␊ - constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - EIP712("MyAccount", "1")␊ - MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579, ERC7739)␊ + override(AccountERC7579Upgradeable, ERC7739)␊ returns (bytes4)␊ {␊ // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -8228,25 +18074,31 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerMultisigWeighted is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisigWeighted)␊ + // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -8254,7 +18106,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisigWeighted with ERC7579 with ERC1271 non-upgradeable +## Account with SignerMultisigWeighted with ERC7579 with ERC7739 upgradeable uups with factory > Snapshot 1 @@ -8264,16 +18116,43 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Account, IERC1271, AccountERC7579, MultiSignerERC7913Weighted {␊ - constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8293,42 +18172,72 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signers, weights, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ public␊ view␊ - override(IERC1271, AccountERC7579)␊ - returns (bytes4)␊ + returns (address)␊ {␊ - return super.isValidSignature(hash, signature);␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signers, weights, threshold)));␊ }␊ ␊ - // IMPORTANT: Make sure SignerMultisigWeighted is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisigWeighted)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function _predict(bytes32 salt, bytes memory initcall)␊ internal␊ view␊ - override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ - returns (bool)␊ + returns (address)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7579 with ERC7739 non-upgradeable +## Account with SignerMultisigWeighted with ERC7579 hooks upgradeable uups > Snapshot 1 @@ -8338,29 +18247,41 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913Weighted {␊ - constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - EIP712("MyAccount", "1")␊ - MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579Hooked_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579, ERC7739)␊ + override(AccountERC7579Upgradeable, ERC7739)␊ returns (bytes4)␊ {␊ // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -8381,25 +18302,31 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerMultisigWeighted is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisigWeighted)␊ + // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -8407,7 +18334,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisigWeighted with ERC7579 hooks non-upgradeable +## Account with SignerMultisigWeighted with ERC7579 hooks upgradeable uups with factory > Snapshot 1 @@ -8417,30 +18344,43 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ - import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";␊ + import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, MultiSignerERC7913Weighted {␊ - constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - EIP712("MyAccount", "1")␊ - MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {}␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579Hooked_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ view␊ - override(AccountERC7579, ERC7739)␊ + override(AccountERC7579Upgradeable, ERC7739)␊ returns (bytes4)␊ {␊ // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -8461,33 +18401,72 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ - override(Account, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ ␊ - // IMPORTANT: Make sure SignerMultisigWeighted is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisigWeighted)␊ + // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ // to ensure the correct order of function resolution.␊ - // AccountERC7579 returns false for _rawSignatureValidation␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ - override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ }␊ }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes memory initcall = abi.encodeCall(MyAccount.initialize, (signers, weights, threshold));␊ + address instance = _predict(salt, initcall);␊ + if (instance.code.length == 0) {␊ + new ERC1967Proxy{salt: salt}(address(implementation), initcall);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return _predict(salt, abi.encodeCall(MyAccount.initialize, (signers, weights, threshold)));␊ + }␊ + ␊ + function _predict(bytes32 salt, bytes memory initcall)␊ + internal␊ + view␊ + returns (address)␊ + {␊ + return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));␊ + }␊ + }␊ ` -## Account with SignerMultisigWeighted named upgradeable uups +## Account with SignerMultisigWeighted named upgradeable transparent > Snapshot 1 @@ -8500,9 +18479,8 @@ Generated by [AVA](https://avajs.dev). import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeighted is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeighted is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() EIP712("CustomAccount with SignerMultisigWeighted", "1") {␊ _disableInitializers();␊ @@ -8513,7 +18491,6 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - __UUPSUpgradeable_init();␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -8534,16 +18511,10 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ }␊ ` -## Account with SignerMultisigWeighted with ERC1271 upgradeable uups +## Account with SignerMultisigWeighted named upgradeable transparent with factory > Snapshot 1 @@ -8552,32 +18523,23 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeighted is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor() EIP712("CustomAccount with SignerMultisigWeighted", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - __UUPSUpgradeable_init();␊ - }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ - view␊ - override␊ - returns (bytes4)␊ + initializer␊ {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -8598,16 +18560,44 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + }␊ + ␊ + contract CustomAccountWithSignerMultisigWeightedFactory {␊ + CustomAccountWithSignerMultisigWeighted public immutable implementation = new CustomAccountWithSignerMultisigWeighted();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, weights, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerMultisigWeighted(instance).initialize(signers, weights, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, weights, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, weights, threshold, salt));␊ + }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7739 upgradeable uups +## Account with SignerMultisigWeighted with ERC1271 upgradeable transparent > Snapshot 1 @@ -8616,17 +18606,13 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913WeightedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor()␊ - EIP712("CustomAccount with SignerMultisigWeightedERC7739", "1")␊ - {␊ + constructor() {␊ _disableInitializers();␊ }␊ ␊ @@ -8635,7 +18621,15 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -8656,16 +18650,10 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ }␊ ` -## Account with SignerMultisigWeighted with ERC721Holder upgradeable uups +## Account with SignerMultisigWeighted with ERC1271 upgradeable transparent with factory > Snapshot 1 @@ -8674,18 +18662,14 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913WeightedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor()␊ - EIP712("CustomAccount with SignerMultisigWeightedERC721Holder", "1")␊ - {␊ + constructor() {␊ _disableInitializers();␊ }␊ ␊ @@ -8694,7 +18678,15 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override␊ + returns (bytes4)␊ + {␊ + return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -8715,16 +18707,44 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ + contract CustomAccountWithSignerMultisigWeightedERC1271Factory {␊ + CustomAccountWithSignerMultisigWeightedERC1271 public immutable implementation = new CustomAccountWithSignerMultisigWeightedERC1271();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, weights, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerMultisigWeightedERC1271(instance).initialize(signers, weights, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, weights, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, weights, threshold, salt));␊ + }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC1155Holder upgradeable uups +## Account with SignerMultisigWeighted with ERC7739 upgradeable transparent > Snapshot 1 @@ -8734,16 +18754,14 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC1155Holder, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor()␊ - EIP712("CustomAccount with SignerMultisigWeightedERC1155Holder", "1")␊ + EIP712("CustomAccount with SignerMultisigWeightedERC7739", "1")␊ {␊ _disableInitializers();␊ }␊ @@ -8753,7 +18771,6 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - __UUPSUpgradeable_init();␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -8774,16 +18791,10 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ }␊ ` -## Account with SignerMultisigWeighted with ERC721Holder and ERC1155Holder upgradeable uups +## Account with SignerMultisigWeighted with ERC7739 upgradeable transparent with factory > Snapshot 1 @@ -8793,17 +18804,15 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor()␊ - EIP712("CustomAccount with SignerMultisigWeightedERC721HolderERC1155Holder", "1")␊ + EIP712("CustomAccount with SignerMultisigWeightedERC7739", "1")␊ {␊ _disableInitializers();␊ }␊ @@ -8813,7 +18822,6 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - __UUPSUpgradeable_init();␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -8834,16 +18842,44 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ + contract CustomAccountWithSignerMultisigWeightedERC7739Factory {␊ + CustomAccountWithSignerMultisigWeightedERC7739 public immutable implementation = new CustomAccountWithSignerMultisigWeightedERC7739();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, weights, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerMultisigWeightedERC7739(instance).initialize(signers, weights, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, weights, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, weights, threshold, salt));␊ + }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7821 Execution upgradeable uups +## Account with SignerMultisigWeighted with ERC721Holder upgradeable transparent > Snapshot 1 @@ -8853,15 +18889,16 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC7821, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC721Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ @@ -8870,7 +18907,6 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - __UUPSUpgradeable_init();␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -8891,25 +18927,10 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - ␊ - function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ - internal␊ - view␊ - override␊ - returns (bool)␊ - {␊ - return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ - }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7579 upgradeable uups +## Account with SignerMultisigWeighted with ERC721Holder upgradeable transparent with factory > Snapshot 1 @@ -8917,20 +18938,19 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC721Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ @@ -8938,21 +18958,7 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ - __AccountERC7579_init();␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - __UUPSUpgradeable_init();␊ - }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ - {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -8973,39 +18979,44 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ + contract CustomAccountWithSignerMultisigWeightedERC721HolderFactory {␊ + CustomAccountWithSignerMultisigWeightedERC721Holder public immutable implementation = new CustomAccountWithSignerMultisigWeightedERC721Holder();␊ ␊ - // The following functions are overrides required by Solidity.␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, weights, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerMultisigWeightedERC721Holder(instance).initialize(signers, weights, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ {␊ - return super._validateUserOp(userOp, userOpHash);␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, weights, threshold, salt));␊ }␊ ␊ - // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function _salt(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ internal␊ - view␊ - override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ + pure␊ + returns (bytes32)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return keccak256(abi.encode(signers, weights, threshold, salt));␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7579 with ERC1271 upgradeable uups +## Account with SignerMultisigWeighted with ERC1155Holder upgradeable transparent > Snapshot 1 @@ -9013,19 +19024,18 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC1155Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC1155Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ @@ -9033,9 +19043,7 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ - __AccountERC7579_init();␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - __UUPSUpgradeable_init();␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -9046,58 +19054,20 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ - _addSigners(signers);␊ - }␊ - ␊ - function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ - _removeSigners(signers);␊ - }␊ - ␊ - function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ - _setThreshold(threshold);␊ - }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ - ␊ - // The following functions are overrides required by Solidity.␊ - ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ + _addSigners(signers);␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(IERC1271, AccountERC7579Upgradeable)␊ - returns (bytes4)␊ - {␊ - return super.isValidSignature(hash, signature);␊ + function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _removeSigners(signers);␊ }␊ ␊ - // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7579 with ERC7739 upgradeable uups +## Account with SignerMultisigWeighted with ERC1155Holder upgradeable transparent with factory > Snapshot 1 @@ -9105,20 +19075,19 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC1155Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC1155Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ @@ -9126,21 +19095,7 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ - __AccountERC7579_init();␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - __UUPSUpgradeable_init();␊ - }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ - {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -9161,39 +19116,44 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + }␊ ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ + contract CustomAccountWithSignerMultisigWeightedERC1155HolderFactory {␊ + CustomAccountWithSignerMultisigWeightedERC1155Holder public immutable implementation = new CustomAccountWithSignerMultisigWeightedERC1155Holder();␊ ␊ - // The following functions are overrides required by Solidity.␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, weights, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerMultisigWeightedERC1155Holder(instance).initialize(signers, weights, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ {␊ - return super._validateUserOp(userOp, userOpHash);␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, weights, threshold, salt));␊ }␊ ␊ - // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + function _salt(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ internal␊ - view␊ - override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ + pure␊ + returns (bytes32)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + return keccak256(abi.encode(signers, weights, threshold, salt));␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7579 hooks upgradeable uups +## Account with SignerMultisigWeighted with ERC721Holder and ERC1155Holder upgradeable transparent > Snapshot 1 @@ -9201,21 +19161,19 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ - import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder, ERC1155Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC721HolderERC1155Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ @@ -9223,21 +19181,7 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ - __AccountERC7579Hooked_init();␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - __UUPSUpgradeable_init();␊ - }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(AccountERC7579Upgradeable, ERC7739)␊ - returns (bytes4)␊ - {␊ - // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ - // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ - bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ - return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -9258,39 +19202,10 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ - ␊ - function _authorizeUpgrade(address newImplementation)␊ - internal␊ - override␊ - onlyEntryPointOrSelf␊ - {}␊ - ␊ - // The following functions are overrides required by Solidity.␊ - ␊ - function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ - internal␊ - override(Account, AccountERC7579Upgradeable)␊ - returns (uint256)␊ - {␊ - return super._validateUserOp(userOp, userOpHash);␊ - }␊ - ␊ - // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ - // to ensure the correct order of function resolution.␊ - // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ }␊ ` -## Account with SignerMultisigWeighted named upgradeable transparent +## Account with SignerMultisigWeighted with ERC721Holder and ERC1155Holder upgradeable transparent with factory > Snapshot 1 @@ -9300,13 +19215,18 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeighted is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable {␊ + contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder, ERC1155Holder {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("CustomAccount with SignerMultisigWeighted", "1") {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC721HolderERC1155Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ @@ -9336,9 +19256,43 @@ Generated by [AVA](https://avajs.dev). _setThreshold(threshold);␊ }␊ }␊ + ␊ + contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155HolderFactory {␊ + CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder public immutable implementation = new CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, weights, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder(instance).initialize(signers, weights, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, weights, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, weights, threshold, salt));␊ + }␊ + }␊ ` -## Account with SignerMultisigWeighted with ERC1271 upgradeable transparent +## Account with SignerMultisigWeighted with ERC7821 Execution upgradeable transparent > Snapshot 1 @@ -9347,13 +19301,15 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913WeightedUpgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC7821 {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ @@ -9363,15 +19319,6 @@ Generated by [AVA](https://avajs.dev). {␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override␊ - returns (bytes4)␊ - {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ - }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -9391,10 +19338,19 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7739 upgradeable transparent +## Account with SignerMultisigWeighted with ERC7821 Execution upgradeable transparent with factory > Snapshot 1 @@ -9405,14 +19361,14 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC7821 {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor()␊ - EIP712("CustomAccount with SignerMultisigWeightedERC7739", "1")␊ - {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ @@ -9441,10 +19397,53 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, weights, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signers, weights, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, weights, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, weights, threshold, salt));␊ + }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC721Holder upgradeable transparent +## Account with SignerMultisigWeighted with ERC7579 upgradeable transparent > Snapshot 1 @@ -9452,18 +19451,19 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor()␊ - EIP712("CustomAccount with SignerMultisigWeightedERC721Holder", "1")␊ - {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ @@ -9471,8 +19471,21 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -9489,13 +19502,36 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ - _setThreshold(threshold);␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ + _setThreshold(threshold);␊ + }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC1155Holder upgradeable transparent +## Account with SignerMultisigWeighted with ERC7579 upgradeable transparent with factory > Snapshot 1 @@ -9503,18 +19539,20 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC1155Holder {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor()␊ - EIP712("CustomAccount with SignerMultisigWeightedERC1155Holder", "1")␊ - {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ @@ -9522,8 +19560,21 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -9543,10 +19594,67 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, weights, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signers, weights, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, weights, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, weights, threshold, salt));␊ + }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC721Holder and ERC1155Holder upgradeable transparent +## Account with SignerMultisigWeighted with ERC7579 with ERC1271 upgradeable transparent > Snapshot 1 @@ -9554,19 +19662,18 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/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/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder, ERC1155Holder {␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor()␊ - EIP712("CustomAccount with SignerMultisigWeightedERC721HolderERC1155Holder", "1")␊ - {␊ + constructor() {␊ _disableInitializers();␊ }␊ ␊ @@ -9574,6 +19681,7 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ @@ -9595,10 +19703,42 @@ Generated by [AVA](https://avajs.dev). function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ + internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7821 Execution upgradeable transparent +## Account with SignerMultisigWeighted with ERC7579 with ERC1271 upgradeable transparent with factory > Snapshot 1 @@ -9606,16 +19746,19 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.4.0␊ pragma solidity ^0.8.27;␊ ␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC7821 {␊ + contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() EIP712("MyAccount", "1") {␊ + constructor() {␊ _disableInitializers();␊ }␊ ␊ @@ -9623,6 +19766,7 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ @@ -9645,18 +19789,75 @@ Generated by [AVA](https://avajs.dev). _setThreshold(threshold);␊ }␊ ␊ - function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ + // The following functions are overrides required by Solidity.␊ + ␊ + function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ internal␊ + override(Account, AccountERC7579Upgradeable)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ view␊ - override␊ + override(IERC1271, AccountERC7579Upgradeable)␊ + returns (bytes4)␊ + {␊ + return super.isValidSignature(hash, signature);␊ + }␊ + ␊ + // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ + // to ensure the correct order of function resolution.␊ + // AccountERC7579Upgradeable returns false for _rawSignatureValidation␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(MultiSignerERC7913Upgradeable, AbstractSigner, AccountERC7579Upgradeable)␊ returns (bool)␊ {␊ - return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, weights, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signers, weights, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, weights, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, weights, threshold, salt));␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7579 upgradeable transparent +## Account with SignerMultisigWeighted with ERC7579 with ERC7739 upgradeable transparent > Snapshot 1 @@ -9744,7 +19945,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisigWeighted with ERC7579 with ERC1271 upgradeable transparent +## Account with SignerMultisigWeighted with ERC7579 with ERC7739 upgradeable transparent with factory > Snapshot 1 @@ -9755,15 +19956,17 @@ Generated by [AVA](https://avajs.dev). import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor() {␊ + constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ @@ -9774,6 +19977,18 @@ Generated by [AVA](https://avajs.dev). __AccountERC7579_init();␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ + view␊ + override(AccountERC7579Upgradeable, ERC7739)␊ + returns (bytes4)␊ + {␊ + // ERC-7739 can return the ERC-1271 magic value, 0xffffffff (invalid) or 0x77390001 (detection).␊ + // If the returned value is 0xffffffff, fallback to ERC-7579 validation.␊ + bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ + return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -9803,15 +20018,6 @@ Generated by [AVA](https://avajs.dev). {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(IERC1271, AccountERC7579Upgradeable)␊ - returns (bytes4)␊ - {␊ - return super.isValidSignature(hash, signature);␊ - }␊ ␊ // IMPORTANT: Make sure SignerMultisigWeightedUpgradeable is most derived than AccountERC7579Upgradeable␊ // in the inheritance chain (i.e. contract ... is AccountERC7579Upgradeable, ..., SignerMultisigWeightedUpgradeable)␊ @@ -9826,9 +20032,43 @@ Generated by [AVA](https://avajs.dev). return super._rawSignatureValidation(hash, signature);␊ }␊ }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, weights, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signers, weights, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, weights, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, weights, threshold, salt));␊ + }␊ + }␊ ` -## Account with SignerMultisigWeighted with ERC7579 with ERC7739 upgradeable transparent +## Account with SignerMultisigWeighted with ERC7579 hooks upgradeable transparent > Snapshot 1 @@ -9839,6 +20079,7 @@ Generated by [AVA](https://avajs.dev). import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ @@ -9846,7 +20087,7 @@ Generated by [AVA](https://avajs.dev). import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913WeightedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ @@ -9856,7 +20097,7 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ - __AccountERC7579_init();␊ + __AccountERC7579Hooked_init();␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ @@ -9916,7 +20157,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisigWeighted with ERC7579 hooks upgradeable transparent +## Account with SignerMultisigWeighted with ERC7579 hooks upgradeable transparent with factory > Snapshot 1 @@ -9934,6 +20175,7 @@ Generated by [AVA](https://avajs.dev). import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";␊ ␊ contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913WeightedUpgradeable {␊ /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ @@ -10003,4 +20245,38 @@ Generated by [AVA](https://avajs.dev). return super._rawSignatureValidation(hash, signature);␊ }␊ }␊ + ␊ + contract MyAccountFactory {␊ + MyAccount public immutable implementation = new MyAccount();␊ + ␊ + function deploy(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + returns (address)␊ + {␊ + bytes32 effectiveSalt = _salt(signers, weights, threshold, salt);␊ + address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);␊ + if (instance.code.length == 0) {␊ + Clones.cloneDeterministic(address(implementation), effectiveSalt);␊ + MyAccount(instance).initialize(signers, weights, threshold);␊ + }␊ + return instance;␊ + ␊ + }␊ + ␊ + function predict(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + public␊ + view␊ + returns (address)␊ + {␊ + return Clones.predictDeterministicAddress(address(implementation), _salt(signers, weights, threshold, salt));␊ + }␊ + ␊ + function _salt(bytes[] memory signers, uint64[] memory weights, uint64 threshold, bytes32 salt)␊ + internal␊ + pure␊ + returns (bytes32)␊ + {␊ + return keccak256(abi.encode(signers, weights, threshold, salt));␊ + }␊ + }␊ ` diff --git a/packages/core/solidity/src/account.test.ts.snap b/packages/core/solidity/src/account.test.ts.snap index 8f9f873c2..088c817a2 100644 Binary files a/packages/core/solidity/src/account.test.ts.snap and b/packages/core/solidity/src/account.test.ts.snap differ diff --git a/packages/core/solidity/src/account.ts b/packages/core/solidity/src/account.ts index 919fe86fc..ff91d569e 100644 --- a/packages/core/solidity/src/account.ts +++ b/packages/core/solidity/src/account.ts @@ -3,10 +3,12 @@ import type { Contract } from './contract'; import { defineFunctions } from './utils/define-functions'; import { printContract } from './print'; import { defaults as commonDefaults, withCommonDefaults, type CommonOptions } from './common-options'; +import { OptionsError } from './error'; import { upgradeableName } from './options'; import { setInfo } from './set-info'; -import { addSigner, signerFunctions, signers, type SignerOptions } from './signer'; +import { addSigner, signers, signerFunctions, type SignerOptions } from './signer'; import { setUpgradeableAccount } from './set-upgradeable'; +import { formatLines } from './utils/format-lines'; export const defaults: Required = { ...commonDefaults, @@ -17,6 +19,7 @@ export const defaults: Required = { signer: 'ECDSA', batchedExecution: false, ERC7579Modules: false, + factory: false, } as const; export const SignatureValidationOptions = [false, 'ERC1271', 'ERC7739'] as const; @@ -33,6 +36,7 @@ export interface AccountOptions extends CommonOptions { signer?: SignerOptions; batchedExecution?: boolean; ERC7579Modules?: ERC7579ModulesOptions; + factory?: boolean; } function withDefaults(opts: AccountOptions): Required { @@ -45,11 +49,18 @@ function withDefaults(opts: AccountOptions): Required { signer: opts.signer ?? defaults.signer, batchedExecution: opts.batchedExecution ?? defaults.batchedExecution, ERC7579Modules: opts.ERC7579Modules ?? defaults.ERC7579Modules, + factory: false, }; } export function printAccount(opts: AccountOptions = defaults): string { - return printContract(buildAccount(opts)); + const account = buildAccount(opts); + if (opts.factory) { + const factory = buildFactory(account, opts); + return printContract([account, factory]); + } else { + return printContract(account); + } } export function buildAccount(opts: AccountOptions): Contract { @@ -172,6 +183,16 @@ function addERC7579Modules(c: ContractBuilder, opts: AccountOptions): void { // Accounts that use ERC7579 without a signer must be constructed with at least one module (executor of validation) if (!opts.signer) { + c.addImportOnly({ + name: 'MODULE_TYPE_VALIDATOR', + path: '@openzeppelin/contracts/interfaces/draft-IERC7579.sol', + transpiled: false, + }); + c.addImportOnly({ + name: 'MODULE_TYPE_EXECUTOR', + path: '@openzeppelin/contracts/interfaces/draft-IERC7579.sol', + transpiled: false, + }); c.addConstructorArgument({ type: 'uint256', name: 'moduleTypeId' }); c.addConstructorArgument({ type: 'address', name: 'module' }); c.addConstructorArgument({ type: 'bytes calldata', name: 'initData' }); @@ -270,53 +291,165 @@ function overrideRawSignatureValidation(c: ContractBuilder, opts: AccountOptions } } -const functions = { - ...defineFunctions({ - isValidSignature: { - kind: 'public' as const, - mutability: 'view' as const, - args: [ - { name: 'hash', type: 'bytes32' }, - { name: 'signature', type: 'bytes calldata' }, - ], - returns: ['bytes4'], - }, - _validateUserOp: { - kind: 'internal' as const, - args: [ - { name: 'userOp', type: 'PackedUserOperation calldata' }, - { name: 'userOpHash', type: 'bytes32' }, - ], - returns: ['uint256'], - }, - _erc7821AuthorizedExecutor: { - kind: 'internal' as const, - args: [ - { name: 'caller', type: 'address' }, - { name: 'mode', type: 'bytes32' }, - { name: 'executionData', type: 'bytes calldata' }, - ], - returns: ['bool'], - mutability: 'view' as const, - }, - addSigners: { - kind: 'public' as const, - args: [{ name: 'signers', type: 'bytes[] memory' }], - }, - removeSigners: { - kind: 'public' as const, - args: [{ name: 'signers', type: 'bytes[] memory' }], - }, - setThreshold: { - kind: 'public' as const, - args: [{ name: 'threshold', type: 'uint64' }], - }, - setSignerWeights: { - kind: 'public' as const, - args: [ - { name: 'signers', type: 'bytes[] memory' }, - { name: 'weights', type: 'uint64[] memory' }, - ], - }, - }), -}; +export function buildFactory(account: Contract, opts: AccountOptions): Contract { + if (opts.signer === 'ERC7702') { + throw new OptionsError({ factory: 'Factory cannot deploy accounts with ERC-7702 signers' }); + } + if (!opts.signer && !opts.ERC7579Modules) { + throw new OptionsError({ factory: 'Factory requires the account to have an initializable signer or module' }); + } + + const factory = new ContractBuilder(account.name + 'Factory'); + const args = [...account.constructorArgs, { name: 'salt', type: 'bytes32' }]; + + // Implementation address + factory.addVariable(`${account.name} public immutable implementation = new ${account.name}();`); + + switch (opts.upgradeable) { + case 'transparent': + // Import helpers + factory.addImportOnly({ + name: 'Clones', + path: '@openzeppelin/contracts/proxy/Clones.sol', + }); + + // Functions - create + factory.setFunctionBody( + formatLines([ + `bytes32 effectiveSalt = _salt(${args.map(arg => arg.name).join(', ')});`, + `address instance = Clones.predictDeterministicAddress(address(implementation), effectiveSalt);`, + `if (instance.code.length == 0) {`, + [ + `Clones.cloneDeterministic(address(implementation), effectiveSalt);`, + `${account.name}(instance).initialize(${account.constructorArgs.map(arg => arg.name).join(', ')});`, + ], + `}`, + `return instance;`, + ]).split('\n'), + { name: 'deploy', kind: 'public' as const, args, returns: ['address'] }, + ); + + // Functions - predict + factory.setFunctionBody( + [ + `return Clones.predictDeterministicAddress(address(implementation), _salt(${args.map(arg => arg.name).join(', ')}));`, + ], + { name: 'predict', kind: 'public' as const, args, returns: ['address'] }, + 'view', + ); + + // Functions - _salt + factory.setFunctionBody( + [`return keccak256(abi.encode(${args.map(arg => arg.name).join(', ')}));`], + { name: '_salt', kind: 'internal' as const, args, returns: ['bytes32'] }, + 'pure', + ); + break; + + case 'uups': + // Import helpers + factory.addImportOnly({ + name: 'ERC1967Proxy', + path: '@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol', + }); + + factory.addImportOnly({ + name: 'Create2', + path: '@openzeppelin/contracts/utils/Create2.sol', + }); + + // Functions - create + factory.setFunctionBody( + formatLines([ + `bytes memory initcall = abi.encodeCall(${account.name}.initialize, (${account.constructorArgs.map(arg => arg.name).join(', ')}));`, + 'address instance = _predict(salt, initcall);', + `if (instance.code.length == 0) {`, + [`new ERC1967Proxy{salt: salt}(address(implementation), initcall);`], + `}`, + `return instance;`, + ]).split('\n'), + { name: 'deploy', kind: 'public' as const, args, returns: ['address'] }, + ); + + // Functions - predict + factory.setFunctionBody( + [ + `return _predict(salt, abi.encodeCall(${account.name}.initialize, (${account.constructorArgs.map(arg => arg.name).join(', ')})));`, + ], + { name: 'predict', kind: 'public' as const, args, returns: ['address'] }, + 'view', + ); + + // Functions - _salt + factory.setFunctionBody( + [ + 'return Create2.computeAddress(salt, keccak256(bytes.concat(type(ERC1967Proxy).creationCode, abi.encode(implementation, initcall))));', + ], + { + name: '_predict', + kind: 'internal' as const, + args: [ + { name: 'salt', type: 'bytes32' }, + { name: 'initcall', type: 'bytes memory' }, + ], + returns: ['address'], + }, + 'view', + ); + break; + + default: + throw new OptionsError({ factory: 'Factory requires the account to be transparent upgradeable' }); + } + + return factory; +} + +const functions = defineFunctions({ + isValidSignature: { + kind: 'public' as const, + mutability: 'view' as const, + args: [ + { name: 'hash', type: 'bytes32' }, + { name: 'signature', type: 'bytes calldata' }, + ], + returns: ['bytes4'], + }, + _validateUserOp: { + kind: 'internal' as const, + args: [ + { name: 'userOp', type: 'PackedUserOperation calldata' }, + { name: 'userOpHash', type: 'bytes32' }, + ], + returns: ['uint256'], + }, + _erc7821AuthorizedExecutor: { + kind: 'internal' as const, + args: [ + { name: 'caller', type: 'address' }, + { name: 'mode', type: 'bytes32' }, + { name: 'executionData', type: 'bytes calldata' }, + ], + returns: ['bool'], + mutability: 'view' as const, + }, + addSigners: { + kind: 'public' as const, + args: [{ name: 'signers', type: 'bytes[] memory' }], + }, + removeSigners: { + kind: 'public' as const, + args: [{ name: 'signers', type: 'bytes[] memory' }], + }, + setThreshold: { + kind: 'public' as const, + args: [{ name: 'threshold', type: 'uint64' }], + }, + setSignerWeights: { + kind: 'public' as const, + args: [ + { name: 'signers', type: 'bytes[] memory' }, + { name: 'weights', type: 'uint64[] memory' }, + ], + }, +}); diff --git a/packages/core/solidity/src/generate/account.ts b/packages/core/solidity/src/generate/account.ts index 685e23bb8..94b1d60d3 100644 --- a/packages/core/solidity/src/generate/account.ts +++ b/packages/core/solidity/src/generate/account.ts @@ -11,6 +11,7 @@ const account = { signer: ['ERC7702', 'ECDSA', 'P256', 'RSA', 'Multisig', 'MultisigWeighted'] as const, batchedExecution: [false, true] as const, ERC7579Modules: [false, 'AccountERC7579', 'AccountERC7579Hooked'] as const, + factory: [false, true] as const, access: [false] as const, upgradeable: upgradeableOptions, info: infoOptions, diff --git a/packages/core/solidity/src/print.ts b/packages/core/solidity/src/print.ts index bc6202d7d..6e239e092 100644 --- a/packages/core/solidity/src/print.ts +++ b/packages/core/solidity/src/print.ts @@ -20,38 +20,45 @@ import { stringifyUnicodeSafe } from './utils/sanitize'; import { importsCommunityContracts } from './utils/imports-libraries'; import { getCommunityContractsGitCommit } from './utils/community-contracts-git-commit'; -export function printContract(contract: Contract, opts?: Options): string { - const helpers = withHelpers(contract, opts); - - const fns = mapValues(sortedFunctions(contract), fns => fns.map(fn => printFunction(fn, helpers))); - - const hasOverrides = fns.override.some(l => l.length > 0); +export function printContract(contracts: Contract | Contract[], opts?: Options): string { + contracts = Array.isArray(contracts) ? contracts : [contracts]; + if (contracts.length == 0) throw new Error('no contract'); + if (contracts.some(c1 => contracts.some(c2 => c1.license != c2.license))) throw new Error('multiple licences'); return formatLines( ...spaceBetween( + // Header [ - `// SPDX-License-Identifier: ${contract.license}`, - printCompatibleLibraryVersions(contract), + `// SPDX-License-Identifier: ${contracts[0]!.license}`, + printCompatibleLibraryVersions(contracts[0]!), `pragma solidity ^${SOLIDITY_VERSION};`, ], - printImports(contract.imports, helpers), - - [ - ...printNatspecTags(contract.natspecTags), - [`contract ${contract.name}`, ...printInheritance(contract, helpers), '{'].join(' '), - - spaceBetween( - contract.variables, - printConstructor(contract, helpers), - ...fns.code, - ...fns.modifiers, - hasOverrides ? [`// The following functions are overrides required by Solidity.`] : [], - ...fns.override, - ), - - `}`, - ], + // Imports + // TODO: handle double imports & consolidate imports from same file + contracts + .flatMap(contract => printImports(contract.imports, withHelpers(contract, opts))) + .filter((line, i, lines) => lines.indexOf(line) === i), + + // contracts + ...contracts.map(contract => { + const helpers = withHelpers(contract, opts); + const fns = mapValues(sortedFunctions(contract), fns => fns.map(fn => printFunction(fn, helpers))); + const hasOverrides = fns.override.some(l => l.length > 0); + return [ + ...printNatspecTags(contract.natspecTags), + [`contract ${contract.name}`, ...printInheritance(contract, helpers), '{'].join(' '), + spaceBetween( + contract.variables, + printConstructor(contract, helpers), + ...fns.code, + ...fns.modifiers, + hasOverrides ? [`// The following functions are overrides required by Solidity.`] : [], + ...fns.override, + ), + `}`, + ]; + }), ), ); } diff --git a/packages/core/solidity/src/zip-foundry.test.ts b/packages/core/solidity/src/zip-foundry.test.ts index 8667b6d36..ddf65cbe4 100644 --- a/packages/core/solidity/src/zip-foundry.test.ts +++ b/packages/core/solidity/src/zip-foundry.test.ts @@ -6,7 +6,7 @@ import { zipFoundry } from './zip-foundry'; import { buildERC20 } from './erc20'; import { buildERC721 } from './erc721'; import { buildERC1155 } from './erc1155'; -import { buildAccount } from './account'; +import { buildAccount, buildFactory } from './account'; import { buildCustom } from './custom'; import { promises as fs } from 'fs'; import path from 'path'; @@ -130,6 +130,32 @@ test.serial('account ecdsa uups', async t => { await runTest(c, t, opts); }); +test.skip('account P256 transparent with factory', async t => { + const opts: GenericOptions = { + kind: 'Account', + name: 'My Account', + signer: 'P256', + upgradeable: 'transparent', + factory: true, + }; + const c = buildAccount(opts); + const _ = buildFactory(c, opts); + await runTest(c, t, opts); +}); + +test.skip('account modular uups with factory', async t => { + const opts: GenericOptions = { + kind: 'Account', + name: 'My Account', + ERC7579Modules: 'AccountERC7579', + upgradeable: 'uups', + factory: true, + }; + const c = buildAccount(opts); + const _ = buildFactory(c, opts); + await runTest(c, t, opts); +}); + test.serial('custom basic', async t => { const opts: GenericOptions = { kind: 'Custom', name: 'My Contract' }; const c = buildCustom(opts); diff --git a/packages/core/solidity/src/zip-hardhat.test.ts b/packages/core/solidity/src/zip-hardhat.test.ts index 9caab3734..f68f85560 100644 --- a/packages/core/solidity/src/zip-hardhat.test.ts +++ b/packages/core/solidity/src/zip-hardhat.test.ts @@ -17,7 +17,7 @@ import { rimraf } from 'rimraf'; import type { JSZipObject } from 'jszip'; import type JSZip from 'jszip'; import type { GenericOptions } from './build-generic'; -import { buildAccount } from './account'; +import { buildAccount, buildFactory } from './account'; interface Context { tempFolder: string; @@ -105,6 +105,32 @@ test.serial('account ecdsa uups', async t => { await runDeployScriptTest(c, t, opts); }); +test.skip('account P256 transparent with factory', async t => { + const opts: GenericOptions = { + kind: 'Account', + name: 'My Account', + signer: 'P256', + upgradeable: 'transparent', + factory: true, + }; + const c = buildAccount(opts); + const _ = buildFactory(c, opts); + await runDeployScriptTest(c, t, opts); +}); + +test.skip('account modular uups with factory', async t => { + const opts: GenericOptions = { + kind: 'Account', + name: 'My Account', + ERC7579Modules: 'AccountERC7579', + upgradeable: 'uups', + factory: true, + }; + const c = buildAccount(opts); + const _ = buildFactory(c, opts); + await runDeployScriptTest(c, t, opts); +}); + test.serial('custom basic', async t => { const opts: GenericOptions = { kind: 'Custom', name: 'My Contract' }; const c = buildCustom(opts);