diff --git a/packages/core/solidity/package.json b/packages/core/solidity/package.json index f451397b2..f9449b62e 100644 --- a/packages/core/solidity/package.json +++ b/packages/core/solidity/package.json @@ -23,8 +23,8 @@ }, "devDependencies": { "@openzeppelin/community-contracts": "https://github.com/OpenZeppelin/openzeppelin-community-contracts", - "@openzeppelin/contracts": "^5.3.0", - "@openzeppelin/contracts-upgradeable": "^5.3.0", + "@openzeppelin/contracts": "^5.4.0-rc.1", + "@openzeppelin/contracts-upgradeable": "^5.4.0-rc.1", "@types/node": "^20.0.0", "@types/semver": "^7.5.7", "ava": "^6.0.0", diff --git a/packages/core/solidity/src/account.test.ts b/packages/core/solidity/src/account.test.ts index fbf809721..652d8c701 100644 --- a/packages/core/solidity/src/account.test.ts +++ b/packages/core/solidity/src/account.test.ts @@ -50,72 +50,96 @@ test('account API assert defaults', async t => { t.is(account.print(account.defaults), account.print()); }); -for (const signer of [false, 'ERC7702', 'ECDSA', 'P256', 'RSA', 'Multisig', 'MultisigWeighted'] as const) { - let title = 'Account'; - if (signer) { - title += ` with Signer${signer}`; +function format(upgradeable: false | 'uups' | 'transparent') { + switch (upgradeable) { + case false: + return 'non-upgradeable'; + case 'uups': + return 'upgradeable uups'; + case 'transparent': + return 'upgradeable transparent'; } +} - testAccount(`${title} named`, { - name: `Custom${title}`, - signer, - }); - - testAccount(`${title} with ERC1271`, { - name: `Custom${title}ERC1271`, - signatureValidation: 'ERC1271', - signer, - }); - - testAccount(`${title} with ERC7739`, { - name: `Custom${title}ERC7739`, - signatureValidation: 'ERC7739', - signer, - }); - - testAccount(`${title} with ERC721Holder`, { - name: `Custom${title}ERC721Holder`, - ERC721Holder: true, - signer, - }); - - testAccount(`${title} with ERC1155Holder`, { - name: `Custom${title}ERC1155Holder`, - ERC1155Holder: true, - signer, - }); - - testAccount(`${title} with ERC721Holder and ERC1155Holder`, { - name: `Custom${title}ERC721HolderERC1155Holder`, - ERC721Holder: true, - ERC1155Holder: true, - signer, - }); - - testAccount(`${title} with ERC7821 Execution`, { - signer, - batchedExecution: true, - }); - - testAccount(`${title} with ERC7579`, { - signer, - ERC7579Modules: 'AccountERC7579', - }); - - testAccount(`${title} with ERC7579 with ERC1271`, { - signer, - ERC7579Modules: 'AccountERC7579', - signatureValidation: 'ERC1271', - }); - - testAccount(`${title} with ERC7579 with ERC7739`, { - signer, - ERC7579Modules: 'AccountERC7579', - signatureValidation: 'ERC7739', - }); - - testAccount(`${title} with ERC7579 hooks`, { - signer, - ERC7579Modules: 'AccountERC7579Hooked', - }); +for (const signer of [false, 'ERC7702', 'ECDSA', 'P256', 'RSA', 'Multisig', 'MultisigWeighted'] as const) { + for (const upgradeable of [false, 'uups', 'transparent'] as const) { + let title = 'Account'; + if (signer) { + title += ` with Signer${signer}`; + } + + testAccount(`${title} named ${format(upgradeable)}`, { + name: `Custom${title}`, + signer, + upgradeable, + }); + + testAccount(`${title} with ERC1271 ${format(upgradeable)}`, { + name: `Custom${title}ERC1271`, + signatureValidation: 'ERC1271', + signer, + upgradeable, + }); + + testAccount(`${title} with ERC7739 ${format(upgradeable)}`, { + name: `Custom${title}ERC7739`, + signatureValidation: 'ERC7739', + signer, + upgradeable, + }); + + testAccount(`${title} with ERC721Holder ${format(upgradeable)}`, { + name: `Custom${title}ERC721Holder`, + ERC721Holder: true, + signer, + upgradeable, + }); + + testAccount(`${title} with ERC1155Holder ${format(upgradeable)}`, { + name: `Custom${title}ERC1155Holder`, + ERC1155Holder: true, + signer, + upgradeable, + }); + + testAccount(`${title} with ERC721Holder and ERC1155Holder ${format(upgradeable)}`, { + name: `Custom${title}ERC721HolderERC1155Holder`, + ERC721Holder: true, + ERC1155Holder: true, + signer, + upgradeable, + }); + + testAccount(`${title} with ERC7821 Execution ${format(upgradeable)}`, { + signer, + upgradeable, + batchedExecution: true, + }); + + testAccount(`${title} with ERC7579 ${format(upgradeable)}`, { + signer, + upgradeable, + ERC7579Modules: 'AccountERC7579', + }); + + testAccount(`${title} with ERC7579 with ERC1271 ${format(upgradeable)}`, { + signer, + upgradeable, + ERC7579Modules: 'AccountERC7579', + signatureValidation: 'ERC1271', + }); + + testAccount(`${title} with ERC7579 with ERC7739 ${format(upgradeable)}`, { + signer, + upgradeable, + ERC7579Modules: 'AccountERC7579', + signatureValidation: 'ERC7739', + }); + + testAccount(`${title} with ERC7579 hooks ${format(upgradeable)}`, { + signer, + upgradeable, + ERC7579Modules: 'AccountERC7579Hooked', + }); + } } diff --git a/packages/core/solidity/src/account.test.ts.md b/packages/core/solidity/src/account.test.ts.md index da256f549..4aa86ceb9 100644 --- a/packages/core/solidity/src/account.test.ts.md +++ b/packages/core/solidity/src/account.test.ts.md @@ -4,7 +4,7 @@ The actual snapshot is saved in `account.test.ts.snap`. Generated by [AVA](https://avajs.dev). -## Account named +## Account named non-upgradeable > Snapshot 1 @@ -12,9 +12,9 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ ␊ contract CustomAccount is Account, EIP712, ERC7739 {␊ constructor() EIP712("CustomAccount", "1") {}␊ @@ -31,7 +31,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with ERC1271 +## Account with ERC1271 non-upgradeable > Snapshot 1 @@ -39,19 +39,9 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - ␊ - contract CustomAccountERC1271 is Account, IERC1271 {␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override␊ - returns (bytes4)␊ - {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ - }␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ ␊ + contract CustomAccountERC1271 is Account {␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ view␊ @@ -64,7 +54,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with ERC7739 +## Account with ERC7739 non-upgradeable > Snapshot 1 @@ -72,9 +62,9 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ ␊ contract CustomAccountERC7739 is Account, EIP712, ERC7739 {␊ constructor() EIP712("CustomAccountERC7739", "1") {}␊ @@ -91,7 +81,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with ERC721Holder +## Account with ERC721Holder non-upgradeable > Snapshot 1 @@ -99,10 +89,10 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ ␊ contract CustomAccountERC721Holder is Account, EIP712, ERC7739, ERC721Holder {␊ constructor() EIP712("CustomAccountERC721Holder", "1") {}␊ @@ -119,7 +109,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with ERC1155Holder +## Account with ERC1155Holder non-upgradeable > Snapshot 1 @@ -127,10 +117,10 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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 {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ ␊ contract CustomAccountERC1155Holder is Account, EIP712, ERC7739, ERC1155Holder {␊ constructor() EIP712("CustomAccountERC1155Holder", "1") {}␊ @@ -147,7 +137,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with ERC721Holder and ERC1155Holder +## Account with ERC721Holder and ERC1155Holder non-upgradeable > Snapshot 1 @@ -155,11 +145,11 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ ␊ contract CustomAccountERC721HolderERC1155Holder is Account, EIP712, ERC7739, ERC721Holder, ERC1155Holder {␊ constructor() EIP712("CustomAccountERC721HolderERC1155Holder", "1") {}␊ @@ -176,7 +166,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with ERC7821 Execution +## Account with ERC7821 Execution non-upgradeable > Snapshot 1 @@ -184,10 +174,10 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/community-contracts/account/extensions/ERC7821.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ ␊ contract MyAccount is Account, EIP712, ERC7739, ERC7821 {␊ constructor() EIP712("MyAccount", "1") {}␊ @@ -213,7 +203,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with ERC7579 +## Account with ERC7579 non-upgradeable > Snapshot 1 @@ -221,10 +211,10 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ contract MyAccount is Account, EIP712, ERC7739, AccountERC7579 {␊ @@ -254,7 +244,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with ERC7579 with ERC1271 +## Account with ERC7579 with ERC1271 non-upgradeable > Snapshot 1 @@ -262,12 +252,11 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract MyAccount is Account, IERC1271, AccountERC7579 {␊ + contract MyAccount is Account, AccountERC7579 {␊ // The following functions are overrides required by Solidity.␊ ␊ function _validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)␊ @@ -277,19 +266,10 @@ Generated by [AVA](https://avajs.dev). {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override(IERC1271, AccountERC7579)␊ - returns (bytes4)␊ - {␊ - return super.isValidSignature(hash, signature);␊ - }␊ }␊ ` -## Account with ERC7579 with ERC7739 +## Account with ERC7579 with ERC7739 non-upgradeable > Snapshot 1 @@ -297,10 +277,10 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ contract MyAccount is Account, EIP712, ERC7739, AccountERC7579 {␊ @@ -330,7 +310,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with ERC7579 hooks +## Account with ERC7579 hooks non-upgradeable > Snapshot 1 @@ -338,11 +318,11 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {AccountERC7579Hooked} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579Hooked.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked {␊ @@ -372,7 +352,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerERC7702 named +## Account named upgradeable uups > Snapshot 1 @@ -380,17 +360,34 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {SignerERC7702} from "@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerERC7702 is Account, EIP712, ERC7739, SignerERC7702 {␊ - constructor() EIP712("CustomAccount with SignerERC7702", "1") {}␊ + contract CustomAccount is Initializable, Account, EIP712, ERC7739, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount", "1") {}␊ + ␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerERC7702 with ERC1271 +## Account with ERC1271 upgradeable uups > Snapshot 1 @@ -398,23 +395,30 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {SignerERC7702} from "@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerERC7702ERC1271 is Account, IERC1271, SignerERC7702 {␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ + contract CustomAccountERC1271 is Initializable, Account, UUPSUpgradeable {␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ view␊ override␊ - returns (bytes4)␊ + returns (bool)␊ {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ + // Custom validation logic␊ + return false;␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerERC7702 with ERC7739 +## Account with ERC7739 upgradeable uups > Snapshot 1 @@ -422,17 +426,34 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {SignerERC7702} from "@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerERC7702ERC7739 is Account, EIP712, ERC7739, SignerERC7702 {␊ - constructor() EIP712("CustomAccount with SignerERC7702ERC7739", "1") {}␊ + contract CustomAccountERC7739 is Initializable, Account, EIP712, ERC7739, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccountERC7739", "1") {}␊ + ␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerERC7702 with ERC721Holder +## Account with ERC721Holder upgradeable uups > Snapshot 1 @@ -440,18 +461,35 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {SignerERC7702} from "@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerERC7702ERC721Holder is Account, EIP712, ERC7739, SignerERC7702, ERC721Holder {␊ - constructor() EIP712("CustomAccount with SignerERC7702ERC721Holder", "1") {}␊ + contract CustomAccountERC721Holder is Initializable, Account, EIP712, ERC7739, ERC721Holder, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccountERC721Holder", "1") {}␊ + ␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerERC7702 with ERC1155Holder +## Account with ERC1155Holder upgradeable uups > Snapshot 1 @@ -459,18 +497,35 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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 {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {SignerERC7702} from "@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerERC7702ERC1155Holder is Account, EIP712, ERC7739, SignerERC7702, ERC1155Holder {␊ - constructor() EIP712("CustomAccount with SignerERC7702ERC1155Holder", "1") {}␊ + contract CustomAccountERC1155Holder is Initializable, Account, EIP712, ERC7739, ERC1155Holder, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccountERC1155Holder", "1") {}␊ + ␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerERC7702 with ERC721Holder and ERC1155Holder +## Account with ERC721Holder and ERC1155Holder upgradeable uups > Snapshot 1 @@ -478,21 +533,36 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {SignerERC7702} from "@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract CustomAccountWithSignerERC7702ERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerERC7702, ERC721Holder, ERC1155Holder {␊ - constructor()␊ - EIP712("CustomAccount with SignerERC7702ERC721HolderERC1155Holder", "1")␊ + contract CustomAccountERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccountERC721HolderERC1155Holder", "1") {}␊ + ␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ {}␊ }␊ ` -## Account with SignerERC7702 with ERC7821 Execution +## Account with ERC7821 Execution upgradeable uups > Snapshot 1 @@ -500,13 +570,14 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/community-contracts/account/extensions/ERC7821.sol";␊ - import {SignerERC7702} from "@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.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/proxy/utils/Initializable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, SignerERC7702, ERC7821 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, ERC7821, UUPSUpgradeable {␊ constructor() EIP712("MyAccount", "1") {}␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ @@ -517,10 +588,26 @@ Generated by [AVA](https://avajs.dev). {␊ return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ }␊ + ␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerERC7702 with ERC7579 +## Account with ERC7579 upgradeable uups > Snapshot 1 @@ -528,21 +615,21 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerERC7702} from "@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerERC7702 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, UUPSUpgradeable {␊ constructor() EIP712("MyAccount", "1") {}␊ ␊ 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).␊ @@ -550,33 +637,26 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ 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, 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 +## Account with ERC7579 with ERC1271 upgradeable uups > Snapshot 1 @@ -584,49 +664,32 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerERC7702} from "@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable, UUPSUpgradeable {␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ ␊ - contract MyAccount is Account, IERC1271, AccountERC7579, SignerERC7702 {␊ // 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)␊ - public␊ - view␊ - override(IERC1271, AccountERC7579)␊ - returns (bytes4)␊ - {␊ - return super.isValidSignature(hash, signature);␊ - }␊ - ␊ - // 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 ERC7739 +## Account with ERC7579 with ERC7739 upgradeable uups > Snapshot 1 @@ -634,21 +697,21 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerERC7702} from "@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerERC7702 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, UUPSUpgradeable {␊ constructor() EIP712("MyAccount", "1") {}␊ ␊ 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).␊ @@ -656,33 +719,26 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ 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, 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 +## Account with ERC7579 hooks upgradeable uups > Snapshot 1 @@ -690,22 +746,22 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {AccountERC7579Hooked} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579Hooked.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerERC7702} from "@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ - contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerERC7702 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, UUPSUpgradeable {␊ constructor() EIP712("MyAccount", "1") {}␊ ␊ 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).␊ @@ -713,33 +769,54 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ 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, AccountERC7579)␊ + override(Account, AccountERC7579Upgradeable)␊ returns (uint256)␊ {␊ return super._validateUserOp(userOp, userOpHash);␊ }␊ + }␊ + ` + +## Account named upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + ␊ + contract CustomAccount is Initializable, Account, EIP712, ERC7739 {␊ + constructor() EIP712("CustomAccount", "1") {}␊ ␊ - // 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)␊ + override␊ returns (bool)␊ {␊ - return super._rawSignatureValidation(hash, signature);␊ + // Custom validation logic␊ + return false;␊ }␊ }␊ ` -## Account with SignerECDSA named +## Account with ERC1271 upgradeable transparent > Snapshot 1 @@ -747,25 +824,23 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerECDSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerECDSA.sol";␊ - ␊ - /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerECDSA is Initializable, Account, EIP712, ERC7739, SignerECDSA {␊ - constructor() EIP712("CustomAccount with SignerECDSA", "1") {␊ - _disableInitializers();␊ - }␊ ␊ - function initializeECDSA(address signer) public initializer {␊ - _setSigner(signer);␊ + contract CustomAccountERC1271 is Initializable, Account {␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ }␊ }␊ ` -## Account with SignerECDSA with ERC1271 +## Account with ERC7739 upgradeable transparent > Snapshot 1 @@ -773,59 +848,27 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.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 {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerECDSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerECDSA.sol";␊ ␊ - /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerECDSAERC1271 is Initializable, Account, IERC1271, SignerECDSA {␊ - constructor() {␊ - _disableInitializers();␊ - }␊ + contract CustomAccountERC7739 is Initializable, Account, EIP712, ERC7739 {␊ + constructor() EIP712("CustomAccountERC7739", "1") {}␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ view␊ override␊ - returns (bytes4)␊ + returns (bool)␊ {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ - }␊ - ␊ - function initializeECDSA(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ - }␊ - ` - -## Account with SignerECDSA with ERC7739 - -> Snapshot 1 - - `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts ^5.0.0␊ - pragma solidity ^0.8.27;␊ - ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerECDSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerECDSA.sol";␊ - ␊ - /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerECDSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerECDSA {␊ - constructor() EIP712("CustomAccount with SignerECDSAERC7739", "1") {␊ - _disableInitializers();␊ - }␊ - ␊ - function initializeECDSA(address signer) public initializer {␊ - _setSigner(signer);␊ + // Custom validation logic␊ + return false;␊ }␊ }␊ ` -## Account with SignerECDSA with ERC721Holder +## Account with ERC721Holder upgradeable transparent > Snapshot 1 @@ -833,26 +876,28 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerECDSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerECDSA.sol";␊ ␊ - /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerECDSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerECDSA, ERC721Holder {␊ - constructor() EIP712("CustomAccount with SignerECDSAERC721Holder", "1") {␊ - _disableInitializers();␊ - }␊ + contract CustomAccountERC721Holder is Initializable, Account, EIP712, ERC7739, ERC721Holder {␊ + constructor() EIP712("CustomAccountERC721Holder", "1") {}␊ ␊ - function initializeECDSA(address signer) public initializer {␊ - _setSigner(signer);␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ }␊ }␊ ` -## Account with SignerECDSA with ERC1155Holder +## Account with ERC1155Holder upgradeable transparent > Snapshot 1 @@ -860,26 +905,28 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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 {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerECDSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerECDSA.sol";␊ ␊ - /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerECDSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSA, ERC1155Holder {␊ - constructor() EIP712("CustomAccount with SignerECDSAERC1155Holder", "1") {␊ - _disableInitializers();␊ - }␊ + contract CustomAccountERC1155Holder is Initializable, Account, EIP712, ERC7739, ERC1155Holder {␊ + constructor() EIP712("CustomAccountERC1155Holder", "1") {}␊ ␊ - function initializeECDSA(address signer) public initializer {␊ - _setSigner(signer);␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ }␊ }␊ ` -## Account with SignerECDSA with ERC721Holder and ERC1155Holder +## Account with ERC721Holder and ERC1155Holder upgradeable transparent > Snapshot 1 @@ -887,29 +934,29 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerECDSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerECDSA.sol";␊ ␊ - /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSA, ERC721Holder, ERC1155Holder {␊ - constructor()␊ - EIP712("CustomAccount with SignerECDSAERC721HolderERC1155Holder", "1")␊ - {␊ - _disableInitializers();␊ - }␊ + contract CustomAccountERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, ERC721Holder, ERC1155Holder {␊ + constructor() EIP712("CustomAccountERC721HolderERC1155Holder", "1") {}␊ ␊ - function initializeECDSA(address signer) public initializer {␊ - _setSigner(signer);␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ }␊ }␊ ` -## Account with SignerECDSA with ERC7821 Execution +## Account with ERC7821 Execution upgradeable transparent > Snapshot 1 @@ -917,22 +964,14 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/community-contracts/account/extensions/ERC7821.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/proxy/utils/Initializable.sol";␊ - import {SignerECDSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerECDSA.sol";␊ - ␊ - /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerECDSA, ERC7821 {␊ - constructor() EIP712("MyAccount", "1") {␊ - _disableInitializers();␊ - }␊ ␊ - function initializeECDSA(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, ERC7821 {␊ + constructor() EIP712("MyAccount", "1") {}␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ internal␊ @@ -942,10 +981,20 @@ Generated by [AVA](https://avajs.dev). {␊ return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ }␊ + ␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override␊ + returns (bool)␊ + {␊ + // Custom validation logic␊ + return false;␊ + }␊ }␊ ` -## Account with SignerECDSA with ERC7579 +## Account with ERC7579 upgradeable transparent > Snapshot 1 @@ -953,25 +1002,20 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerECDSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerECDSA.sol";␊ ␊ - /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, SignerECDSA {␊ - constructor() EIP712("MyAccount", "1") {␊ - _disableInitializers();␊ - }␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable {␊ + constructor() EIP712("MyAccount", "1") {}␊ ␊ 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).␊ @@ -979,37 +1023,20 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initializeECDSA(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ ␊ // 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 SignerECDSA is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ - // 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)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ }␊ ` -## Account with SignerECDSA with ERC7579 with ERC1271 +## Account with ERC7579 with ERC1271 upgradeable transparent > Snapshot 1 @@ -1017,59 +1044,25 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerECDSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerECDSA.sol";␊ - ␊ - /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579, SignerECDSA {␊ - constructor() {␊ - _disableInitializers();␊ - }␊ - ␊ - function initializeECDSA(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ ␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable {␊ // 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)␊ - public␊ - view␊ - override(IERC1271, AccountERC7579)␊ - returns (bytes4)␊ - {␊ - return super.isValidSignature(hash, signature);␊ - }␊ - ␊ - // 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.␊ - // AccountERC7579 returns false for \`_rawSignatureValidation\`␊ - function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ - internal␊ - view␊ - override(SignerECDSA, AbstractSigner, AccountERC7579)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ }␊ ` -## Account with SignerECDSA with ERC7579 with ERC7739 +## Account with ERC7579 with ERC7739 upgradeable transparent > Snapshot 1 @@ -1077,25 +1070,20 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerECDSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerECDSA.sol";␊ ␊ - /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, SignerECDSA {␊ - constructor() EIP712("MyAccount", "1") {␊ - _disableInitializers();␊ - }␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable {␊ + constructor() EIP712("MyAccount", "1") {}␊ ␊ 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).␊ @@ -1103,37 +1091,20 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initializeECDSA(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ ␊ // 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 SignerECDSA is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ - // 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)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ }␊ ` -## Account with SignerECDSA with ERC7579 hooks +## Account with ERC7579 hooks upgradeable transparent > Snapshot 1 @@ -1141,26 +1112,21 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {AccountERC7579Hooked} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579Hooked.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerECDSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerECDSA.sol";␊ ␊ - /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Hooked, SignerECDSA {␊ - constructor() EIP712("MyAccount", "1") {␊ - _disableInitializers();␊ - }␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {}␊ ␊ 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).␊ @@ -1168,37 +1134,20 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initializeECDSA(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ ␊ // 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 SignerECDSA is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ - // 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)␊ - returns (bool)␊ - {␊ - return super._rawSignatureValidation(hash, signature);␊ - }␊ }␊ ` -## Account with SignerP256 named +## Account with SignerERC7702 named non-upgradeable > Snapshot 1 @@ -1206,25 +1155,20 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerP256} from "@openzeppelin/community-contracts/utils/cryptography/SignerP256.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerP256 is Initializable, Account, EIP712, ERC7739, SignerP256 {␊ - constructor() EIP712("CustomAccount with SignerP256", "1") {␊ + contract CustomAccountWithSignerERC7702 is Account, EIP712, ERC7739, SignerERC7702 {␊ + constructor() EIP712("CustomAccount with SignerERC7702", "1") {␊ _disableInitializers();␊ }␊ - ␊ - function initializeP256(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ }␊ ` -## Account with SignerP256 with ERC1271 +## Account with SignerERC7702 with ERC1271 non-upgradeable > Snapshot 1 @@ -1232,33 +1176,18 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerP256} from "@openzeppelin/community-contracts/utils/cryptography/SignerP256.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerP256ERC1271 is Initializable, Account, IERC1271, SignerP256 {␊ + contract CustomAccountWithSignerERC7702ERC1271 is Account, SignerERC7702 {␊ constructor() {␊ _disableInitializers();␊ }␊ - ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override␊ - returns (bytes4)␊ - {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ - }␊ - ␊ - function initializeP256(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ }␊ ` -## Account with SignerP256 with ERC7739 +## Account with SignerERC7702 with ERC7739 non-upgradeable > Snapshot 1 @@ -1266,25 +1195,20 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerP256} from "@openzeppelin/community-contracts/utils/cryptography/SignerP256.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerP256ERC7739 is Initializable, Account, EIP712, ERC7739, SignerP256 {␊ - constructor() EIP712("CustomAccount with SignerP256ERC7739", "1") {␊ + contract CustomAccountWithSignerERC7702ERC7739 is Account, EIP712, ERC7739, SignerERC7702 {␊ + constructor() EIP712("CustomAccount with SignerERC7702ERC7739", "1") {␊ _disableInitializers();␊ }␊ - ␊ - function initializeP256(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ }␊ ` -## Account with SignerP256 with ERC721Holder +## Account with SignerERC7702 with ERC721Holder non-upgradeable > Snapshot 1 @@ -1292,26 +1216,21 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerP256} from "@openzeppelin/community-contracts/utils/cryptography/SignerP256.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerP256ERC721Holder is Initializable, Account, EIP712, ERC7739, SignerP256, ERC721Holder {␊ - constructor() EIP712("CustomAccount with SignerP256ERC721Holder", "1") {␊ + contract CustomAccountWithSignerERC7702ERC721Holder is Account, EIP712, ERC7739, SignerERC7702, ERC721Holder {␊ + constructor() EIP712("CustomAccount with SignerERC7702ERC721Holder", "1") {␊ _disableInitializers();␊ }␊ - ␊ - function initializeP256(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ }␊ ` -## Account with SignerP256 with ERC1155Holder +## Account with SignerERC7702 with ERC1155Holder non-upgradeable > Snapshot 1 @@ -1319,26 +1238,21 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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 {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerP256} from "@openzeppelin/community-contracts/utils/cryptography/SignerP256.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerP256ERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256, ERC1155Holder {␊ - constructor() EIP712("CustomAccount with SignerP256ERC1155Holder", "1") {␊ + contract CustomAccountWithSignerERC7702ERC1155Holder is Account, EIP712, ERC7739, SignerERC7702, ERC1155Holder {␊ + constructor() EIP712("CustomAccount with SignerERC7702ERC1155Holder", "1") {␊ _disableInitializers();␊ }␊ - ␊ - function initializeP256(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ }␊ ` -## Account with SignerP256 with ERC721Holder and ERC1155Holder +## Account with SignerERC7702 with ERC721Holder and ERC1155Holder non-upgradeable > Snapshot 1 @@ -1346,29 +1260,24 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerP256} from "@openzeppelin/community-contracts/utils/cryptography/SignerP256.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256, ERC721Holder, ERC1155Holder {␊ + contract CustomAccountWithSignerERC7702ERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerERC7702, ERC721Holder, ERC1155Holder {␊ constructor()␊ - EIP712("CustomAccount with SignerP256ERC721HolderERC1155Holder", "1")␊ + EIP712("CustomAccount with SignerERC7702ERC721HolderERC1155Holder", "1")␊ {␊ _disableInitializers();␊ }␊ - ␊ - function initializeP256(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ }␊ ` -## Account with SignerP256 with ERC7821 Execution +## Account with SignerERC7702 with ERC7821 Execution non-upgradeable > Snapshot 1 @@ -1376,22 +1285,17 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/community-contracts/account/extensions/ERC7821.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerP256} from "@openzeppelin/community-contracts/utils/cryptography/SignerP256.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";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerP256, ERC7821 {␊ + contract MyAccount is Account, EIP712, ERC7739, SignerERC7702, ERC7821 {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ - ␊ - function initializeP256(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ internal␊ @@ -1404,7 +1308,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerP256 with ERC7579 +## Account with SignerERC7702 with ERC7579 non-upgradeable > Snapshot 1 @@ -1412,17 +1316,16 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256} from "@openzeppelin/community-contracts/utils/cryptography/SignerP256.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, SignerP256 {␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerERC7702 {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ @@ -1438,10 +1341,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initializeP256(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -1453,14 +1352,14 @@ Generated by [AVA](https://avajs.dev). 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 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(SignerP256, AbstractSigner, AccountERC7579)␊ + override(SignerERC7702, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -1468,7 +1367,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerP256 with ERC7579 with ERC1271 +## Account with SignerERC7702 with ERC7579 with ERC1271 non-upgradeable > Snapshot 1 @@ -1476,23 +1375,17 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + 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 {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256} from "@openzeppelin/community-contracts/utils/cryptography/SignerP256.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579, SignerP256 {␊ + contract MyAccount is Account, AccountERC7579, SignerERC7702 {␊ constructor() {␊ _disableInitializers();␊ }␊ - ␊ - function initializeP256(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -1504,23 +1397,14 @@ Generated by [AVA](https://avajs.dev). 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 SignerP256 is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerP256)␊ + // 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(SignerP256, AbstractSigner, AccountERC7579)␊ + override(SignerERC7702, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -1528,7 +1412,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerP256 with ERC7579 with ERC7739 +## Account with SignerERC7702 with ERC7579 with ERC7739 non-upgradeable > Snapshot 1 @@ -1536,17 +1420,16 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256} from "@openzeppelin/community-contracts/utils/cryptography/SignerP256.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, SignerP256 {␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerERC7702 {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ @@ -1562,10 +1445,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initializeP256(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -1577,14 +1456,14 @@ Generated by [AVA](https://avajs.dev). 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 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(SignerP256, AbstractSigner, AccountERC7579)␊ + override(SignerERC7702, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -1592,7 +1471,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerP256 with ERC7579 hooks +## Account with SignerERC7702 with ERC7579 hooks non-upgradeable > Snapshot 1 @@ -1600,18 +1479,17 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {AccountERC7579Hooked} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579Hooked.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerP256} from "@openzeppelin/community-contracts/utils/cryptography/SignerP256.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Hooked, SignerP256 {␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerERC7702 {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ @@ -1627,10 +1505,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initializeP256(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -1642,14 +1516,14 @@ Generated by [AVA](https://avajs.dev). 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 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(SignerP256, AbstractSigner, AccountERC7579)␊ + override(SignerERC7702, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -1657,7 +1531,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA named +## Account with SignerERC7702 named upgradeable uups > Snapshot 1 @@ -1665,25 +1539,28 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerRSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerRSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerRSA is Initializable, Account, EIP712, ERC7739, SignerRSA {␊ - constructor() EIP712("CustomAccount with SignerRSA", "1") {␊ + contract CustomAccountWithSignerERC7702 is Initializable, Account, EIP712, ERC7739, SignerERC7702, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerERC7702", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initializeRSA(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerRSA with ERC1271 +## Account with SignerERC7702 with ERC1271 upgradeable uups > Snapshot 1 @@ -1691,33 +1568,26 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerRSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerRSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerRSAERC1271 is Initializable, Account, IERC1271, SignerRSA {␊ + contract CustomAccountWithSignerERC7702ERC1271 is Initializable, Account, SignerERC7702, UUPSUpgradeable {␊ constructor() {␊ _disableInitializers();␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ override␊ - returns (bytes4)␊ - {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ - }␊ - ␊ - function initializeRSA(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerRSA with ERC7739 +## Account with SignerERC7702 with ERC7739 upgradeable uups > Snapshot 1 @@ -1725,25 +1595,28 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerRSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerRSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerRSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerRSA {␊ - constructor() EIP712("CustomAccount with SignerRSAERC7739", "1") {␊ + contract CustomAccountWithSignerERC7702ERC7739 is Initializable, Account, EIP712, ERC7739, SignerERC7702, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerERC7702ERC7739", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initializeRSA(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerRSA with ERC721Holder +## Account with SignerERC7702 with ERC721Holder upgradeable uups > Snapshot 1 @@ -1751,26 +1624,29 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerRSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerRSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerRSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerRSA, ERC721Holder {␊ - constructor() EIP712("CustomAccount with SignerRSAERC721Holder", "1") {␊ + contract CustomAccountWithSignerERC7702ERC721Holder is Initializable, Account, EIP712, ERC7739, SignerERC7702, ERC721Holder, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerERC7702ERC721Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initializeRSA(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerRSA with ERC1155Holder +## Account with SignerERC7702 with ERC1155Holder upgradeable uups > Snapshot 1 @@ -1778,26 +1654,29 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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 {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerRSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerRSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerRSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSA, ERC1155Holder {␊ - constructor() EIP712("CustomAccount with SignerRSAERC1155Holder", "1") {␊ + contract CustomAccountWithSignerERC7702ERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerERC7702, ERC1155Holder, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerERC7702ERC1155Holder", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initializeRSA(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerRSA with ERC721Holder and ERC1155Holder +## Account with SignerERC7702 with ERC721Holder and ERC1155Holder upgradeable uups > Snapshot 1 @@ -1805,29 +1684,32 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {SignerRSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerRSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerRSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSA, ERC721Holder, ERC1155Holder {␊ + contract CustomAccountWithSignerERC7702ERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerERC7702, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ constructor()␊ - EIP712("CustomAccount with SignerRSAERC721HolderERC1155Holder", "1")␊ + EIP712("CustomAccount with SignerERC7702ERC721HolderERC1155Holder", "1")␊ {␊ _disableInitializers();␊ }␊ ␊ - function initializeRSA(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerRSA with ERC7821 Execution +## Account with SignerERC7702 with ERC7821 Execution upgradeable uups > Snapshot 1 @@ -1835,22 +1717,19 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/community-contracts/account/extensions/ERC7821.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/proxy/utils/Initializable.sol";␊ - import {SignerRSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerRSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerRSA, ERC7821 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerERC7702, ERC7821, UUPSUpgradeable {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ - ␊ - function initializeRSA(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ internal␊ @@ -1860,10 +1739,16 @@ Generated by [AVA](https://avajs.dev). {␊ return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerRSA with ERC7579 +## Account with SignerERC7702 with ERC7579 upgradeable uups > Snapshot 1 @@ -1871,17 +1756,18 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerRSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, SignerRSA {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerERC7702, UUPSUpgradeable {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ @@ -1889,7 +1775,7 @@ Generated by [AVA](https://avajs.dev). 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).␊ @@ -1898,28 +1784,30 @@ Generated by [AVA](https://avajs.dev). return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ - function initializeRSA(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + 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 SignerRSA is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerRSA)␊ + // 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(SignerRSA, AbstractSigner, AccountERC7579)␊ + override(SignerERC7702, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -1927,7 +1815,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC7579 with ERC1271 +## Account with SignerERC7702 with ERC7579 with ERC1271 upgradeable uups > Snapshot 1 @@ -1935,51 +1823,44 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + 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 {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerRSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579, SignerRSA {␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable, SignerERC7702, UUPSUpgradeable {␊ constructor() {␊ _disableInitializers();␊ }␊ ␊ - function initializeRSA(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + 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)␊ - 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)␊ + // 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(SignerRSA, AbstractSigner, AccountERC7579)␊ + override(SignerERC7702, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -1987,7 +1868,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC7579 with ERC7739 +## Account with SignerERC7702 with ERC7579 with ERC7739 upgradeable uups > Snapshot 1 @@ -1995,17 +1876,18 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerRSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, SignerRSA {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerERC7702, UUPSUpgradeable {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ @@ -2013,7 +1895,7 @@ Generated by [AVA](https://avajs.dev). 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).␊ @@ -2022,28 +1904,30 @@ Generated by [AVA](https://avajs.dev). return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ - function initializeRSA(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + 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 SignerRSA is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerRSA)␊ + // 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(SignerRSA, AbstractSigner, AccountERC7579)␊ + override(SignerERC7702, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -2051,7 +1935,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerRSA with ERC7579 hooks +## Account with SignerERC7702 with ERC7579 hooks upgradeable uups > Snapshot 1 @@ -2059,18 +1943,19 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {AccountERC7579Hooked} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579Hooked.sol";␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ - import {SignerRSA} from "@openzeppelin/community-contracts/utils/cryptography/SignerRSA.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Hooked, SignerRSA {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerERC7702, UUPSUpgradeable {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ @@ -2078,7 +1963,7 @@ Generated by [AVA](https://avajs.dev). 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).␊ @@ -2087,8 +1972,6776 @@ Generated by [AVA](https://avajs.dev). return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ - function initializeRSA(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ + 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 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 named upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerERC7702 is Initializable, Account, EIP712, ERC7739, SignerERC7702 {␊ + constructor() EIP712("CustomAccount with SignerERC7702", "1") {␊ + _disableInitializers();␊ + }␊ + }␊ + ` + +## Account with SignerERC7702 with ERC1271 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerERC7702ERC1271 is Initializable, Account, SignerERC7702 {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + }␊ + ` + +## Account with SignerERC7702 with ERC7739 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerERC7702ERC7739 is Initializable, Account, EIP712, ERC7739, SignerERC7702 {␊ + constructor() EIP712("CustomAccount with SignerERC7702ERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + }␊ + ` + +## Account with SignerERC7702 with ERC721Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerERC7702ERC721Holder is Initializable, Account, EIP712, ERC7739, SignerERC7702, ERC721Holder {␊ + constructor() EIP712("CustomAccount with SignerERC7702ERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + }␊ + ` + +## Account with SignerERC7702 with ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerERC7702ERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerERC7702, ERC1155Holder {␊ + constructor() EIP712("CustomAccount with SignerERC7702ERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + }␊ + ` + +## Account with SignerERC7702 with ERC721Holder and ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerERC7702ERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerERC7702, ERC721Holder, ERC1155Holder {␊ + constructor()␊ + EIP712("CustomAccount with SignerERC7702ERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + }␊ + ` + +## Account with SignerERC7702 with ERC7821 Execution upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerERC7702, ERC7821 {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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 SignerERC7702 with ERC7579 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerERC7702 {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.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 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 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable, SignerERC7702 {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + // 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 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 ERC7739 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerERC7702 {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.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 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 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerERC7702} from "@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerERC7702 {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.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 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 SignerECDSA named non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + ␊ + contract CustomAccountWithSignerECDSA is Account, EIP712, ERC7739, SignerECDSA {␊ + constructor(address signer)␊ + EIP712("CustomAccount with SignerECDSA", "1")␊ + SignerECDSA(signer)␊ + {}␊ + }␊ + ` + +## Account with SignerECDSA with ERC1271 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + ␊ + contract CustomAccountWithSignerECDSAERC1271 is Account, SignerECDSA {␊ + constructor(address signer) SignerECDSA(signer) {}␊ + }␊ + ` + +## Account with SignerECDSA with ERC7739 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + ␊ + contract CustomAccountWithSignerECDSAERC7739 is Account, EIP712, ERC7739, SignerECDSA {␊ + constructor(address signer)␊ + EIP712("CustomAccount with SignerECDSAERC7739", "1")␊ + SignerECDSA(signer)␊ + {}␊ + }␊ + ` + +## Account with SignerECDSA with ERC721Holder non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + ␊ + contract CustomAccountWithSignerECDSAERC721Holder is Account, EIP712, ERC7739, SignerECDSA, ERC721Holder {␊ + constructor(address signer)␊ + EIP712("CustomAccount with SignerECDSAERC721Holder", "1")␊ + SignerECDSA(signer)␊ + {}␊ + }␊ + ` + +## Account with SignerECDSA with ERC1155Holder non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + ␊ + 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 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + ␊ + contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerECDSA, ERC721Holder, ERC1155Holder {␊ + constructor(address signer)␊ + EIP712("CustomAccount with SignerECDSAERC721HolderERC1155Holder", "1")␊ + SignerECDSA(signer)␊ + {}␊ + }␊ + ` + +## Account with SignerECDSA with ERC7821 Execution non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + ␊ + 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␊ + view␊ + override␊ + returns (bool)␊ + {␊ + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC7579 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + ␊ + 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(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 SignerECDSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ + // 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)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC7579 with ERC1271 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + ␊ + contract MyAccount is Account, 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, AccountERC7579)␊ + returns (uint256)␊ + {␊ + return super._validateUserOp(userOp, userOpHash);␊ + }␊ + ␊ + // 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.␊ + // AccountERC7579 returns false for \`_rawSignatureValidation\`␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerECDSA, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC7579 with ERC7739 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + ␊ + 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(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 SignerECDSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ + // 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)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC7579 hooks non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ + ␊ + 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(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 SignerECDSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ + // 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)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA named upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerECDSA is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerECDSA", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerECDSA with ERC1271 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerECDSAERC1271 is Initializable, Account, SignerECDSAUpgradeable, UUPSUpgradeable {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerECDSA with ERC7739 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerECDSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerECDSA with ERC721Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerECDSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerECDSA with ERC1155Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerECDSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC1155Holder, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerECDSA with ERC721Holder and ERC1155Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + constructor()␊ + EIP712("CustomAccount with SignerECDSAERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerECDSA with ERC7821 Execution upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC7821, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerECDSA with ERC7579 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + 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 SignerECDSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ + // 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)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC7579 with ERC1271 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {Initializable} from "@openzeppelin/contracts/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + 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 SignerECDSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ + // 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)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC7579 with ERC7739 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + 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 SignerECDSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ + // 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)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC7579 hooks upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerECDSAUpgradeable, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + ␊ + 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 SignerECDSA is most derived than AccountERC7579␊ + // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerECDSA)␊ + // 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)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA named upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerECDSA is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerECDSA", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC1271 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerECDSAERC1271 is Initializable, Account, SignerECDSAUpgradeable {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC7739 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerECDSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC721Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerECDSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerECDSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC1155Holder {␊ + constructor() EIP712("CustomAccount with SignerECDSAERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC721Holder and ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC721Holder, ERC1155Holder {␊ + constructor()␊ + EIP712("CustomAccount with SignerECDSAERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC7821 Execution upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerECDSAUpgradeable, ERC7821 {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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 SignerECDSA with ERC7579 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __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);␊ + }␊ + ␊ + // 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.␊ + // AccountERC7579 returns false for \`_rawSignatureValidation\`␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerECDSA, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC7579 with ERC1271 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable, SignerECDSAUpgradeable {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __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);␊ + }␊ + ␊ + // 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.␊ + // AccountERC7579 returns false for \`_rawSignatureValidation\`␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerECDSA, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC7579 with ERC7739 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerECDSAUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __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);␊ + }␊ + ␊ + // 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.␊ + // AccountERC7579 returns false for \`_rawSignatureValidation\`␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerECDSA, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerECDSA with ERC7579 hooks upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerECDSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerECDSAUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(address signer) public initializer {␊ + __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);␊ + }␊ + ␊ + // 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.␊ + // AccountERC7579 returns false for \`_rawSignatureValidation\`␊ + function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ + internal␊ + view␊ + override(SignerECDSA, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 named non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC1271 is Account, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy) SignerP256(qx, qy) {}␊ + }␊ + ` + +## Account with SignerP256 with ERC7739 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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.0.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 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.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.0.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 {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + ␊ + contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerP256, ERC721Holder, ERC1155Holder {␊ + constructor(bytes32 qx, bytes32 qy)␊ + EIP712("CustomAccount with SignerP256ERC721HolderERC1155Holder", "1")␊ + SignerP256(qx, qy)␊ + {}␊ + }␊ + ` + +## Account with SignerP256 with ERC7821 Execution non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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";␊ + ␊ + contract MyAccount is Account, EIP712, ERC7739, SignerP256, ERC7821 {␊ + constructor(bytes32 qx, bytes32 qy)␊ + EIP712("MyAccount", "1")␊ + SignerP256(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 ERC7579 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + ␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy)␊ + EIP712("MyAccount", "1")␊ + SignerP256(qx, qy)␊ + {}␊ + ␊ + 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 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(SignerP256, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC1271 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + ␊ + contract MyAccount is Account, AccountERC7579, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy) SignerP256(qx, qy) {}␊ + ␊ + // 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 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(SignerP256, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC7739 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + ␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy)␊ + EIP712("MyAccount", "1")␊ + SignerP256(qx, qy)␊ + {}␊ + ␊ + 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 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(SignerP256, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 hooks non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ + ␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy)␊ + EIP712("MyAccount", "1")␊ + SignerP256(qx, qy)␊ + {}␊ + ␊ + 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 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(SignerP256, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 named upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerP256 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerP256", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerP256 with ERC1271 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerP256ERC1271 is Initializable, Account, SignerP256Upgradeable, UUPSUpgradeable {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerP256 with ERC7739 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerP256ERC7739 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerP256ERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerP256 with ERC721Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerP256ERC721Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerP256ERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerP256 with ERC1155Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerP256ERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC1155Holder, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerP256ERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + 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.0.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/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + constructor()␊ + EIP712("CustomAccount with SignerP256ERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerP256 with ERC7821 Execution upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC7821, UUPSUpgradeable {␊ + 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);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + 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 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(SignerP256, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC1271 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {Initializable} from "@openzeppelin/contracts/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + 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 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(SignerP256, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC7739 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + 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 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(SignerP256, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 hooks upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerP256Upgradeable, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + ␊ + 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 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(SignerP256, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 named upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerP256 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable {␊ + constructor() EIP712("CustomAccount with SignerP256", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC1271 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerP256ERC1271 is Initializable, Account, SignerP256Upgradeable {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7739 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerP256ERC7739 is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable {␊ + constructor() EIP712("CustomAccount with SignerP256ERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC721Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerP256ERC721Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder {␊ + constructor() EIP712("CustomAccount with SignerP256ERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerP256ERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC1155Holder {␊ + constructor() EIP712("CustomAccount with SignerP256ERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC721Holder and ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC721Holder, ERC1155Holder {␊ + constructor()␊ + EIP712("CustomAccount with SignerP256ERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7821 Execution upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerP256Upgradeable, ERC7821 {␊ + 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 ERC7579 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __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);␊ + }␊ + ␊ + // 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(SignerP256, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC1271 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable, SignerP256Upgradeable {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __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);␊ + }␊ + ␊ + // 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(SignerP256, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 with ERC7739 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerP256Upgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __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);␊ + }␊ + ␊ + // 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(SignerP256, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerP256 with ERC7579 hooks upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerP256Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerP256Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerP256Upgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __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);␊ + }␊ + ␊ + // 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(SignerP256, AbstractSigner, AccountERC7579)␊ + returns (bool)␊ + {␊ + return super._rawSignatureValidation(hash, signature);␊ + }␊ + }␊ + ` + +## Account with SignerRSA named non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + ␊ + contract CustomAccountWithSignerRSAERC1271 is Account, SignerRSA {␊ + constructor(bytes memory e, bytes memory n) SignerRSA(e, n) {}␊ + }␊ + ` + +## Account with SignerRSA with ERC7739 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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.0.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.0.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.0.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.0.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.0.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.0.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 {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ + ␊ + contract MyAccount is Account, 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);␊ + }␊ + ␊ + // 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.0.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.0.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.0.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/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerRSA is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerRSA", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC1271 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerRSAERC1271 is Initializable, Account, SignerRSAUpgradeable, UUPSUpgradeable {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC7739 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerRSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerRSAERC7739", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC721Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerRSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerRSAERC721Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC1155Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerRSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC1155Holder, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerRSAERC1155Holder", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC721Holder and ERC1155Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerRSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + constructor()␊ + EIP712("CustomAccount with SignerRSAERC721HolderERC1155Holder", "1")␊ + {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC7821 Execution upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC7821, UUPSUpgradeable {␊ + 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);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerRSA with ERC7579 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + 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 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 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {Initializable} from "@openzeppelin/contracts/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + 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 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 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + 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 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 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerRSAUpgradeable, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + ␊ + 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 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 transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerRSA is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerRSA", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC1271 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerRSAERC1271 is Initializable, Account, SignerRSAUpgradeable {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ + }␊ + ` + +## Account with SignerRSA with ERC7739 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerRSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable {␊ + 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 ERC721Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerRSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder {␊ + 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 ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerRSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC1155Holder {␊ + 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 ERC721Holder and ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerRSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC721Holder, ERC1155Holder {␊ + 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 ERC7821 Execution upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerRSAUpgradeable, ERC7821 {␊ + 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 ERC7579 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __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);␊ + }␊ + ␊ + // 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 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable, SignerRSAUpgradeable {␊ + constructor() {␊ + _disableInitializers();␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __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);␊ + }␊ + ␊ + // 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 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, SignerRSAUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __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);␊ + }␊ + ␊ + // 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 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/proxy/utils/Initializable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + import {SignerRSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/SignerRSAUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, SignerRSAUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __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);␊ + }␊ + ␊ + // 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 SignerMultisig named non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigERC1271 is Account, 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);␊ + }␊ + }␊ + ` + +## Account with SignerMultisig with ERC7739 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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.0.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.0.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.0.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.0.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.0.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.0.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 {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + ␊ + contract MyAccount is Account, 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);␊ + }␊ + ␊ + // 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.0.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.0.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.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerMultisig is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + 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);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerMultisig with ERC1271 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerMultisigERC1271 is Initializable, Account, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + constructor() {␊ + _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);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerMultisig with ERC7739 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerMultisigERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerMultisigERC7739", "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);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerMultisig with ERC721Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerMultisigERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerMultisigERC721Holder", "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);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerMultisig with ERC1155Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerMultisigERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC1155Holder, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerMultisigERC1155Holder", "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);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerMultisig with ERC721Holder and ERC1155Holder upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerMultisigERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigERC721HolderERC1155Holder", "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);␊ + }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ + }␊ + ` + +## Account with SignerMultisig with ERC7821 Execution upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC7821, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "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);␊ + }␊ + ␊ + 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 ERC7579 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + 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 _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 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 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {Initializable} from "@openzeppelin/contracts/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + constructor() {␊ + _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);␊ + }␊ + ␊ + 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 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 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + 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 _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 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 upgradeable uups + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/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/proxy/utils/UUPSUpgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913Upgradeable, UUPSUpgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + 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 _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 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 transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerMultisig is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable {␊ + 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 with ERC1271 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerMultisigERC1271 is Initializable, Account, MultiSignerERC7913Upgradeable {␊ + constructor() {␊ + _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 with ERC7739 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerMultisigERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable {␊ + constructor() EIP712("CustomAccount with SignerMultisigERC7739", "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 with ERC721Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerMultisigERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder {␊ + constructor() EIP712("CustomAccount with SignerMultisigERC721Holder", "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 with ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerMultisigERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC1155Holder {␊ + constructor() EIP712("CustomAccount with SignerMultisigERC1155Holder", "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 with ERC721Holder and ERC1155Holder upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract CustomAccountWithSignerMultisigERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC721Holder, ERC1155Holder {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigERC721HolderERC1155Holder", "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 with ERC7821 Execution upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Upgradeable, ERC7821 {␊ + constructor() EIP712("MyAccount", "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);␊ + }␊ + ␊ + 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 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + 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);␊ + }␊ + ␊ + // 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 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 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable {␊ + constructor() {␊ + _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);␊ + }␊ + ␊ + // 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 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 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913Upgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + 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);␊ + }␊ + ␊ + // 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 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 upgradeable transparent + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/proxy/utils/Initializable.sol";␊ + import {MultiSignerERC7913Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913Upgradeable.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ + ␊ + /// @custom:oz-upgrades-unsafe-allow constructor␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913Upgradeable {␊ + constructor() EIP712("MyAccount", "1") {␊ + _disableInitializers();␊ + }␊ + ␊ + 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) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ + }␊ + ␊ + 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);␊ + }␊ + ␊ + // 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 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 SignerMultisigWeighted named non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.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)␊ + {}␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ + }␊ + ␊ + 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 SignerMultisigWeighted with ERC1271 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.0␊ + pragma solidity ^0.8.27;␊ + ␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + ␊ + contract CustomAccountWithSignerMultisigWeightedERC1271 is Account, MultiSignerERC7913Weighted {␊ + constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + MultiSignerERC7913Weighted(signers, weights, threshold)␊ + {}␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ + }␊ + ␊ + 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 SignerMultisigWeighted with ERC7739 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.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)␊ + {}␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ + }␊ + ␊ + 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 SignerMultisigWeighted with ERC721Holder non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + ␊ + 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 setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ + }␊ + ␊ + 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 SignerMultisigWeighted with ERC1155Holder non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ + }␊ + ␊ + 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 SignerMultisigWeighted with ERC721Holder and ERC1155Holder non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.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)␊ + {}␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ + }␊ + ␊ + 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 SignerMultisigWeighted with ERC7821 Execution non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.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)␊ + {}␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ + }␊ + ␊ + 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 SignerMultisigWeighted with ERC7579 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.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)␊ + {}␊ + ␊ + 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 setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ + }␊ + ␊ + 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 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 SignerMultisigWeighted with ERC7579 with ERC1271 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {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 Account, AccountERC7579, MultiSignerERC7913Weighted {␊ + constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + MultiSignerERC7913Weighted(signers, weights, threshold)␊ + {}␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ + }␊ + ␊ + 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 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 SignerMultisigWeighted with ERC7579 with ERC7739 non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.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)␊ + {}␊ + ␊ + 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 setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ + }␊ + ␊ + 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 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 SignerMultisigWeighted with ERC7579 hooks non-upgradeable + +> Snapshot 1 + + `// SPDX-License-Identifier: MIT␊ + // Compatible with OpenZeppelin Contracts ^5.0.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 {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ + import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.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)␊ + {}␊ + ␊ + 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 setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ + }␊ + ␊ + 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.␊ @@ -2101,14 +8754,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 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(SignerRSA, AbstractSigner, AccountERC7579)␊ + override(MultiSignerERC7913, AbstractSigner, AccountERC7579)␊ returns (bool)␊ {␊ return super._rawSignatureValidation(hash, signature);␊ @@ -2116,7 +8769,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisig named +## Account with SignerMultisigWeighted named upgradeable uups > Snapshot 1 @@ -2124,24 +8777,31 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerMultisig is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913 {␊ - constructor() EIP712("CustomAccount with SignerMultisig", "1") {␊ + contract CustomAccountWithSignerMultisigWeighted is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + constructor() EIP712("CustomAccount with SignerMultisigWeighted", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisig(bytes[] memory signers, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -2152,13 +8812,19 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerMultisig with ERC1271 +## Account with SignerMultisigWeighted with ERC1271 upgradeable uups > Snapshot 1 @@ -2166,32 +8832,29 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerMultisigERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913 {␊ + contract CustomAccountWithSignerMultisigWeightedERC1271 is Initializable, Account, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ constructor() {␊ _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);␊ }␊ ␊ - function initializeMultisig(bytes[] memory signers, uint256 threshold)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ - initializer␊ + onlyEntryPointOrSelf␊ {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -2202,13 +8865,19 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerMultisig with ERC7739 +## Account with SignerMultisigWeighted with ERC7739 upgradeable uups > Snapshot 1 @@ -2216,24 +8885,33 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerMultisigERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913 {␊ - constructor() EIP712("CustomAccount with SignerMultisigERC7739", "1") {␊ + contract CustomAccountWithSignerMultisigWeightedERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC7739", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisig(bytes[] memory signers, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -2244,13 +8922,19 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerMultisig with ERC721Holder +## Account with SignerMultisigWeighted with ERC721Holder upgradeable uups > Snapshot 1 @@ -2258,25 +8942,34 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerMultisigERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913, ERC721Holder {␊ - constructor() EIP712("CustomAccount with SignerMultisigERC721Holder", "1") {␊ + contract CustomAccountWithSignerMultisigWeightedERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder, UUPSUpgradeable {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC721Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisig(bytes[] memory signers, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -2287,13 +8980,19 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerMultisig with ERC1155Holder +## Account with SignerMultisigWeighted with ERC1155Holder upgradeable uups > Snapshot 1 @@ -2301,25 +9000,34 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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 {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerMultisigERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913, ERC1155Holder {␊ - constructor() EIP712("CustomAccount with SignerMultisigERC1155Holder", "1") {␊ + contract CustomAccountWithSignerMultisigWeightedERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC1155Holder, UUPSUpgradeable {␊ + constructor()␊ + EIP712("CustomAccount with SignerMultisigWeightedERC1155Holder", "1")␊ + {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisig(bytes[] memory signers, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -2330,13 +9038,19 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerMultisig with ERC721Holder and ERC1155Holder +## Account with SignerMultisigWeighted with ERC721Holder and ERC1155Holder upgradeable uups > Snapshot 1 @@ -2344,28 +9058,35 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerMultisigERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913, ERC721Holder, ERC1155Holder {␊ + contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder, ERC1155Holder, UUPSUpgradeable {␊ constructor()␊ - EIP712("CustomAccount with SignerMultisigERC721HolderERC1155Holder", "1")␊ + EIP712("CustomAccount with SignerMultisigWeightedERC721HolderERC1155Holder", "1")␊ {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisig(bytes[] memory signers, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -2376,13 +9097,19 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerMultisig with ERC7821 Execution +## Account with SignerMultisigWeighted with ERC7821 Execution upgradeable uups > Snapshot 1 @@ -2390,25 +9117,32 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/community-contracts/account/extensions/ERC7821.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/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ + import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913, ERC7821 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC7821, UUPSUpgradeable {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisig(bytes[] memory signers, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -2419,7 +9153,7 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ ␊ @@ -2431,10 +9165,16 @@ Generated by [AVA](https://avajs.dev). {␊ return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);␊ }␊ + ␊ + function _authorizeUpgrade(address newImplementation)␊ + internal␊ + override␊ + onlyEntryPointOrSelf␊ + {}␊ }␊ ` -## Account with SignerMultisig with ERC7579 +## Account with SignerMultisigWeighted with ERC7579 upgradeable uups > Snapshot 1 @@ -2442,17 +9182,19 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.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/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ @@ -2460,7 +9202,7 @@ Generated by [AVA](https://avajs.dev). 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).␊ @@ -2469,12 +9211,18 @@ Generated by [AVA](https://avajs.dev). return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ - function initializeMultisig(bytes[] memory signers, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -2485,22 +9233,28 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + 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 SignerMultisig is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisig)␊ + // 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)␊ @@ -2514,7 +9268,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisig with ERC7579 with ERC1271 +## Account with SignerMultisigWeighted with ERC7579 with ERC1271 upgradeable uups > Snapshot 1 @@ -2522,26 +9276,33 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + 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 {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.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/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579, MultiSignerERC7913 {␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ constructor() {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisig(bytes[] memory signers, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -2552,31 +9313,28 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + 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)␊ - 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 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)␊ @@ -2590,7 +9348,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisig with ERC7579 with ERC7739 +## Account with SignerMultisigWeighted with ERC7579 with ERC7739 upgradeable uups > Snapshot 1 @@ -2598,17 +9356,19 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.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/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ @@ -2616,7 +9376,7 @@ Generated by [AVA](https://avajs.dev). 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).␊ @@ -2625,12 +9385,18 @@ Generated by [AVA](https://avajs.dev). return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ - function initializeMultisig(bytes[] memory signers, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -2641,22 +9407,28 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + 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 SignerMultisig is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisig)␊ + // 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)␊ @@ -2670,7 +9442,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisig with ERC7579 hooks +## Account with SignerMultisigWeighted with ERC7579 hooks upgradeable uups > Snapshot 1 @@ -2678,18 +9450,20 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {AccountERC7579Hooked} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579Hooked.sol";␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.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/proxy/utils/UUPSUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Hooked, MultiSignerERC7913 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913WeightedUpgradeable, UUPSUpgradeable {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ @@ -2697,7 +9471,7 @@ Generated by [AVA](https://avajs.dev). 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).␊ @@ -2706,12 +9480,18 @@ Generated by [AVA](https://avajs.dev). return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ - function initializeMultisig(bytes[] memory signers, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ + ␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ + public␊ + onlyEntryPointOrSelf␊ + {␊ + _setSignerWeights(signers, weights);␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -2722,22 +9502,28 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + 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 SignerMultisig is most derived than AccountERC7579␊ - // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisig)␊ + // 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)␊ @@ -2751,7 +9537,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisigWeighted named +## Account with SignerMultisigWeighted named upgradeable transparent > Snapshot 1 @@ -2759,28 +9545,26 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913Weighted.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerMultisigWeighted is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Weighted {␊ + contract CustomAccountWithSignerMultisigWeighted is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable {␊ constructor() EIP712("CustomAccount with SignerMultisigWeighted", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisigWeighted(bytes[] memory signers, uint256[] memory weights, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ - function setSignerWeights(bytes[] memory signers, uint256[] memory weights)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ onlyEntryPointOrSelf␊ {␊ @@ -2795,13 +9579,13 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC1271 +## Account with SignerMultisigWeighted with ERC1271 upgradeable transparent > Snapshot 1 @@ -2809,36 +9593,24 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913Weighted.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerMultisigWeightedERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913Weighted {␊ + contract CustomAccountWithSignerMultisigWeightedERC1271 is Initializable, Account, MultiSignerERC7913WeightedUpgradeable {␊ constructor() {␊ _disableInitializers();␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ - view␊ - override␊ - returns (bytes4)␊ - {␊ - return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ - }␊ - ␊ - function initializeMultisigWeighted(bytes[] memory signers, uint256[] memory weights, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ - function setSignerWeights(bytes[] memory signers, uint256[] memory weights)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ onlyEntryPointOrSelf␊ {␊ @@ -2853,13 +9625,13 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7739 +## Account with SignerMultisigWeighted with ERC7739 upgradeable transparent > Snapshot 1 @@ -2867,30 +9639,28 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913Weighted.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerMultisigWeightedERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Weighted {␊ + contract CustomAccountWithSignerMultisigWeightedERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable {␊ constructor()␊ EIP712("CustomAccount with SignerMultisigWeightedERC7739", "1")␊ {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisigWeighted(bytes[] memory signers, uint256[] memory weights, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ - function setSignerWeights(bytes[] memory signers, uint256[] memory weights)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ onlyEntryPointOrSelf␊ {␊ @@ -2905,13 +9675,13 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC721Holder +## Account with SignerMultisigWeighted with ERC721Holder upgradeable transparent > Snapshot 1 @@ -2919,31 +9689,29 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913Weighted.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerMultisigWeightedERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC721Holder {␊ + contract CustomAccountWithSignerMultisigWeightedERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder {␊ constructor()␊ EIP712("CustomAccount with SignerMultisigWeightedERC721Holder", "1")␊ {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisigWeighted(bytes[] memory signers, uint256[] memory weights, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ - function setSignerWeights(bytes[] memory signers, uint256[] memory weights)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ onlyEntryPointOrSelf␊ {␊ @@ -2958,13 +9726,13 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC1155Holder +## Account with SignerMultisigWeighted with ERC1155Holder upgradeable transparent > Snapshot 1 @@ -2972,31 +9740,29 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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 {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913Weighted.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerMultisigWeightedERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC1155Holder {␊ + contract CustomAccountWithSignerMultisigWeightedERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC1155Holder {␊ constructor()␊ EIP712("CustomAccount with SignerMultisigWeightedERC1155Holder", "1")␊ {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisigWeighted(bytes[] memory signers, uint256[] memory weights, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ - function setSignerWeights(bytes[] memory signers, uint256[] memory weights)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ onlyEntryPointOrSelf␊ {␊ @@ -3011,13 +9777,13 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC721Holder and ERC1155Holder +## Account with SignerMultisigWeighted with ERC721Holder and ERC1155Holder upgradeable transparent > Snapshot 1 @@ -3025,32 +9791,30 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913Weighted.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC721Holder, ERC1155Holder {␊ + contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC721Holder, ERC1155Holder {␊ constructor()␊ EIP712("CustomAccount with SignerMultisigWeightedERC721HolderERC1155Holder", "1")␊ {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisigWeighted(bytes[] memory signers, uint256[] memory weights, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ - function setSignerWeights(bytes[] memory signers, uint256[] memory weights)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ onlyEntryPointOrSelf␊ {␊ @@ -3065,13 +9829,13 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ }␊ ` -## Account with SignerMultisigWeighted with ERC7821 Execution +## Account with SignerMultisigWeighted with ERC7821 Execution upgradeable transparent > Snapshot 1 @@ -3079,29 +9843,27 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ - import {ERC7739} from "@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol";␊ - import {ERC7821} from "@openzeppelin/community-contracts/account/extensions/ERC7821.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/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913Weighted.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC7821 {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913WeightedUpgradeable, ERC7821 {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisigWeighted(bytes[] memory signers, uint256[] memory weights, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ - function setSignerWeights(bytes[] memory signers, uint256[] memory weights)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ onlyEntryPointOrSelf␊ {␊ @@ -3116,7 +9878,7 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ ␊ @@ -3131,7 +9893,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisigWeighted with ERC7579 +## Account with SignerMultisigWeighted with ERC7579 upgradeable transparent > Snapshot 1 @@ -3139,18 +9901,18 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913Weighted.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913Weighted {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ @@ -3158,7 +9920,7 @@ Generated by [AVA](https://avajs.dev). 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).␊ @@ -3167,16 +9929,14 @@ Generated by [AVA](https://avajs.dev). return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ - function initializeMultisigWeighted(bytes[] memory signers, uint256[] memory weights, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ - function setSignerWeights(bytes[] memory signers, uint256[] memory weights)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ onlyEntryPointOrSelf␊ {␊ @@ -3191,7 +9951,7 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ ␊ @@ -3199,7 +9959,7 @@ 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);␊ @@ -3220,7 +9980,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisigWeighted with ERC7579 with ERC1271 +## Account with SignerMultisigWeighted with ERC7579 with ERC1271 upgradeable transparent > Snapshot 1 @@ -3228,31 +9988,28 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ + 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 {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913Weighted.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579, MultiSignerERC7913Weighted {␊ + contract MyAccount is Initializable, Account, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable {␊ constructor() {␊ _disableInitializers();␊ }␊ ␊ - function initializeMultisigWeighted(bytes[] memory signers, uint256[] memory weights, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ - function setSignerWeights(bytes[] memory signers, uint256[] memory weights)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ onlyEntryPointOrSelf␊ {␊ @@ -3267,7 +10024,7 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ ␊ @@ -3275,20 +10032,11 @@ 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 SignerMultisigWeighted is most derived than AccountERC7579␊ // in the inheritance chain (i.e. contract ... is AccountERC7579, ..., SignerMultisigWeighted)␊ @@ -3305,7 +10053,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisigWeighted with ERC7579 with ERC7739 +## Account with SignerMultisigWeighted with ERC7579 with ERC7739 upgradeable transparent > Snapshot 1 @@ -3313,18 +10061,18 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ + 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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913Weighted.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913Weighted {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Upgradeable, MultiSignerERC7913WeightedUpgradeable {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ @@ -3332,7 +10080,7 @@ Generated by [AVA](https://avajs.dev). 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).␊ @@ -3341,16 +10089,14 @@ Generated by [AVA](https://avajs.dev). return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ - function initializeMultisigWeighted(bytes[] memory signers, uint256[] memory weights, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ - function setSignerWeights(bytes[] memory signers, uint256[] memory weights)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ onlyEntryPointOrSelf␊ {␊ @@ -3365,7 +10111,7 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ ␊ @@ -3373,7 +10119,7 @@ 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);␊ @@ -3394,7 +10140,7 @@ Generated by [AVA](https://avajs.dev). }␊ ` -## Account with SignerMultisigWeighted with ERC7579 hooks +## Account with SignerMultisigWeighted with ERC7579 hooks upgradeable transparent > Snapshot 1 @@ -3402,19 +10148,19 @@ Generated by [AVA](https://avajs.dev). // Compatible with OpenZeppelin Contracts ^5.0.0␊ pragma solidity ^0.8.27;␊ ␊ - import {AbstractSigner} from "@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol";␊ - import {Account} from "@openzeppelin/community-contracts/account/Account.sol";␊ - import {AccountERC7579} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol";␊ - import {AccountERC7579Hooked} from "@openzeppelin/community-contracts/account/extensions/AccountERC7579Hooked.sol";␊ + import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ + import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.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/community-contracts/utils/cryptography/ERC7739.sol";␊ + import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ - import {MultiSignerERC7913} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol";␊ - import {MultiSignerERC7913Weighted} from "@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913Weighted.sol";␊ + import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ + import {MultiSignerERC7913WeightedUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/signers/MultiSignerERC7913WeightedUpgradeable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ /// @custom:oz-upgrades-unsafe-allow constructor␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Hooked, MultiSignerERC7913Weighted {␊ + contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579HookedUpgradeable, MultiSignerERC7913WeightedUpgradeable {␊ constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ @@ -3422,7 +10168,7 @@ Generated by [AVA](https://avajs.dev). 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).␊ @@ -3431,16 +10177,14 @@ Generated by [AVA](https://avajs.dev). return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ ␊ - function initializeMultisigWeighted(bytes[] memory signers, uint256[] memory weights, uint256 threshold)␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ public␊ initializer␊ {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ - function setSignerWeights(bytes[] memory signers, uint256[] memory weights)␊ + function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ onlyEntryPointOrSelf␊ {␊ @@ -3455,7 +10199,7 @@ Generated by [AVA](https://avajs.dev). _removeSigners(signers);␊ }␊ ␊ - function setThreshold(uint256 threshold) public onlyEntryPointOrSelf {␊ + function setThreshold(uint64 threshold) public onlyEntryPointOrSelf {␊ _setThreshold(threshold);␊ }␊ ␊ @@ -3463,7 +10207,7 @@ 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);␊ diff --git a/packages/core/solidity/src/account.test.ts.snap b/packages/core/solidity/src/account.test.ts.snap index 13cd60956..9f2039436 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 da79a0809..da4bfeab1 100644 --- a/packages/core/solidity/src/account.ts +++ b/packages/core/solidity/src/account.ts @@ -4,6 +4,7 @@ import { defineFunctions } from './utils/define-functions'; import { printContract } from './print'; import { defaults as commonDefaults, withCommonDefaults, type CommonOptions } from './common-options'; import { setInfo } from './set-info'; +import { setUpgradeableAccount } from './set-upgradeable'; import { addSigner, signerFunctions, signers, type SignerOptions } from './signer'; export const defaults: Required = { @@ -53,13 +54,13 @@ export function printAccount(opts: AccountOptions = defaults): string { export function buildAccount(opts: AccountOptions): Contract { const allOpts = withDefaults(opts); - allOpts.upgradeable = false; // Upgradeability is not yet available for the community contracts allOpts.access = false; // Access control options are not used for Account const c = new ContractBuilder(allOpts.name); addParents(c, allOpts); overrideRawSignatureValidation(c, allOpts); + setUpgradeableAccount(c, allOpts.upgradeable); setInfo(c, allOpts.info); if (opts.ERC7579Modules) { @@ -76,7 +77,7 @@ function addParents(c: ContractBuilder, opts: AccountOptions): void { // Base c.addParent({ name: 'Account', - path: `@openzeppelin/community-contracts/account/Account.sol`, + path: `@openzeppelin/contracts/account/Account.sol`, }); c.addOverride({ name: 'Account' }, functions._validateUserOp); @@ -85,7 +86,7 @@ function addParents(c: ContractBuilder, opts: AccountOptions): void { // Extensions addSignatureValidation(c, opts); addERC7579Modules(c, opts); - addSigner(c, opts.signer ?? false); + addSigner(c, opts.signer ?? false, opts.upgradeable); addMultisigFunctions(c, opts); addBatchedExecution(c, opts); addERC721Holder(c, opts); @@ -93,28 +94,24 @@ function addParents(c: ContractBuilder, opts: AccountOptions): void { } function addSignatureValidation(c: ContractBuilder, opts: AccountOptions) { - switch (opts.signatureValidation) { - case 'ERC7739': - c.addParent({ - name: 'ERC7739', - path: '@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol', - }); - break; - case 'ERC1271': - c.addParent({ - name: 'IERC1271', - path: '@openzeppelin/contracts/interfaces/IERC1271.sol', - }); - c.addOverride({ name: 'IERC1271' }, functions.isValidSignature); - if (!opts.ERC7579Modules) { - c.setFunctionBody( - [ - 'return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);', - ], - functions.isValidSignature, - ); - } - break; + if (opts.signatureValidation === 'ERC7739') { + c.addParent({ + name: 'ERC7739', + path: '@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol', + }); + } else if (opts.signatureValidation === 'ERC1271' && !opts.signatureValidation) { + c.addParent({ + name: 'IERC1271', + path: '@openzeppelin/contracts/interfaces/IERC1271.sol', + }); + c.addOverride({ name: 'IERC1271' }, functions.isValidSignature); + c.setFunctionBody( + ['return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);'], + functions.isValidSignature, + ); + } else { + // ERC1271 is natively supported by ERC-7579, no need to expose ERC-1271 manually + // do nothing } } @@ -139,7 +136,7 @@ function addBatchedExecution(c: ContractBuilder, opts: AccountOptions): void { if (!opts.batchedExecution || !!opts.ERC7579Modules) return; c.addParent({ name: 'ERC7821', - path: '@openzeppelin/community-contracts/account/extensions/ERC7821.sol', + path: '@openzeppelin/contracts/account/extensions/draft-ERC7821.sol', }); c.addOverride({ name: 'ERC7821' }, functions._erc7821AuthorizedExecutor); c.setFunctionBody( @@ -150,30 +147,48 @@ function addBatchedExecution(c: ContractBuilder, opts: AccountOptions): void { function addERC7579Modules(c: ContractBuilder, opts: AccountOptions): void { if (!opts.ERC7579Modules) return; - c.addParent({ - name: opts.ERC7579Modules, - path: `@openzeppelin/community-contracts/account/extensions/${opts.ERC7579Modules}.sol`, - }); - if (opts.ERC7579Modules !== 'AccountERC7579') { - c.addImportOnly({ - name: 'AccountERC7579', - path: `@openzeppelin/community-contracts/account/extensions/AccountERC7579.sol`, + + if (opts.upgradeable === false) { + c.addParent({ + name: opts.ERC7579Modules, + path: `@openzeppelin/contracts/account/extensions/draft-${opts.ERC7579Modules}.sol`, }); + if (opts.ERC7579Modules !== 'AccountERC7579') { + c.addImportOnly({ + name: 'AccountERC7579', + path: `@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol`, + }); + } + c.addOverride({ name: 'AccountERC7579' }, functions.isValidSignature); + c.addOverride({ name: 'AccountERC7579' }, functions._validateUserOp); + } else { + c.addParent({ + name: opts.ERC7579Modules + 'Upgradeable', + path: `@openzeppelin/contracts-upgradeable/account/extensions/draft-${opts.ERC7579Modules}Upgradeable.sol`, + }); + if (opts.ERC7579Modules !== 'AccountERC7579') { + c.addImportOnly({ + name: 'AccountERC7579Upgradeable', + path: `@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol`, + }); + } + c.addOverride({ name: 'AccountERC7579Upgradeable' }, functions.isValidSignature); + c.addOverride({ name: 'AccountERC7579Upgradeable' }, functions._validateUserOp); } - c.addOverride({ name: 'AccountERC7579' }, functions.isValidSignature); - c.addOverride({ name: 'AccountERC7579' }, functions._validateUserOp); - if (opts.signatureValidation !== 'ERC7739') return; - c.addOverride({ name: 'ERC7739' }, functions.isValidSignature); - c.setFunctionBody( - [ - '// 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;', - ], - functions.isValidSignature, - ); + // ERC-7579 provides ERC-1271 interface. If ERC-7739 is enabled, we need to reconcile + if (opts.signatureValidation === 'ERC7739') { + c.addOverride({ name: 'ERC7739' }, functions.isValidSignature); + c.setFunctionBody( + [ + '// 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;', + ], + functions.isValidSignature, + ); + } } function addMultisigFunctions(c: ContractBuilder, opts: AccountOptions): void { @@ -198,7 +213,7 @@ function addMultisigFunctions(c: ContractBuilder, opts: AccountOptions): void { } function addEIP712(c: ContractBuilder, opts: AccountOptions): void { - if (opts.signatureValidation != 'ERC7739') return; + if (opts.signatureValidation !== 'ERC7739') return; c.addParent( { name: 'EIP712', @@ -224,7 +239,7 @@ function overrideRawSignatureValidation(c: ContractBuilder, opts: AccountOptions if (opts.signer && opts.ERC7579Modules) { c.addImportOnly({ name: 'AbstractSigner', - path: '@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol', + path: '@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol', }); c.addOverride({ name: 'AbstractSigner' }, signerFunctions._rawSignatureValidation); c.addOverride({ name: 'AccountERC7579' }, signerFunctions._rawSignatureValidation); @@ -244,53 +259,51 @@ 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: 'uint256' }], - }, - setSignerWeights: { - kind: 'public' as const, - args: [ - { name: 'signers', type: 'bytes[] memory' }, - { name: 'weights', type: 'uint256[] memory' }, - ], - }, - }), -}; +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/set-upgradeable.ts b/packages/core/solidity/src/set-upgradeable.ts index bdd72198d..1024ef19b 100644 --- a/packages/core/solidity/src/set-upgradeable.ts +++ b/packages/core/solidity/src/set-upgradeable.ts @@ -58,6 +58,13 @@ export function setUpgradeableGovernor(c: ContractBuilder, upgradeable: Upgradea }); } +export function setUpgradeableAccount(c: ContractBuilder, upgradeable: Upgradeable) { + setUpgradeableBase(c, upgradeable, () => { + c.addModifier('onlyEntryPointOrSelf', functions._authorizeUpgrade); + }); + c.upgradeable = false; +} + const functions = defineFunctions({ _authorizeUpgrade: { args: [{ name: 'newImplementation', type: 'address' }], diff --git a/packages/core/solidity/src/signer.ts b/packages/core/solidity/src/signer.ts index 09e2cd111..18b5fb764 100644 --- a/packages/core/solidity/src/signer.ts +++ b/packages/core/solidity/src/signer.ts @@ -1,110 +1,124 @@ import type { ContractBuilder } from './contract'; +import type { Upgradeable } from './set-upgradeable'; import { defineFunctions } from './utils/define-functions'; export const SignerOptions = [false, 'ERC7702', 'ECDSA', 'P256', 'RSA', 'Multisig', 'MultisigWeighted'] as const; export type SignerOptions = (typeof SignerOptions)[number]; -export function addSigner(c: ContractBuilder, signer: SignerOptions): void { - if (!signer) return; - - c.addParent(signers[signer]); - c.addOverride( - { name: signer === 'MultisigWeighted' ? signers.Multisig.name : signers[signer].name }, - signerFunctions._rawSignatureValidation, - ); - - // ERC-7702 doesn't require initialization - if (signer === 'ERC7702') return; - - c.addParent({ - name: 'Initializable', - path: '@openzeppelin/contracts/proxy/utils/Initializable.sol', - }); - - // Add locking constructor - c.addNatspecTag('@custom:oz-upgrades-unsafe-allow', 'constructor'); - c.addConstructorCode(`_disableInitializers();`); - - // Add initializer - const fn = signerFunctions[`initialize${signer}`]; - c.addModifier('initializer', fn); - +export function addSigner(c: ContractBuilder, signer: SignerOptions, upgradeable: Upgradeable = false): void { + // Add parent, and constructor/initializer logic switch (signer) { - case 'Multisig': - c.addFunctionCode(`_addSigners(${fn.args[0]!.name});`, fn); - c.addFunctionCode(`_setThreshold(${fn.args[1]!.name});`, fn); - break; - case 'MultisigWeighted': - c.addFunctionCode(`_addSigners(${fn.args[0]!.name});`, fn); - c.addFunctionCode(`_setSignerWeights(${fn.args[0]!.name}, ${fn.args[1]!.name});`, fn); - c.addFunctionCode(`_setThreshold(${fn.args[2]!.name});`, fn); + case false: { + return; + } + case 'ERC7702': { + // Add locking constructor + c.addNatspecTag('@custom:oz-upgrades-unsafe-allow', 'constructor'); + c.addConstructorCode(`_disableInitializers();`); + + // todo: error if upgradeable is set ? + c.addParent(signers[signer]); break; + } case 'ECDSA': case 'P256': case 'RSA': - c.addFunctionCode(`_setSigner(${fn.args.map(({ name }) => name).join(', ')});`, fn); + case 'Multisig': + case 'MultisigWeighted': { + const { args } = signerFunctions[signer]; + if (upgradeable === false) { + // Add constructor args, and pass to (non-upgradeable) parent + args.forEach(arg => c.addConstructorArgument(arg)); + c.addParent( + signers[signer], + args.map(arg => ({ lit: arg.name })), + ); + } else { + // Add upgradeable parent and initializer + c.addParent({ + name: signers[signer].name + 'Upgradeable', + path: signers[signer].path + .replace('@openzeppelin/contracts/', '@openzeppelin/contracts-upgradeable/') + .replace('.sol', 'Upgradeable.sol'), + }); + const fn = { name: 'initialize', kind: 'public' as const, args }; + c.addFunctionCode(`__${signers[signer].name}_init(${args.map(arg => arg.name).join(', ')});`, fn); + c.addModifier('initializer', fn); + + // Add locking constructor + c.addNatspecTag('@custom:oz-upgrades-unsafe-allow', 'constructor'); + c.addConstructorCode(`_disableInitializers();`); + } + break; + } } + + // override + c.addOverride( + { name: signer === 'MultisigWeighted' ? signers.Multisig.name : signers[signer].name }, + signerFunctions._rawSignatureValidation, + ); } export const signers = { ERC7702: { name: 'SignerERC7702', - path: '@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.sol', + path: '@openzeppelin/contracts/utils/cryptography/signers/SignerERC7702.sol', }, ECDSA: { name: 'SignerECDSA', - path: '@openzeppelin/community-contracts/utils/cryptography/SignerECDSA.sol', + path: '@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol', }, P256: { name: 'SignerP256', - path: '@openzeppelin/community-contracts/utils/cryptography/SignerP256.sol', + path: '@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol', }, RSA: { name: 'SignerRSA', - path: '@openzeppelin/community-contracts/utils/cryptography/SignerRSA.sol', + path: '@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol', }, Multisig: { name: 'MultiSignerERC7913', - path: '@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913.sol', + path: '@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol', }, MultisigWeighted: { name: 'MultiSignerERC7913Weighted', - path: '@openzeppelin/community-contracts/utils/cryptography/MultiSignerERC7913Weighted.sol', + path: '@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol', }, }; export const signerFunctions = defineFunctions({ - initializeECDSA: { + ECDSA: { kind: 'public' as const, args: [{ name: 'signer', type: 'address' }], }, - initializeP256: { + P256: { kind: 'public' as const, args: [ { name: 'qx', type: 'bytes32' }, { name: 'qy', type: 'bytes32' }, ], }, - initializeRSA: { + RSA: { kind: 'public' as const, args: [ { name: 'e', type: 'bytes memory' }, { name: 'n', type: 'bytes memory' }, ], }, - initializeMultisig: { + Multisig: { kind: 'public' as const, args: [ { name: 'signers', type: 'bytes[] memory' }, - { name: 'threshold', type: 'uint256' }, + { name: 'threshold', type: 'uint64' }, ], }, - initializeMultisigWeighted: { + MultisigWeighted: { kind: 'public' as const, args: [ { name: 'signers', type: 'bytes[] memory' }, - { name: 'weights', type: 'uint256[] memory' }, - { name: 'threshold', type: 'uint256' }, + { name: 'weights', type: 'uint64[] memory' }, + { name: 'threshold', type: 'uint64' }, ], }, _rawSignatureValidation: { diff --git a/yarn.lock b/yarn.lock index fea3f75d2..668d1001c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -809,15 +809,15 @@ version "0.0.1" resolved "https://github.com/OpenZeppelin/openzeppelin-community-contracts#de17c8ee4b0329867f7219fbc401707be9518ff1" -"@openzeppelin/contracts-upgradeable@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-5.3.0.tgz#79dba09ab0b4bb49f21544ea738b9de016b0ceea" - integrity sha512-yVzSSyTMWO6rapGI5tuqkcLpcGGXA0UA1vScyV5EhE5yw8By3Ewex9rDUw8lfVw0iTkvR/egjfcW5vpk03lqZg== - -"@openzeppelin/contracts@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.3.0.tgz#0a90ce16f5c855e3c8239691f1722cd4999ae741" - integrity sha512-zj/KGoW7zxWUE8qOI++rUM18v+VeLTTzKs/DJFkSzHpQFPD/jKKF0TrMxBfGLl3kpdELCNccvB3zmofSzm4nlA== +"@openzeppelin/contracts-upgradeable@^5.4.0-rc.1": + version "5.4.0-rc.1" + resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-5.4.0-rc.1.tgz#516321ca686a98b60fae970b2989c602f9676c99" + integrity sha512-C/ymvZGimHV64/ejdER3f2s5xZO7zzEUsfUBZ/QHD4CUby9eED/60joK/DaIiV3Qgb2UTKUGYnrPJOKcZnmsDw== + +"@openzeppelin/contracts@^5.4.0-rc.1": + version "5.4.0-rc.1" + resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.4.0-rc.1.tgz#a2c0c500d90fb50c24f21afa0ecb05444f2cd366" + integrity sha512-W6tKK2LNjYZysKhWYhFRbtnKdnsGb8TKQ2eNnLpLtA1yyuraFATdHStGT7YryXKN6lcWHoFY3HPeDdbuje4YOg== "@pkgjs/parseargs@^0.11.0": version "0.11.0"