diff --git a/.changeset/lovely-groups-run.md b/.changeset/lovely-groups-run.md new file mode 100644 index 000000000..9bbc9f7ae --- /dev/null +++ b/.changeset/lovely-groups-run.md @@ -0,0 +1,5 @@ +--- +'@openzeppelin/wizard': patch +--- + +Remove all initializers from non-upgradeable accounts. diff --git a/packages/core/solidity/src/account.test.ts.md b/packages/core/solidity/src/account.test.ts.md index 59f7f04d9..1ea211d9d 100644 --- a/packages/core/solidity/src/account.test.ts.md +++ b/packages/core/solidity/src/account.test.ts.md @@ -411,6 +411,10 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("CustomAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize() public initializer {␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ @@ -448,6 +452,10 @@ Generated by [AVA](https://avajs.dev). constructor() {␊ _disableInitializers();␊ }␊ + ␊ + function initialize() public initializer {␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -495,6 +503,10 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("CustomAccountERC7739", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize() public initializer {␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ @@ -534,6 +546,10 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("CustomAccountERC721Holder", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize() public initializer {␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ @@ -573,6 +589,10 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("CustomAccountERC1155Holder", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize() public initializer {␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ @@ -613,6 +633,10 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("CustomAccountERC721HolderERC1155Holder", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize() public initializer {␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function _rawSignatureValidation(bytes32 hash, bytes calldata signature)␊ internal␊ @@ -652,6 +676,10 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize() public initializer {␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ internal␊ @@ -706,6 +734,9 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ + __UUPSUpgradeable_init();␊ + ␊ require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ _installModule(moduleTypeId, module, initData);␊ }␊ @@ -765,6 +796,9 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ + __UUPSUpgradeable_init();␊ + ␊ require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ _installModule(moduleTypeId, module, initData);␊ }␊ @@ -822,6 +856,9 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ + __UUPSUpgradeable_init();␊ + ␊ require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ _installModule(moduleTypeId, module, initData);␊ }␊ @@ -865,8 +902,8 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ 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 {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ @@ -883,6 +920,9 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579Hooked_init();␊ + __UUPSUpgradeable_init();␊ + ␊ require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ _installModule(moduleTypeId, module, initData);␊ }␊ @@ -1181,6 +1221,8 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ + ␊ require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ _installModule(moduleTypeId, module, initData);␊ }␊ @@ -1233,6 +1275,8 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ + ␊ require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ _installModule(moduleTypeId, module, initData);␊ }␊ @@ -1283,6 +1327,8 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ + ␊ require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ _installModule(moduleTypeId, module, initData);␊ }␊ @@ -1320,8 +1366,8 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ 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 {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ @@ -1337,6 +1383,8 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579Hooked_init();␊ + ␊ require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);␊ _installModule(moduleTypeId, module, initData);␊ }␊ @@ -1743,23 +1791,13 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract CustomAccountWithSignerECDSA is Initializable, Account, EIP712, ERC7739, SignerECDSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerECDSA is Account, EIP712, ERC7739, SignerECDSA {␊ constructor(address signer)␊ EIP712("CustomAccount with SignerECDSA", "1")␊ SignerECDSA(signer)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ + {}␊ }␊ ` @@ -1773,16 +1811,10 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC1271 is Initializable, Account, IERC1271, SignerECDSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor(address signer) SignerECDSA(signer) {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + contract CustomAccountWithSignerECDSAERC1271 is Account, IERC1271, SignerECDSA {␊ + constructor(address signer) SignerECDSA(signer) {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -1792,10 +1824,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ }␊ ` @@ -1810,23 +1838,13 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerECDSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerECDSAERC7739 is Account, EIP712, ERC7739, SignerECDSA {␊ constructor(address signer)␊ EIP712("CustomAccount with SignerECDSAERC7739", "1")␊ SignerECDSA(signer)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ + {}␊ }␊ ` @@ -1842,23 +1860,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerECDSA, ERC721Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerECDSAERC721Holder is Account, EIP712, ERC7739, SignerECDSA, ERC721Holder {␊ constructor(address signer)␊ EIP712("CustomAccount with SignerECDSAERC721Holder", "1")␊ SignerECDSA(signer)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ + {}␊ }␊ ` @@ -1874,23 +1882,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSA, ERC1155Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerECDSAERC1155Holder is Account, EIP712, ERC7739, SignerECDSA, ERC1155Holder {␊ constructor(address signer)␊ EIP712("CustomAccount with SignerECDSAERC1155Holder", "1")␊ SignerECDSA(signer)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ + {}␊ }␊ ` @@ -1907,23 +1905,13 @@ Generated by [AVA](https://avajs.dev). import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerECDSA, ERC721Holder, ERC1155Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerECDSAERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerECDSA, ERC721Holder, ERC1155Holder {␊ constructor(address signer)␊ EIP712("CustomAccount with SignerECDSAERC721HolderERC1155Holder", "1")␊ SignerECDSA(signer)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ + {}␊ }␊ ` @@ -1939,20 +1927,10 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerECDSA, ERC7821 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ + 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␊ @@ -1978,17 +1956,11 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, SignerECDSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerECDSA {␊ + constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -2001,10 +1973,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -2043,21 +2011,11 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579, SignerECDSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor(address signer) SignerECDSA(signer) {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ + contract MyAccount is Account, IERC1271, AccountERC7579, SignerECDSA {␊ + constructor(address signer) SignerECDSA(signer) {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -2106,17 +2064,11 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, SignerECDSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerECDSA {␊ + constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -2129,10 +2081,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -2173,17 +2121,11 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Hooked, SignerECDSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerECDSA {␊ + constructor(address signer) EIP712("MyAccount", "1") SignerECDSA(signer) {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -2196,10 +2138,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -2249,6 +2187,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -2278,6 +2217,11 @@ Generated by [AVA](https://avajs.dev). constructor() {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -2287,10 +2231,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ @@ -2323,6 +2263,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -2357,6 +2298,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -2391,6 +2333,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -2428,6 +2371,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -2462,6 +2406,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ @@ -2504,6 +2449,12 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ + __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -2516,10 +2467,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ @@ -2576,7 +2523,9 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -2642,6 +2591,12 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ + __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -2654,10 +2609,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ @@ -2700,8 +2651,8 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ @@ -2714,6 +2665,12 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -2726,10 +2683,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ @@ -2806,6 +2759,10 @@ Generated by [AVA](https://avajs.dev). constructor() {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(address signer) public initializer {␊ + __SignerECDSA_init(signer);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -2815,10 +2772,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - }␊ }␊ ` @@ -2990,6 +2943,11 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ + __SignerECDSA_init(signer);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -3002,10 +2960,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -3055,6 +3009,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ __SignerECDSA_init(signer);␊ }␊ ␊ @@ -3114,6 +3069,11 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579_init();␊ + __SignerECDSA_init(signer);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -3126,10 +3086,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -3166,8 +3122,8 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ @@ -3179,6 +3135,11 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(address signer) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerECDSA_init(signer);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -3191,10 +3152,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(address signer) public initializer {␊ - __SignerECDSA_init(signer);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -3232,23 +3189,13 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract CustomAccountWithSignerP256 is Initializable, Account, EIP712, ERC7739, SignerP256 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerP256 is Account, EIP712, ERC7739, SignerP256 {␊ constructor(bytes32 qx, bytes32 qy)␊ EIP712("CustomAccount with SignerP256", "1")␊ SignerP256(qx, qy)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ + {}␊ }␊ ` @@ -3262,16 +3209,10 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC1271 is Initializable, Account, IERC1271, SignerP256 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor(bytes32 qx, bytes32 qy) SignerP256(qx, qy) {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + contract CustomAccountWithSignerP256ERC1271 is Account, IERC1271, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy) SignerP256(qx, qy) {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -3281,10 +3222,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ }␊ ` @@ -3299,23 +3236,13 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC7739 is Initializable, Account, EIP712, ERC7739, SignerP256 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerP256ERC7739 is Account, EIP712, ERC7739, SignerP256 {␊ constructor(bytes32 qx, bytes32 qy)␊ EIP712("CustomAccount with SignerP256ERC7739", "1")␊ SignerP256(qx, qy)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ + {}␊ }␊ ` @@ -3331,23 +3258,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC721Holder is Initializable, Account, EIP712, ERC7739, SignerP256, ERC721Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerP256ERC721Holder is Account, EIP712, ERC7739, SignerP256, ERC721Holder {␊ constructor(bytes32 qx, bytes32 qy)␊ EIP712("CustomAccount with SignerP256ERC721Holder", "1")␊ SignerP256(qx, qy)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ + {}␊ }␊ ` @@ -3363,23 +3280,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256, ERC1155Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerP256ERC1155Holder is Account, EIP712, ERC7739, SignerP256, ERC1155Holder {␊ constructor(bytes32 qx, bytes32 qy)␊ EIP712("CustomAccount with SignerP256ERC1155Holder", "1")␊ SignerP256(qx, qy)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ + {}␊ }␊ ` @@ -3396,23 +3303,13 @@ Generated by [AVA](https://avajs.dev). import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerP256, ERC721Holder, ERC1155Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerP256ERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerP256, ERC721Holder, ERC1155Holder {␊ constructor(bytes32 qx, bytes32 qy)␊ EIP712("CustomAccount with SignerP256ERC721HolderERC1155Holder", "1")␊ SignerP256(qx, qy)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ + {}␊ }␊ ` @@ -3428,23 +3325,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerP256, ERC7821 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, SignerP256, ERC7821 {␊ constructor(bytes32 qx, bytes32 qy)␊ EIP712("MyAccount", "1")␊ SignerP256(qx, qy)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ + {}␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ internal␊ @@ -3470,20 +3357,14 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, SignerP256 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerP256 {␊ constructor(bytes32 qx, bytes32 qy)␊ EIP712("MyAccount", "1")␊ SignerP256(qx, qy)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -3496,10 +3377,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -3538,21 +3415,11 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579, SignerP256 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor(bytes32 qx, bytes32 qy) SignerP256(qx, qy) {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ + contract MyAccount is Account, IERC1271, AccountERC7579, SignerP256 {␊ + constructor(bytes32 qx, bytes32 qy) SignerP256(qx, qy) {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -3601,20 +3468,14 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, SignerP256 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerP256 {␊ constructor(bytes32 qx, bytes32 qy)␊ EIP712("MyAccount", "1")␊ SignerP256(qx, qy)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -3627,10 +3488,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -3671,20 +3528,14 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerP256} from "@openzeppelin/contracts/utils/cryptography/signers/SignerP256.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Hooked, SignerP256 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerP256 {␊ constructor(bytes32 qx, bytes32 qy)␊ EIP712("MyAccount", "1")␊ SignerP256(qx, qy)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -3697,10 +3548,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - _setSigner(qx, qy);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -3750,6 +3597,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(bytes32 qx, bytes32 qy) public initializer {␊ __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -3780,18 +3628,19 @@ Generated by [AVA](https://avajs.dev). _disableInitializers();␊ }␊ ␊ - function isValidSignature(bytes32 hash, bytes calldata signature)␊ - public␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ + ␊ + function isValidSignature(bytes32 hash, bytes calldata signature)␊ + public␊ view␊ override␊ returns (bytes4)␊ {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ - }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ @@ -3824,6 +3673,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(bytes32 qx, bytes32 qy) public initializer {␊ __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -3858,6 +3708,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(bytes32 qx, bytes32 qy) public initializer {␊ __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -3892,6 +3743,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(bytes32 qx, bytes32 qy) public initializer {␊ __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -3929,6 +3781,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(bytes32 qx, bytes32 qy) public initializer {␊ __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -3963,6 +3816,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(bytes32 qx, bytes32 qy) public initializer {␊ __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ @@ -4005,6 +3859,12 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -4017,10 +3877,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ - }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ @@ -4077,7 +3933,9 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -4143,6 +4001,12 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -4155,10 +4019,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ - }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ @@ -4201,8 +4061,8 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ @@ -4215,6 +4075,12 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerP256_init(qx, qy);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -4227,10 +4093,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ - }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ @@ -4307,6 +4169,10 @@ Generated by [AVA](https://avajs.dev). constructor() {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __SignerP256_init(qx, qy);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -4316,10 +4182,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ - }␊ }␊ ` @@ -4491,6 +4353,11 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -4503,10 +4370,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -4556,6 +4419,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ __SignerP256_init(qx, qy);␊ }␊ ␊ @@ -4615,6 +4479,11 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579_init();␊ + __SignerP256_init(qx, qy);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -4627,10 +4496,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -4667,8 +4532,8 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ @@ -4680,6 +4545,11 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes32 qx, bytes32 qy) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerP256_init(qx, qy);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -4692,10 +4562,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes32 qx, bytes32 qy) public initializer {␊ - __SignerP256_init(qx, qy);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -4733,23 +4599,13 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ ␊ - contract CustomAccountWithSignerRSA is Initializable, Account, EIP712, ERC7739, SignerRSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerRSA is Account, EIP712, ERC7739, SignerRSA {␊ constructor(bytes memory e, bytes memory n)␊ EIP712("CustomAccount with SignerRSA", "1")␊ SignerRSA(e, n)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + {}␊ }␊ ` @@ -4763,16 +4619,10 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC1271 is Initializable, Account, IERC1271, SignerRSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor(bytes memory e, bytes memory n) SignerRSA(e, n) {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + contract CustomAccountWithSignerRSAERC1271 is Account, IERC1271, SignerRSA {␊ + constructor(bytes memory e, bytes memory n) SignerRSA(e, n) {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -4782,10 +4632,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ }␊ ` @@ -4800,23 +4646,13 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC7739 is Initializable, Account, EIP712, ERC7739, SignerRSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerRSAERC7739 is Account, EIP712, ERC7739, SignerRSA {␊ constructor(bytes memory e, bytes memory n)␊ EIP712("CustomAccount with SignerRSAERC7739", "1")␊ SignerRSA(e, n)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + {}␊ }␊ ` @@ -4832,23 +4668,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC721Holder is Initializable, Account, EIP712, ERC7739, SignerRSA, ERC721Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerRSAERC721Holder is Account, EIP712, ERC7739, SignerRSA, ERC721Holder {␊ constructor(bytes memory e, bytes memory n)␊ EIP712("CustomAccount with SignerRSAERC721Holder", "1")␊ SignerRSA(e, n)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + {}␊ }␊ ` @@ -4864,23 +4690,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSA, ERC1155Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerRSAERC1155Holder is Account, EIP712, ERC7739, SignerRSA, ERC1155Holder {␊ constructor(bytes memory e, bytes memory n)␊ EIP712("CustomAccount with SignerRSAERC1155Holder", "1")␊ SignerRSA(e, n)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + {}␊ }␊ ` @@ -4897,23 +4713,13 @@ Generated by [AVA](https://avajs.dev). import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ ␊ - contract CustomAccountWithSignerRSAERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, SignerRSA, ERC721Holder, ERC1155Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerRSAERC721HolderERC1155Holder is Account, EIP712, ERC7739, SignerRSA, ERC721Holder, ERC1155Holder {␊ constructor(bytes memory e, bytes memory n)␊ EIP712("CustomAccount with SignerRSAERC721HolderERC1155Holder", "1")␊ SignerRSA(e, n)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + {}␊ }␊ ` @@ -4929,23 +4735,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerRSA, ERC7821 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, SignerRSA, ERC7821 {␊ constructor(bytes memory e, bytes memory n)␊ EIP712("MyAccount", "1")␊ SignerRSA(e, n)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + {}␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ internal␊ @@ -4971,20 +4767,14 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, SignerRSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerRSA {␊ constructor(bytes memory e, bytes memory n)␊ EIP712("MyAccount", "1")␊ SignerRSA(e, n)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -4997,10 +4787,6 @@ Generated by [AVA](https://avajs.dev). 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 {␊ - _setSigner(e, n);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -5039,21 +4825,11 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579, SignerRSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor(bytes memory e, bytes memory n) SignerRSA(e, n) {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - _setSigner(e, n);␊ - }␊ + contract MyAccount is Account, IERC1271, AccountERC7579, SignerRSA {␊ + constructor(bytes memory e, bytes memory n) SignerRSA(e, n) {}␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -5102,20 +4878,14 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, SignerRSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, SignerRSA {␊ constructor(bytes memory e, bytes memory n)␊ EIP712("MyAccount", "1")␊ SignerRSA(e, n)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -5128,10 +4898,6 @@ Generated by [AVA](https://avajs.dev). 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 {␊ - _setSigner(e, n);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -5172,20 +4938,14 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ import {SignerRSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerRSA.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Hooked, SignerRSA {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, SignerRSA {␊ constructor(bytes memory e, bytes memory n)␊ EIP712("MyAccount", "1")␊ SignerRSA(e, n)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -5198,10 +4958,6 @@ Generated by [AVA](https://avajs.dev). 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 {␊ - _setSigner(e, n);␊ - }␊ ␊ // The following functions are overrides required by Solidity.␊ ␊ @@ -5251,6 +5007,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(bytes memory e, bytes memory n) public initializer {␊ __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -5280,6 +5037,11 @@ Generated by [AVA](https://avajs.dev). constructor() {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -5289,10 +5051,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ - }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ @@ -5325,6 +5083,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(bytes memory e, bytes memory n) public initializer {␊ __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -5359,6 +5118,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(bytes memory e, bytes memory n) public initializer {␊ __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -5393,6 +5153,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(bytes memory e, bytes memory n) public initializer {␊ __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -5430,6 +5191,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(bytes memory e, bytes memory n) public initializer {␊ __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -5464,6 +5226,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(bytes memory e, bytes memory n) public initializer {␊ __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _erc7821AuthorizedExecutor(address caller, bytes32 mode, bytes calldata executionData)␊ @@ -5506,6 +5269,12 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -5518,10 +5287,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ - }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ @@ -5578,7 +5343,9 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -5644,6 +5411,12 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -5656,10 +5429,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ - }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ @@ -5702,8 +5471,8 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ @@ -5716,6 +5485,12 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerRSA_init(e, n);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -5728,10 +5503,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ - }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ internal␊ @@ -5808,6 +5579,10 @@ Generated by [AVA](https://avajs.dev). constructor() {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __SignerRSA_init(e, n);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -5817,10 +5592,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(bytes memory e, bytes memory n) public initializer {␊ - __SignerRSA_init(e, n);␊ - }␊ }␊ ` @@ -5992,6 +5763,11 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -6004,10 +5780,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.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.␊ ␊ @@ -6057,6 +5829,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ __SignerRSA_init(e, n);␊ }␊ ␊ @@ -6116,6 +5889,11 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579_init();␊ + __SignerRSA_init(e, n);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -6128,10 +5906,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.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.␊ ␊ @@ -6168,8 +5942,8 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ @@ -6181,6 +5955,11 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes memory e, bytes memory n) public initializer {␊ + __AccountERC7579Hooked_init();␊ + __SignerRSA_init(e, n);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -6193,10 +5972,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.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.␊ ␊ @@ -6234,27 +6009,13 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ ␊ - contract CustomAccountWithSignerMultisig is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerMultisig is Account, EIP712, ERC7739, MultiSignerERC7913 {␊ constructor(bytes[] memory signers, uint64 threshold)␊ EIP712("CustomAccount with SignerMultisig", "1")␊ MultiSignerERC7913(signers, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ - }␊ + {}␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6280,18 +6041,12 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerMultisigERC1271 is Account, IERC1271, MultiSignerERC7913 {␊ constructor(bytes[] memory signers, uint64 threshold)␊ MultiSignerERC7913(signers, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -6301,14 +6056,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ - }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6335,30 +6082,16 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerMultisigERC7739 is Account, EIP712, ERC7739, MultiSignerERC7913 {␊ constructor(bytes[] memory signers, uint64 threshold)␊ EIP712("CustomAccount with SignerMultisigERC7739", "1")␊ MultiSignerERC7913(signers, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ - }␊ - ␊ - function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ - _addSigners(signers);␊ + {}␊ + ␊ + function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ + _addSigners(signers);␊ }␊ ␊ function removeSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6383,27 +6116,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913, ERC721Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerMultisigERC721Holder is Account, EIP712, ERC7739, MultiSignerERC7913, ERC721Holder {␊ constructor(bytes[] memory signers, uint64 threshold)␊ EIP712("CustomAccount with SignerMultisigERC721Holder", "1")␊ MultiSignerERC7913(signers, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ - }␊ + {}␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6431,27 +6150,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913, ERC1155Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerMultisigERC1155Holder is Account, EIP712, ERC7739, MultiSignerERC7913, ERC1155Holder {␊ constructor(bytes[] memory signers, uint64 threshold)␊ EIP712("CustomAccount with SignerMultisigERC1155Holder", "1")␊ MultiSignerERC7913(signers, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ - }␊ + {}␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6480,27 +6185,13 @@ Generated by [AVA](https://avajs.dev). import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ ␊ - contract CustomAccountWithSignerMultisigERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913, ERC721Holder, ERC1155Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerMultisigERC721HolderERC1155Holder is Account, EIP712, ERC7739, MultiSignerERC7913, ERC721Holder, ERC1155Holder {␊ constructor(bytes[] memory signers, uint64 threshold)␊ EIP712("CustomAccount with SignerMultisigERC721HolderERC1155Holder", "1")␊ MultiSignerERC7913(signers, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ - }␊ + {}␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6528,27 +6219,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913, ERC7821 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, MultiSignerERC7913, ERC7821 {␊ constructor(bytes[] memory signers, uint64 threshold)␊ EIP712("MyAccount", "1")␊ MultiSignerERC7913(signers, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ - }␊ + {}␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6586,20 +6263,14 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913 {␊ constructor(bytes[] memory signers, uint64 threshold)␊ EIP712("MyAccount", "1")␊ MultiSignerERC7913(signers, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -6612,14 +6283,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ - }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6670,27 +6333,13 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579, MultiSignerERC7913 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, IERC1271, AccountERC7579, MultiSignerERC7913 {␊ constructor(bytes[] memory signers, uint64 threshold)␊ MultiSignerERC7913(signers, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ - }␊ + {}␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6751,20 +6400,14 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913 {␊ constructor(bytes[] memory signers, uint64 threshold)␊ EIP712("MyAccount", "1")␊ MultiSignerERC7913(signers, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -6777,14 +6420,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ - }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6837,20 +6472,14 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Hooked, MultiSignerERC7913 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, MultiSignerERC7913 {␊ constructor(bytes[] memory signers, uint64 threshold)␊ EIP712("MyAccount", "1")␊ MultiSignerERC7913(signers, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -6863,14 +6492,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setThreshold(threshold);␊ - }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -6935,6 +6556,7 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -6976,6 +6598,14 @@ Generated by [AVA](https://avajs.dev). constructor() {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -6985,13 +6615,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __MultiSignerERC7913_init(signers, threshold);␊ - }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -7039,6 +6662,7 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7088,6 +6712,7 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7137,6 +6762,7 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7189,6 +6815,7 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7238,6 +6865,7 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7292,6 +6920,15 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -7304,13 +6941,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.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);␊ @@ -7382,7 +7012,9 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ @@ -7460,6 +7092,15 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -7472,13 +7113,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.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);␊ @@ -7533,8 +7167,8 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ @@ -7547,6 +7181,15 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579Hooked_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -7559,13 +7202,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.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);␊ @@ -7669,6 +7305,13 @@ Generated by [AVA](https://avajs.dev). constructor() {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -7678,13 +7321,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __MultiSignerERC7913_init(signers, threshold);␊ - }␊ ␊ function addSigners(bytes[] memory signers) public onlyEntryPointOrSelf {␊ _addSigners(signers);␊ @@ -7943,6 +7579,14 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -7955,13 +7599,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.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);␊ @@ -8026,6 +7663,7 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ __MultiSignerERC7913_init(signers, threshold);␊ }␊ ␊ @@ -8097,6 +7735,14 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -8109,13 +7755,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.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);␊ @@ -8164,8 +7803,8 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ @@ -8177,6 +7816,14 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579Hooked_init();␊ + __MultiSignerERC7913_init(signers, threshold);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -8189,13 +7836,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.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);␊ @@ -8245,28 +7885,13 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeighted is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Weighted {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + 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)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ - }␊ + {}␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8299,18 +7924,12 @@ Generated by [AVA](https://avajs.dev). ␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC1271 is Initializable, Account, IERC1271, MultiSignerERC7913Weighted {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract CustomAccountWithSignerMultisigWeightedERC1271 is Account, IERC1271, MultiSignerERC7913Weighted {␊ constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -8320,15 +7939,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ - }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8362,28 +7972,13 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC7739 is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Weighted {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + 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)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ - }␊ + {}␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8418,28 +8013,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC721Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC721Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + 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)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ - }␊ + {}␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8474,28 +8054,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC1155Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + 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)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ - }␊ + {}␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8531,28 +8096,13 @@ Generated by [AVA](https://avajs.dev). import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract CustomAccountWithSignerMultisigWeightedERC721HolderERC1155Holder is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC721Holder, ERC1155Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + 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)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ - }␊ + {}␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8587,28 +8137,13 @@ Generated by [AVA](https://avajs.dev). import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {ERC7821} from "@openzeppelin/contracts/account/extensions/draft-ERC7821.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC7821 {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, MultiSignerERC7913Weighted, ERC7821 {␊ constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ EIP712("MyAccount", "1")␊ MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ - }␊ + {}␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8653,21 +8188,15 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913Weighted {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913Weighted {␊ constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ EIP712("MyAccount", "1")␊ MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -8680,15 +8209,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ - }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8746,29 +8266,14 @@ Generated by [AVA](https://avajs.dev). import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract MyAccount is Initializable, Account, IERC1271, AccountERC7579, MultiSignerERC7913Weighted {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, IERC1271, AccountERC7579, MultiSignerERC7913Weighted {␊ constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ - }␊ + {}␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8836,21 +8341,15 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913Weighted {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579, MultiSignerERC7913Weighted {␊ constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ EIP712("MyAccount", "1")␊ MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -8863,15 +8362,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ - }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -8931,21 +8421,15 @@ Generated by [AVA](https://avajs.dev). import {AccountERC7579Hooked} from "@openzeppelin/contracts/account/extensions/draft-AccountERC7579Hooked.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {MultiSignerERC7913} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913.sol";␊ import {MultiSignerERC7913Weighted} from "@openzeppelin/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol";␊ import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, AccountERC7579Hooked, MultiSignerERC7913Weighted {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ + contract MyAccount is Account, EIP712, ERC7739, AccountERC7579Hooked, MultiSignerERC7913Weighted {␊ constructor(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ EIP712("MyAccount", "1")␊ MultiSignerERC7913Weighted(signers, weights, threshold)␊ - {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ + {}␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -8958,15 +8442,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - _addSigners(signers);␊ - _setSignerWeights(signers, weights);␊ - _setThreshold(threshold);␊ - }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -9038,6 +8513,7 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -9086,6 +8562,14 @@ Generated by [AVA](https://avajs.dev). constructor() {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -9095,13 +8579,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -9158,6 +8635,7 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -9216,6 +8694,7 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -9274,6 +8753,7 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -9333,6 +8813,7 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -9389,6 +8870,7 @@ Generated by [AVA](https://avajs.dev). initializer␊ {␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -9451,6 +8933,15 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -9463,13 +8954,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -9549,7 +9033,9 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ @@ -9635,6 +9121,15 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -9647,13 +9142,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -9715,8 +9203,8 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ @@ -9730,6 +9218,15 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579Hooked_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + __UUPSUpgradeable_init();␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -9742,13 +9239,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -9866,6 +9356,13 @@ Generated by [AVA](https://avajs.dev). constructor() {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -9875,13 +9372,6 @@ Generated by [AVA](https://avajs.dev). {␊ return _rawSignatureValidation(hash, signature) ? IERC1271.isValidSignature.selector : bytes4(0xffffffff);␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -10189,6 +9679,14 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -10201,13 +9699,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -10280,6 +9771,7 @@ Generated by [AVA](https://avajs.dev). public␊ initializer␊ {␊ + __AccountERC7579_init();␊ __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ }␊ ␊ @@ -10359,6 +9851,14 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -10371,13 +9871,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ @@ -10433,8 +9926,8 @@ Generated by [AVA](https://avajs.dev). ␊ import {AbstractSigner} from "@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol";␊ import {Account} from "@openzeppelin/contracts/account/Account.sol";␊ - import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {AccountERC7579Upgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol";␊ + import {AccountERC7579HookedUpgradeable} from "@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579HookedUpgradeable.sol";␊ import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";␊ @@ -10447,6 +9940,14 @@ Generated by [AVA](https://avajs.dev). constructor() EIP712("MyAccount", "1") {␊ _disableInitializers();␊ }␊ + ␊ + function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ + public␊ + initializer␊ + {␊ + __AccountERC7579Hooked_init();␊ + __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ + }␊ ␊ function isValidSignature(bytes32 hash, bytes calldata signature)␊ public␊ @@ -10459,13 +9960,6 @@ Generated by [AVA](https://avajs.dev). bytes4 erc7739magic = ERC7739.isValidSignature(hash, signature);␊ return erc7739magic == bytes4(0xffffffff) ? AccountERC7579Upgradeable.isValidSignature(hash, signature) : erc7739magic;␊ }␊ - ␊ - function initialize(bytes[] memory signers, uint64[] memory weights, uint64 threshold)␊ - public␊ - initializer␊ - {␊ - __MultiSignerERC7913Weighted_init(signers, weights, threshold);␊ - }␊ ␊ function setSignerWeights(bytes[] memory signers, uint64[] memory weights)␊ public␊ diff --git a/packages/core/solidity/src/account.test.ts.snap b/packages/core/solidity/src/account.test.ts.snap index 8539b23ac..8f9f873c2 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 8d9efcb3a..919fe86fc 100644 --- a/packages/core/solidity/src/account.ts +++ b/packages/core/solidity/src/account.ts @@ -2,17 +2,10 @@ import { ContractBuilder } from './contract'; import type { Contract } from './contract'; import { defineFunctions } from './utils/define-functions'; import { printContract } from './print'; -import { makeUpgradeable } from './helpers'; import { defaults as commonDefaults, withCommonDefaults, type CommonOptions } from './common-options'; +import { upgradeableName } from './options'; import { setInfo } from './set-info'; -import { - addLockingConstructorAllowReachable, - addSigner, - signerArgs, - signerFunctions, - signers, - type SignerOptions, -} from './signer'; +import { addSigner, signerFunctions, signers, type SignerOptions } from './signer'; import { setUpgradeableAccount } from './set-upgradeable'; export const defaults: Required = { @@ -75,6 +68,7 @@ export function buildAccount(opts: AccountOptions): Contract { c.addImportOnly({ name: 'PackedUserOperation', path: '@openzeppelin/contracts/interfaces/draft-IERC4337.sol', + transpiled: false, // PackedUserOperation doesn't start with "I" so its not recognized as an "interface object" }); } @@ -86,8 +80,9 @@ function addParents(c: ContractBuilder, opts: AccountOptions): void { c.addParent({ name: 'Account', path: `@openzeppelin/contracts/account/Account.sol`, + transpiled: false, }); - c.addOverride({ name: 'Account' }, functions._validateUserOp); + c.addOverride({ name: 'Account', transpiled: false }, functions._validateUserOp); if (opts.signatureValidation === 'ERC7739') addEIP712(c, opts); @@ -95,7 +90,6 @@ function addParents(c: ContractBuilder, opts: AccountOptions): void { addSignatureValidation(c, opts); addERC7579Modules(c, opts); addSigner(c, opts.signer ?? false, opts.upgradeable ?? false); - addSignerInitializer(c, opts); addMultisigFunctions(c, opts); addBatchedExecution(c, opts); addERC721Holder(c, opts); @@ -108,6 +102,7 @@ function addSignatureValidation(c: ContractBuilder, opts: AccountOptions) { c.addParent({ name: 'ERC7739', path: '@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol', + transpiled: false, }); break; case 'ERC1271': @@ -133,6 +128,7 @@ function addERC721Holder(c: ContractBuilder, opts: AccountOptions): void { c.addParent({ name: 'ERC721Holder', path: '@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol', + transpiled: false, }); } @@ -141,6 +137,7 @@ function addERC1155Holder(c: ContractBuilder, opts: AccountOptions): void { c.addParent({ name: 'ERC1155Holder', path: '@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol', + transpiled: false, }); } @@ -150,8 +147,9 @@ function addBatchedExecution(c: ContractBuilder, opts: AccountOptions): void { c.addParent({ name: 'ERC7821', path: '@openzeppelin/contracts/account/extensions/draft-ERC7821.sol', + transpiled: false, }); - c.addOverride({ name: 'ERC7821' }, functions._erc7821AuthorizedExecutor); + c.addOverride({ name: 'ERC7821', transpiled: false }, functions._erc7821AuthorizedExecutor); c.setFunctionBody( ['return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);'], functions._erc7821AuthorizedExecutor, @@ -161,112 +159,41 @@ function addBatchedExecution(c: ContractBuilder, opts: AccountOptions): void { function addERC7579Modules(c: ContractBuilder, opts: AccountOptions): void { if (!opts.ERC7579Modules) return; - // Base AccountERC7579 account (upgradeable or not) - const name = makeUpgradeable('AccountERC7579', opts.upgradeable); - c.addParent({ - name: makeUpgradeable(opts.ERC7579Modules, opts.upgradeable), - path: makeUpgradeable( - `@openzeppelin/contracts/account/extensions/draft-${opts.ERC7579Modules}.sol`, - opts.upgradeable, - ), + name: opts.ERC7579Modules, + path: `@openzeppelin/contracts/account/extensions/draft-${opts.ERC7579Modules}.sol`, }); if (opts.ERC7579Modules !== 'AccountERC7579') { c.addImportOnly({ - name: makeUpgradeable('AccountERC7579', opts.upgradeable), - path: makeUpgradeable('@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol', opts.upgradeable), + name: 'AccountERC7579', + path: '@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol', }); } // Accounts that use ERC7579 without a signer must be constructed with at least one module (executor of validation) if (!opts.signer) { - const args = [ - { type: 'uint256', name: 'moduleTypeId' }, - { type: 'address', name: 'module' }, - { type: 'bytes calldata', name: 'initData' }, - ]; - const body = [ - 'require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);', - '_installModule(moduleTypeId, module, initData);', - ]; - if (opts.upgradeable) { - c.addParent({ - name: 'Initializable', - path: '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol', - }); - addLockingConstructorAllowReachable(c); - - const fn = { name: 'initialize', kind: 'public' as const, args }; - c.addModifier('initializer', fn); - c.setFunctionBody(body, fn); - } else { - for (const arg of args) c.addConstructorArgument(arg); - for (const line of body) c.addConstructorCode(line); - } + c.addConstructorArgument({ type: 'uint256', name: 'moduleTypeId' }); + c.addConstructorArgument({ type: 'address', name: 'module' }); + c.addConstructorArgument({ type: 'bytes calldata', name: 'initData' }); + c.addConstructorCode('require(moduleTypeId == MODULE_TYPE_VALIDATOR || moduleTypeId == MODULE_TYPE_EXECUTOR);'); + c.addConstructorCode('_installModule(moduleTypeId, module, initData);'); } - // isValidSignature override - c.addOverride({ name }, functions.isValidSignature); + c.addOverride({ name: 'AccountERC7579' }, functions._validateUserOp); + c.addOverride({ name: 'AccountERC7579' }, functions.isValidSignature); + if (opts.signatureValidation === 'ERC7739') { - c.addOverride({ name: 'ERC7739' }, functions.isValidSignature); + c.addOverride({ name: 'ERC7739', transpiled: false }, 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) ? ${name}.isValidSignature(hash, signature) : erc7739magic;`, + `return erc7739magic == bytes4(0xffffffff) ? ${opts.upgradeable ? upgradeableName('AccountERC7579') : 'AccountERC7579'}.isValidSignature(hash, signature) : erc7739magic;`, ], functions.isValidSignature, ); } - - // _validateUserOp override - c.addOverride({ name }, functions._validateUserOp); -} - -function addSignerInitializer(c: ContractBuilder, opts: AccountOptions): void { - if (opts.upgradeable) { - if (!opts.signer) { - addLockingConstructorAllowReachable(c); - } - return; // Initializer added in signer.ts - } - if (!opts.signer || opts.signer === 'ERC7702') return; // No initialization required - - c.addParent({ - name: 'Initializable', - path: opts.upgradeable - ? '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol' - : '@openzeppelin/contracts/proxy/utils/Initializable.sol', - }); - - addLockingConstructorAllowReachable(c, [ - '// Accounts are typically deployed and initialized as clones during their first user op,', - '// therefore, initializers are disabled for the implementation contract', - ]); - - const fn = { name: 'initialize', kind: 'public' as const, args: signerArgs[opts.signer] }; - c.addModifier('initializer', fn); - - switch (opts.signer) { - case 'Multisig': - c.addFunctionCode(`_addSigners(${signerArgs[opts.signer][0]!.name});`, fn); - c.addFunctionCode(`_setThreshold(${signerArgs[opts.signer][1]!.name});`, fn); - break; - case 'MultisigWeighted': - c.addFunctionCode(`_addSigners(${signerArgs[opts.signer][0]!.name});`, fn); - c.addFunctionCode( - `_setSignerWeights(${signerArgs[opts.signer][0]!.name}, ${signerArgs[opts.signer][1]!.name});`, - fn, - ); - c.addFunctionCode(`_setThreshold(${signerArgs[opts.signer][2]!.name});`, fn); - break; - case 'ECDSA': - case 'P256': - case 'RSA': - c.addFunctionCode(`_setSigner(${signerArgs[opts.signer].map(({ name }) => name).join(', ')});`, fn); - break; - } } function addMultisigFunctions(c: ContractBuilder, opts: AccountOptions): void { @@ -296,6 +223,7 @@ function addEIP712(c: ContractBuilder, opts: AccountOptions): void { { name: 'EIP712', path: '@openzeppelin/contracts/utils/cryptography/EIP712.sol', + transpiled: false, // do not use the upgradeable variant for in Accounts }, [opts.name, '1'], ); @@ -309,21 +237,22 @@ function overrideRawSignatureValidation(c: ContractBuilder, opts: AccountOptions // to provide a custom validation logic if (!opts.signer && !opts.ERC7579Modules) { // Custom validation logic - c.addOverride({ name: 'Account' }, signerFunctions._rawSignatureValidation); + c.addOverride({ name: 'Account', transpiled: false }, signerFunctions._rawSignatureValidation); c.setFunctionBody(['// Custom validation logic', 'return false;'], signerFunctions._rawSignatureValidation); } // Disambiguate between Signer and AccountERC7579 if (opts.signer && opts.ERC7579Modules) { - const accountName = makeUpgradeable('AccountERC7579', opts.upgradeable); - const signerName = makeUpgradeable(`Signer${opts.signer}`, opts.upgradeable); + const accountName = opts.upgradeable ? upgradeableName('AccountERC7579') : 'AccountERC7579'; + const signerName = opts.upgradeable ? upgradeableName(`Signer${opts.signer}`) : `Signer${opts.signer}`; c.addImportOnly({ name: 'AbstractSigner', path: '@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol', + transpiled: false, }); - c.addOverride({ name: 'AbstractSigner' }, signerFunctions._rawSignatureValidation); - c.addOverride({ name: accountName }, signerFunctions._rawSignatureValidation); + c.addOverride({ name: 'AbstractSigner', transpiled: false }, signerFunctions._rawSignatureValidation); + c.addOverride({ name: 'AccountERC7579' }, signerFunctions._rawSignatureValidation); c.setFunctionComments( [ `// IMPORTANT: Make sure ${signerName} is most derived than ${accountName}`, @@ -336,10 +265,7 @@ function overrideRawSignatureValidation(c: ContractBuilder, opts: AccountOptions // Base override for `_rawSignatureValidation` given MultiSignerERC7913Weighted is MultiSignerERC7913 if (opts.signer === 'MultisigWeighted') { - c.addImportOnly({ - name: makeUpgradeable(signers.Multisig.name, opts.upgradeable), - path: makeUpgradeable(signers.Multisig.path, opts.upgradeable), - }); + c.addImportOnly(signers.Multisig); } } } diff --git a/packages/core/solidity/src/contract.ts b/packages/core/solidity/src/contract.ts index d3a89333c..6ed276124 100644 --- a/packages/core/solidity/src/contract.ts +++ b/packages/core/solidity/src/contract.ts @@ -9,11 +9,8 @@ export interface Contract { functions: ContractFunction[]; constructorCode: string[]; constructorArgs: FunctionArgument[]; - constructorComments: string[]; variables: string[]; - shouldAutoTranspileImports: boolean; - shouldInstallContractsUpgradeable: boolean; - shouldUseUpgradesPluginsForProxyDeployment: boolean; + upgradeable: boolean; } export type Value = string | number | { lit: string } | { note: string; value: Value }; @@ -78,17 +75,13 @@ export interface NatspecTag { export class ContractBuilder implements Contract { readonly name: string; license: string = 'MIT'; - - shouldAutoTranspileImports: boolean = false; - shouldInstallContractsUpgradeable: boolean = false; - shouldUseUpgradesPluginsForProxyDeployment: boolean = false; + upgradeable = false; readonly using: Using[] = []; readonly natspecTags: NatspecTag[] = []; readonly constructorArgs: FunctionArgument[] = []; readonly constructorCode: string[] = []; - readonly constructorComments: string[] = []; readonly variableSet: Set = new Set(); private parentMap: Map = new Map(); @@ -187,15 +180,6 @@ export class ContractBuilder implements Contract { this.constructorCode.push(code); } - addConstructorComment(comment: string) { - if (this.shouldAutoTranspileImports) { - throw new Error( - 'Constructor comments are not supported when `shouldAutoTranspileImports` is true, since constructor will be transformed into an initializer', - ); - } - this.constructorComments.push(comment); - } - addFunctionCode(code: string, baseFn: BaseFunction, mutability?: FunctionMutability) { const fn = this.addFunction(baseFn); if (fn.final) { diff --git a/packages/core/solidity/src/erc1155.test.ts.md b/packages/core/solidity/src/erc1155.test.ts.md index 5b7de2840..470826aa4 100644 --- a/packages/core/solidity/src/erc1155.test.ts.md +++ b/packages/core/solidity/src/erc1155.test.ts.md @@ -377,7 +377,8 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(address defaultAdmin, address pauser, address minter)␊ - public initializer␊ + public␊ + initializer␊ {␊ __ERC1155_init("https://gateway.pinata.cloud/ipfs/QmcP9hxrnC1T5ATPmq2saFeAM1ypFX9BnAswCdHB9JCjLA/");␊ __AccessControl_init();␊ @@ -462,7 +463,8 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(address defaultAdmin, address pauser, address minter, address upgrader)␊ - public initializer␊ + public␊ + initializer␊ {␊ __ERC1155_init("https://gateway.pinata.cloud/ipfs/QmcP9hxrnC1T5ATPmq2saFeAM1ypFX9BnAswCdHB9JCjLA/");␊ __AccessControl_init();␊ diff --git a/packages/core/solidity/src/erc1155.test.ts.snap b/packages/core/solidity/src/erc1155.test.ts.snap index 2809eaab0..a7faff1b1 100644 Binary files a/packages/core/solidity/src/erc1155.test.ts.snap and b/packages/core/solidity/src/erc1155.test.ts.snap differ diff --git a/packages/core/solidity/src/erc20.test.ts.md b/packages/core/solidity/src/erc20.test.ts.md index 9c9af9619..e422ee059 100644 --- a/packages/core/solidity/src/erc20.test.ts.md +++ b/packages/core/solidity/src/erc20.test.ts.md @@ -1049,7 +1049,8 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(address defaultAdmin, address tokenBridge, address recipient, address pauser, address minter, address upgrader)␊ - public initializer␊ + public␊ + initializer␊ {␊ __ERC20_init("MyToken", "MTK");␊ __ERC20Bridgeable_init();␊ @@ -1152,7 +1153,8 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(address recipient, address defaultAdmin, address pauser, address minter)␊ - public initializer␊ + public␊ + initializer␊ {␊ __ERC20_init("MyToken", "MTK");␊ __ERC20Burnable_init();␊ @@ -1241,7 +1243,8 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(address recipient, address defaultAdmin, address pauser, address minter, address upgrader)␊ - public initializer␊ + public␊ + initializer␊ {␊ __ERC20_init("MyToken", "MTK");␊ __ERC20Burnable_init();␊ @@ -1334,7 +1337,8 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(address recipient, address initialAuthority)␊ - public initializer␊ + public␊ + initializer␊ {␊ __ERC20_init("MyToken", "MTK");␊ __ERC20Burnable_init();␊ diff --git a/packages/core/solidity/src/erc20.test.ts.snap b/packages/core/solidity/src/erc20.test.ts.snap index fe5aa7f88..c78c752bc 100644 Binary files a/packages/core/solidity/src/erc20.test.ts.snap and b/packages/core/solidity/src/erc20.test.ts.snap differ diff --git a/packages/core/solidity/src/governor.test.ts.md b/packages/core/solidity/src/governor.test.ts.md index e49920a89..8ab51e516 100644 --- a/packages/core/solidity/src/governor.test.ts.md +++ b/packages/core/solidity/src/governor.test.ts.md @@ -1624,7 +1624,8 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(IVotes _token, TimelockControllerUpgradeable _timelock)␊ - public initializer␊ + public␊ + initializer␊ {␊ __Governor_init("MyGovernor");␊ __GovernorCountingSimple_init();␊ diff --git a/packages/core/solidity/src/governor.test.ts.snap b/packages/core/solidity/src/governor.test.ts.snap index 63d7cb468..6eca252ca 100644 Binary files a/packages/core/solidity/src/governor.test.ts.snap and b/packages/core/solidity/src/governor.test.ts.snap differ diff --git a/packages/core/solidity/src/helpers.ts b/packages/core/solidity/src/helpers.ts deleted file mode 100644 index fe1d92bfe..000000000 --- a/packages/core/solidity/src/helpers.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Use posix to ensure forward slashes on all platforms -import { posix as path } from 'path'; -import type { CommonOptions } from './common-options'; - -// If upgradeable is true-ish, translate a contract name or contract path into its corresponding upgradeable variant. -// Otherwise, return the input unmodified. -// -// Example: -// - makeUpgradeable('AccountERC7579', false) == 'AccountERC7579' -// - makeUpgradeable('AccountERC7579', 'uups') == 'AccountERC7579Upgradeable' -// - makeUpgradeable('@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol', false) == '@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol' -// - makeUpgradeable('@openzeppelin/contracts/account/extensions/draft-AccountERC7579.sol', 'uups') == '@openzeppelin/contracts-upgradeable/account/extensions/draft-AccountERC7579Upgradeable.sol' -export function makeUpgradeable(input: string, upgradeable: CommonOptions['upgradeable'] = false): string { - switch (upgradeable) { - case false: - return input; - case 'uups': - case 'transparent': { - const { dir, name, ext } = path.parse(input); - return path.format({ - dir: dir.replace('/contracts/', '/contracts-upgradeable/'), - name: name + 'Upgradeable', - ext, - }); - } - default: { - const _: never = upgradeable; - throw new Error('Unknown upgradeable option'); - } - } -} diff --git a/packages/core/solidity/src/options.ts b/packages/core/solidity/src/options.ts index d2fbeba18..9a1606490 100644 --- a/packages/core/solidity/src/options.ts +++ b/packages/core/solidity/src/options.ts @@ -3,15 +3,15 @@ import path from 'path'; import type { Contract, ReferencedContract, ImportContract } from './contract'; import { inferTranspiled } from './infer-transpiled'; -const upgradeableName = (n: string) => { +export function upgradeableName(n: string) { if (n === 'Initializable') { return n; } else { return n.replace(/(Upgradeable)?(?=\.|$)/, 'Upgradeable'); } -}; +} -const upgradeableImport = (p: ImportContract): ImportContract => { +export function upgradeableImport(p: ImportContract): ImportContract { const { dir, ext, name } = path.parse(p.path); // Use path.posix to get forward slashes return { @@ -23,26 +23,26 @@ const upgradeableImport = (p: ImportContract): ImportContract => { name: upgradeableName(name), // Solidity file name }), }; -}; +} export interface Options { transformImport?: (parent: ImportContract) => ImportContract; } export interface Helpers extends Required { - shouldUseInitializers: boolean; + upgradeable: boolean; transformName: (name: ReferencedContract) => string; + transformImport: (name: ImportContract) => ImportContract; } export function withHelpers(contract: Contract, opts: Options = {}): Helpers { - const shouldAutoTranspileImports = contract.shouldAutoTranspileImports; - const transformName = (n: ReferencedContract) => - shouldAutoTranspileImports && inferTranspiled(n) ? upgradeableName(n.name) : n.name; + const contractUpgradeable = contract.upgradeable; return { - shouldUseInitializers: shouldAutoTranspileImports, - transformName, - transformImport: p1 => { - const p2 = shouldAutoTranspileImports && inferTranspiled(p1) ? upgradeableImport(p1) : p1; + upgradeable: contractUpgradeable, + transformName: (n: ReferencedContract) => + contractUpgradeable && inferTranspiled(n) ? upgradeableName(n.name) : n.name, + transformImport: (p1: ImportContract) => { + const p2 = contractUpgradeable && inferTranspiled(p1) ? upgradeableImport(p1) : p1; return opts.transformImport?.(p2) ?? p2; }, }; diff --git a/packages/core/solidity/src/print.ts b/packages/core/solidity/src/print.ts index fbf484151..bc6202d7d 100644 --- a/packages/core/solidity/src/print.ts +++ b/packages/core/solidity/src/print.ts @@ -81,24 +81,42 @@ function printConstructor(contract: Contract, helpers: Helpers): Lines[] { const hasParentParams = contract.parents.some(p => p.params.length > 0); const hasConstructorCode = contract.constructorCode.length > 0; const parentsWithInitializers = contract.parents.filter(hasInitializer); - if (hasParentParams || hasConstructorCode || (helpers.shouldUseInitializers && parentsWithInitializers.length > 0)) { - const parents = parentsWithInitializers.flatMap(p => printParentConstructor(p, helpers)); - const modifiers = helpers.shouldUseInitializers ? ['public initializer'] : parents; - const args = contract.constructorArgs.map(a => printArgument(a, helpers)); - const body = helpers.shouldUseInitializers - ? spaceBetween( - parents.map(p => p + ';'), + if (hasParentParams || hasConstructorCode || (helpers.upgradeable && parentsWithInitializers.length > 0)) { + if (helpers.upgradeable) { + const upgradeableParents = parentsWithInitializers.filter(p => inferTranspiled(p.contract)); + const nonUpgradeableParents = contract.parents.filter(p => !inferTranspiled(p.contract)); + const constructor = printFunction2( + [ + nonUpgradeableParents.length > 0 + ? '/// @custom:oz-upgrades-unsafe-allow-reachable constructor' + : '/// @custom:oz-upgrades-unsafe-allow constructor', + ], + 'constructor', + [], + nonUpgradeableParents.flatMap(p => printParentConstructor(p, helpers)), + ['_disableInitializers();'], + ); + const initializer = printFunction2( + [], + 'function initialize', + contract.constructorArgs.map(a => printArgument(a, helpers)), + ['public', 'initializer'], + spaceBetween( + upgradeableParents.flatMap(p => printParentConstructor(p, helpers)).map(p => p + ';'), contract.constructorCode, - ) - : contract.constructorCode; - const head = helpers.shouldUseInitializers ? 'function initialize' : 'constructor'; - const ctor = printFunction2(contract.constructorComments, head, args, modifiers, body); - if (!helpers.shouldUseInitializers) { - return ctor; + ), + ); + return spaceBetween(constructor, upgradeableParents.length > 0 ? initializer : []); } else { - return spaceBetween(DISABLE_INITIALIZERS, ctor); + return printFunction2( + [], + 'constructor', + contract.constructorArgs.map(a => printArgument(a, helpers)), + contract.parents.flatMap(p => printParentConstructor(p, helpers)), + contract.constructorCode, + ); } - } else if (!helpers.shouldUseInitializers) { + } else if (!helpers.upgradeable) { return []; } else { return DISABLE_INITIALIZERS; @@ -139,7 +157,7 @@ function sortedFunctions(contract: Contract): SortedFunctions { } function printParentConstructor({ contract, params }: Parent, helpers: Helpers): [] | [string] { - const useTranspiled = helpers.shouldUseInitializers && inferTranspiled(contract); + const useTranspiled = helpers.upgradeable && inferTranspiled(contract); const fn = useTranspiled ? `__${contract.name}_init` : contract.name; if (useTranspiled || params.length > 0) { return [fn + '(' + params.map(printValue).join(', ') + ')']; diff --git a/packages/core/solidity/src/set-upgradeable.ts b/packages/core/solidity/src/set-upgradeable.ts index 361184145..723dbe77f 100644 --- a/packages/core/solidity/src/set-upgradeable.ts +++ b/packages/core/solidity/src/set-upgradeable.ts @@ -11,19 +11,16 @@ function setUpgradeableBase( c: ContractBuilder, upgradeable: Upgradeable, restrictAuthorizeUpgradeWhenUUPS: () => void, - onlyUseUpgradeableInitializableAndUUPS: boolean = false, ) { if (upgradeable === false) { return; } - c.shouldAutoTranspileImports = !onlyUseUpgradeableInitializableAndUUPS; - c.shouldInstallContractsUpgradeable = true; - c.shouldUseUpgradesPluginsForProxyDeployment = true; + c.upgradeable = true; c.addParent({ name: 'Initializable', - path: `@openzeppelin/${onlyUseUpgradeableInitializableAndUUPS ? 'contracts-upgradeable' : 'contracts'}/proxy/utils/Initializable.sol`, + path: '@openzeppelin/contracts/proxy/utils/Initializable.sol', }); switch (upgradeable) { @@ -34,7 +31,7 @@ function setUpgradeableBase( restrictAuthorizeUpgradeWhenUUPS(); const UUPSUpgradeable = { name: 'UUPSUpgradeable', - path: `@openzeppelin/${onlyUseUpgradeableInitializableAndUUPS ? 'contracts-upgradeable' : 'contracts'}/proxy/utils/UUPSUpgradeable.sol`, + path: '@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol', }; c.addParent(UUPSUpgradeable); c.addOverride(UUPSUpgradeable, functions._authorizeUpgrade); @@ -62,19 +59,9 @@ export function setUpgradeableGovernor(c: ContractBuilder, upgradeable: Upgradea } export function setUpgradeableAccount(c: ContractBuilder, upgradeable: Upgradeable) { - if (upgradeable === false) { - return; - } - setUpgradeableBase( - c, - upgradeable, - () => { - c.addModifier('onlyEntryPointOrSelf', functions._authorizeUpgrade); - }, - true, // account.ts handles usage of transpiled imports (when needed) rather than using helpers. - ); - c.shouldInstallContractsUpgradeable = true; - c.shouldUseUpgradesPluginsForProxyDeployment = false; // this will eventually use a factory to deploy proxies + setUpgradeableBase(c, upgradeable, () => { + c.addModifier('onlyEntryPointOrSelf', functions._authorizeUpgrade); + }); } const functions = defineFunctions({ diff --git a/packages/core/solidity/src/signer.ts b/packages/core/solidity/src/signer.ts index 42e209a35..a9a156930 100644 --- a/packages/core/solidity/src/signer.ts +++ b/packages/core/solidity/src/signer.ts @@ -1,7 +1,6 @@ import type { ContractBuilder } from './contract'; import { OptionsError } from './error'; import type { Upgradeable } from './set-upgradeable'; -import { makeUpgradeable } from './helpers'; import { defineFunctions } from './utils/define-functions'; export const SignerOptions = [false, 'ERC7702', 'ECDSA', 'P256', 'RSA', 'Multisig', 'MultisigWeighted'] as const; @@ -11,7 +10,7 @@ export function addSigner(c: ContractBuilder, signer: SignerOptions, upgradeable if (!signer) return; const signerName = signer === 'MultisigWeighted' ? signers.Multisig.name : signers[signer].name; - c.addOverride({ name: makeUpgradeable(signerName, upgradeable) }, signerFunctions._rawSignatureValidation); + c.addOverride({ name: signerName }, signerFunctions._rawSignatureValidation); switch (signer) { case 'ERC7702': @@ -28,52 +27,16 @@ export function addSigner(c: ContractBuilder, signer: SignerOptions, upgradeable case 'RSA': case 'Multisig': case 'MultisigWeighted': { - if (upgradeable) { - c.addParent({ - name: 'Initializable', - path: '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol', - }); - addLockingConstructorAllowReachable(c); - - const fn = { name: 'initialize', kind: 'public' as const, args: signerArgs[signer] }; - c.addModifier('initializer', fn); - c.addFunctionCode(`__${signers[signer].name}_init(${signerArgs[signer].map(arg => arg.name).join(', ')});`, fn); - c.addParent({ - name: `${signers[signer].name}Upgradeable`, - path: makeUpgradeable(signers[signer].path, upgradeable), - }); - } else { - signerArgs[signer].forEach(arg => c.addConstructorArgument(arg)); - c.addParent( - signers[signer], - signerArgs[signer].map(arg => ({ lit: arg.name })), - ); - } - + signerArgs[signer].forEach(arg => c.addConstructorArgument(arg)); + c.addParent( + signers[signer], + signerArgs[signer].map(arg => ({ lit: arg.name })), + ); break; } } } -/** - * Adds a locking constructor that disables initializers and annotates it to allow reachable constructors during Upgrades Plugins validations, - * which includes constructors in parent contracts. - * - * IMPORTANT: If a locking constructor is already present, it will not be added again, even if the body comments are different. - * - * @param c The contract builder. - * @param bodyComments Optional comments to add to the constructor body, before disabling initializers. - */ -export function addLockingConstructorAllowReachable(c: ContractBuilder, bodyComments?: string[]): void { - const disableInitializers = '_disableInitializers();'; - - if (!c.constructorCode.includes(disableInitializers)) { - c.addConstructorComment('/// @custom:oz-upgrades-unsafe-allow-reachable constructor'); - bodyComments?.forEach(comment => c.addConstructorCode(comment)); - c.addConstructorCode(disableInitializers); - } -} - export const signers = { ERC7702: { name: 'SignerERC7702', diff --git a/packages/core/solidity/src/zip-foundry.test.ts b/packages/core/solidity/src/zip-foundry.test.ts index 527147d2f..8667b6d36 100644 --- a/packages/core/solidity/src/zip-foundry.test.ts +++ b/packages/core/solidity/src/zip-foundry.test.ts @@ -156,9 +156,7 @@ async function runTest(c: Contract, t: ExecutionContext, opts: GenericO } function assertLayout(zip: JSZip, c: Contract, t: ExecutionContext) { - const sorted = Object.values(zip.files) - .map(f => f.name) - .sort(); + const sorted = Object.keys(zip.files).sort(); t.deepEqual(sorted, [ 'README.md', 'script/', @@ -187,9 +185,8 @@ async function extractAndRunPackage(zip: JSZip, c: Contract, t: ExecutionContext const setGitUser = 'git init && git config user.email "test@test.test" && git config user.name "Test"'; const setup = 'bash setup.sh'; - const test = 'forge test' + (c.shouldUseUpgradesPluginsForProxyDeployment ? ' --force' : ''); - const script = - `forge script script/${c.name}.s.sol` + (c.shouldUseUpgradesPluginsForProxyDeployment ? ' --force' : ''); + const test = 'forge test' + (c.upgradeable ? ' --force' : ''); + const script = `forge script script/${c.name}.s.sol` + (c.upgradeable ? ' --force' : ''); const exec = (cmd: string) => util.promisify(child.exec)(cmd, { env: { ...process.env, NO_COLOR: '' } }); diff --git a/packages/core/solidity/src/zip-foundry.test.ts.md b/packages/core/solidity/src/zip-foundry.test.ts.md index dcccd0261..f3f4dfc1f 100644 --- a/packages/core/solidity/src/zip-foundry.test.ts.md +++ b/packages/core/solidity/src/zip-foundry.test.ts.md @@ -38,7 +38,6 @@ Generated by [AVA](https://avajs.dev). ␊ # Install OpenZeppelin Contracts␊ forge install OpenZeppelin/openzeppelin-contracts@vX.Y.Z --quiet␊ - ␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ @@ -55,7 +54,6 @@ Generated by [AVA](https://avajs.dev). echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ - ␊ ␊ # Perform initial git commit␊ git add .␊ @@ -235,9 +233,8 @@ Generated by [AVA](https://avajs.dev). # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ - # Install OpenZeppelin Contracts␊ + # Install OpenZeppelin Contracts and Upgrades␊ forge install OpenZeppelin/openzeppelin-contracts-upgradeable@vX.Y.Z --quiet␊ - # Install OpenZeppelin Foundry Upgrades␊ forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet␊ ␊ # Remove unneeded Foundry template files␊ @@ -256,6 +253,7 @@ Generated by [AVA](https://avajs.dev). fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt␊ + ␊ # Add settings in foundry.toml␊ echo "" >> foundry.toml␊ echo "ffi = true" >> foundry.toml␊ @@ -357,7 +355,8 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(address tokenBridge_, address recipient, address initialOwner)␊ - public initializer␊ + public␊ + initializer␊ {␊ __ERC20_init("My Token", "MTK");␊ __ERC20Bridgeable_init();␊ @@ -477,9 +476,8 @@ Generated by [AVA](https://avajs.dev). # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ - # Install OpenZeppelin Contracts␊ + # Install OpenZeppelin Contracts and Upgrades␊ forge install OpenZeppelin/openzeppelin-contracts-upgradeable@vX.Y.Z --quiet␊ - # Install OpenZeppelin Foundry Upgrades␊ forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet␊ ␊ # Remove unneeded Foundry template files␊ @@ -498,6 +496,7 @@ Generated by [AVA](https://avajs.dev). fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt␊ + ␊ # Add settings in foundry.toml␊ echo "" >> foundry.toml␊ echo "ffi = true" >> foundry.toml␊ @@ -590,9 +589,7 @@ Generated by [AVA](https://avajs.dev). _disableInitializers();␊ }␊ ␊ - function initialize(address defaultAdmin, address upgrader)␊ - public initializer␊ - {␊ + function initialize(address defaultAdmin, address upgrader) public initializer {␊ __ERC20_init("My Token", "MTK");␊ __ERC20Permit_init("My Token");␊ __AccessControl_init();␊ @@ -668,9 +665,8 @@ Generated by [AVA](https://avajs.dev). # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ - # Install OpenZeppelin Contracts␊ + # Install OpenZeppelin Contracts and Upgrades␊ forge install OpenZeppelin/openzeppelin-contracts-upgradeable@vX.Y.Z --quiet␊ - # Install OpenZeppelin Foundry Upgrades␊ forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet␊ ␊ # Remove unneeded Foundry template files␊ @@ -689,6 +685,7 @@ Generated by [AVA](https://avajs.dev). fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt␊ + ␊ # Add settings in foundry.toml␊ echo "" >> foundry.toml␊ echo "ffi = true" >> foundry.toml␊ @@ -850,7 +847,6 @@ Generated by [AVA](https://avajs.dev). ␊ # Install OpenZeppelin Contracts␊ forge install OpenZeppelin/openzeppelin-contracts@vX.Y.Z --quiet␊ - ␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ @@ -867,7 +863,6 @@ Generated by [AVA](https://avajs.dev). echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ - ␊ ␊ # Perform initial git commit␊ git add .␊ @@ -1001,9 +996,8 @@ Generated by [AVA](https://avajs.dev). # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ - # Install OpenZeppelin Contracts␊ + # Install OpenZeppelin Contracts and Upgrades␊ forge install OpenZeppelin/openzeppelin-contracts-upgradeable@vX.Y.Z --quiet␊ - # Install OpenZeppelin Foundry Upgrades␊ forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet␊ ␊ # Remove unneeded Foundry template files␊ @@ -1022,6 +1016,7 @@ Generated by [AVA](https://avajs.dev). fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt␊ + ␊ # Add settings in foundry.toml␊ echo "" >> foundry.toml␊ echo "ffi = true" >> foundry.toml␊ @@ -1181,7 +1176,6 @@ Generated by [AVA](https://avajs.dev). ␊ # Install OpenZeppelin Contracts␊ forge install OpenZeppelin/openzeppelin-contracts@vX.Y.Z --quiet␊ - ␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ @@ -1198,7 +1192,6 @@ Generated by [AVA](https://avajs.dev). echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ - ␊ ␊ # Perform initial git commit␊ git add .␊ @@ -1270,20 +1263,10 @@ Generated by [AVA](https://avajs.dev). import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerECDSA, ERC721Holder, ERC1155Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor(address signer) EIP712("My Account", "1") SignerECDSA(signer) {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ + contract MyAccount is Account, EIP712, ERC7739, SignerECDSA, ERC721Holder, ERC1155Holder {␊ + constructor(address signer) EIP712("My Account", "1") SignerECDSA(signer) {}␊ }␊ `, `// SPDX-License-Identifier: MIT␊ @@ -1339,9 +1322,9 @@ Generated by [AVA](https://avajs.dev). # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ - # Install OpenZeppelin Contracts␊ + # Install OpenZeppelin Contracts and Upgrades␊ forge install OpenZeppelin/openzeppelin-contracts-upgradeable@vX.Y.Z --quiet␊ - ␊ + forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ @@ -1360,6 +1343,12 @@ Generated by [AVA](https://avajs.dev). echo "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt␊ ␊ + # Add settings in foundry.toml␊ + echo "" >> foundry.toml␊ + echo "ffi = true" >> foundry.toml␊ + echo "ast = true" >> foundry.toml␊ + echo "build_info = true" >> foundry.toml␊ + echo "extra_output = [\\"storageLayout\\"]" >> foundry.toml␊ ␊ # Perform initial git commit␊ git add .␊ @@ -1387,7 +1376,7 @@ Generated by [AVA](https://avajs.dev). ## Testing the contract␊ ␊ \`\`\`␊ - forge test␊ + forge test --force␊ \`\`\`␊ ␊ ## Deploying the contract␊ @@ -1395,7 +1384,7 @@ Generated by [AVA](https://avajs.dev). You can simulate a deployment by running the script:␊ ␊ \`\`\`␊ - forge script script/MyAccount.s.sol␊ + forge script script/MyAccount.s.sol --force␊ \`\`\`␊ ␊ See [Solidity scripting guide](https://book.getfoundry.sh/guides/scripting-with-solidity) for more information.␊ @@ -1405,16 +1394,28 @@ Generated by [AVA](https://avajs.dev). ␊ import {Script} from "forge-std/Script.sol";␊ import {console} from "forge-std/console.sol";␊ + import {Upgrades, Options} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyAccount} from "src/MyAccount.sol";␊ ␊ contract MyAccountScript is Script {␊ function setUp() public {}␊ ␊ function run() public {␊ + // TODO: Set addresses for the variables below, then uncomment the following section:␊ + /*␊ vm.startBroadcast();␊ - MyAccount instance = new MyAccount();␊ - console.log("Contract deployed to %s", address(instance));␊ + address signer = ;␊ + Options memory opts;␊ + opts.unsafeAllow = "constructor";␊ + address proxy = Upgrades.deployUUPSProxy(␊ + "MyAccount.sol",␊ + abi.encodeCall(MyAccount.initialize, (signer)),␊ + opts␊ + );␊ + MyAccount instance = MyAccount(payable(proxy));␊ + console.log("Proxy deployed to %s", address(instance));␊ vm.stopBroadcast();␊ + */␊ }␊ }␊ `, @@ -1439,6 +1440,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -1452,13 +1454,22 @@ Generated by [AVA](https://avajs.dev). pragma solidity ^0.8.27;␊ ␊ import {Test} from "forge-std/Test.sol";␊ + import {Upgrades, Options} from "openzeppelin-foundry-upgrades/Upgrades.sol";␊ import {MyAccount} from "src/MyAccount.sol";␊ ␊ contract MyAccountTest is Test {␊ MyAccount public instance;␊ ␊ function setUp() public {␊ - instance = new MyAccount();␊ + address signer = vm.addr(1);␊ + Options memory opts;␊ + opts.unsafeAllow = "constructor";␊ + address proxy = Upgrades.deployUUPSProxy(␊ + "MyAccount.sol",␊ + abi.encodeCall(MyAccount.initialize, (signer)),␊ + opts␊ + );␊ + instance = MyAccount(payable(proxy));␊ }␊ ␊ function testSomething() public {␊ @@ -1502,7 +1513,6 @@ Generated by [AVA](https://avajs.dev). ␊ # Install OpenZeppelin Contracts␊ forge install OpenZeppelin/openzeppelin-contracts@vX.Y.Z --quiet␊ - ␊ ␊ # Remove unneeded Foundry template files␊ rm src/Counter.sol␊ @@ -1519,7 +1529,6 @@ Generated by [AVA](https://avajs.dev). echo "" >> remappings.txt␊ fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ - ␊ ␊ # Perform initial git commit␊ git add .␊ @@ -1637,9 +1646,8 @@ Generated by [AVA](https://avajs.dev). # Initialize sample Foundry project␊ forge init --force --quiet␊ ␊ - # Install OpenZeppelin Contracts␊ + # Install OpenZeppelin Contracts and Upgrades␊ forge install OpenZeppelin/openzeppelin-contracts-upgradeable@vX.Y.Z --quiet␊ - # Install OpenZeppelin Foundry Upgrades␊ forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet␊ ␊ # Remove unneeded Foundry template files␊ @@ -1658,6 +1666,7 @@ Generated by [AVA](https://avajs.dev). fi␊ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/" >> remappings.txt␊ echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt␊ + ␊ # Add settings in foundry.toml␊ echo "" >> foundry.toml␊ echo "ffi = true" >> foundry.toml␊ diff --git a/packages/core/solidity/src/zip-foundry.test.ts.snap b/packages/core/solidity/src/zip-foundry.test.ts.snap index 065cc8289..7debb3adf 100644 Binary files a/packages/core/solidity/src/zip-foundry.test.ts.snap and b/packages/core/solidity/src/zip-foundry.test.ts.snap differ diff --git a/packages/core/solidity/src/zip-foundry.ts b/packages/core/solidity/src/zip-foundry.ts index 52a437d0c..c6cb7890f 100644 --- a/packages/core/solidity/src/zip-foundry.ts +++ b/packages/core/solidity/src/zip-foundry.ts @@ -6,22 +6,82 @@ import SOLIDITY_VERSION from './solidity-version.json'; import contracts from '../openzeppelin-contracts'; import type { Lines } from './utils/format-lines'; import { formatLinesWithSpaces, spaceBetween } from './utils/format-lines'; +import type { Upgradeable } from './set-upgradeable'; function getHeader(c: Contract) { return [`// SPDX-License-Identifier: ${c.license}`, `pragma solidity ^${SOLIDITY_VERSION};`]; } -const test = (c: Contract, opts?: GenericOptions) => { - return formatLinesWithSpaces(2, ...spaceBetween(getHeader(c), getImports(c), getTestCase(c))); +function shouldUseUnsafeAllowConstructor(c: Contract): boolean { + // TODO: remove that selector when the upgrades plugin supports @custom:oz-upgrades-unsafe-allow-reachable + return c.parents.find(p => ['EIP712'].includes(p.contract.name)) !== undefined; +} + +function getImports(c: Contract, prepopulateImports: string[]): string[] { + const result: string[] = [...prepopulateImports]; + if (c.upgradeable) { + const unsafeAllowConstructor = shouldUseUnsafeAllowConstructor(c); + + result.push( + unsafeAllowConstructor + ? 'import {Upgrades, Options} from "openzeppelin-foundry-upgrades/Upgrades.sol";' + : 'import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";', + ); + } + result.push(`import {${c.name}} from "src/${c.name}.sol";`); + return result; +} - function getImports(c: Contract) { - const result = ['import {Test} from "forge-std/Test.sol";']; - if (c.shouldUseUpgradesPluginsForProxyDeployment) { - result.push('import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";'); +function getDeploymentCode( + c: Contract, + args: string[], + declareContractVariable: boolean, + upgradeable?: Upgradeable, +): Lines[] { + const unsafeAllowConstructor = shouldUseUnsafeAllowConstructor(c); + const instanceDeclaration = declareContractVariable ? `${c.name} ` : ''; + + switch (upgradeable) { + case 'transparent': + return printDeployProxyAndAssignInstance('deployTransparentProxy', true); + case 'uups': + return printDeployProxyAndAssignInstance('deployUUPSProxy', false); + default: + return [`${instanceDeclaration}instance = new ${c.name}(${args.join(', ')});`]; + } + + function printDeployProxyAndAssignInstance(deployProxyFunctionName: string, includeInitialOwner: boolean) { + const deployProxyArgs = [`"${c.name}.sol"`]; + if (includeInitialOwner) { + deployProxyArgs.push('initialOwner'); + } + deployProxyArgs.push(`abi.encodeCall(${c.name}.initialize, (${args.join(', ')}))`); + if (unsafeAllowConstructor) { + deployProxyArgs.push('opts'); } - result.push(`import {${c.name}} from "src/${c.name}.sol";`); - return result; + for (let i = 0; i < deployProxyArgs.length - 1; i++) { + deployProxyArgs[i] += ','; + } + + return [ + unsafeAllowConstructor && 'Options memory opts;', + unsafeAllowConstructor && 'opts.unsafeAllow = "constructor";', + `address proxy = Upgrades.${deployProxyFunctionName}(`, + deployProxyArgs, + ');', + // Account has a receive function, this requires a payable address + c.parents.find(p => ['Account'].includes(p.contract.name)) + ? `${instanceDeclaration}instance = ${c.name}(payable(proxy));` + : `${instanceDeclaration}instance = ${c.name}(proxy);`, + ].filter(line => line !== false); } +} + +const test = (c: Contract, opts?: GenericOptions) => { + return formatLinesWithSpaces( + 2, + ...spaceBetween(getHeader(c), getImports(c, ['import {Test} from "forge-std/Test.sol";']), getTestCase(c)), + ); function getTestCase(c: Contract) { const args = getAddressArgs(c); @@ -29,43 +89,22 @@ const test = (c: Contract, opts?: GenericOptions) => { `contract ${c.name}Test is Test {`, spaceBetween( [`${c.name} public instance;`], - ['function setUp() public {', getAddressVariables(c, args), getDeploymentCode(c, args), '}'], + [ + 'function setUp() public {', + getAddressVariables(c, args), + getDeploymentCode(c, args, false, opts?.upgradeable), + '}', + ], getContractSpecificTestFunction(), ), '}', ]; } - function getDeploymentCode(c: Contract, args: string[]): Lines[] { - if (c.shouldUseUpgradesPluginsForProxyDeployment) { - if (opts?.upgradeable === 'transparent') { - return [ - `address proxy = Upgrades.deployTransparentProxy(`, - [`"${c.name}.sol",`, `initialOwner,`, `abi.encodeCall(${c.name}.initialize, (${args.join(', ')}))`], - ');', - `instance = ${c.name}(proxy);`, - ]; - } else { - return [ - `address proxy = Upgrades.deployUUPSProxy(`, - [`"${c.name}.sol",`, `abi.encodeCall(${c.name}.initialize, (${args.join(', ')}))`], - ');', - `instance = ${c.name}(proxy);`, - ]; - } - } else { - return [`instance = new ${c.name}(${args.join(', ')});`]; - } - } - function getAddressVariables(c: Contract, args: string[]): Lines[] { const vars = []; let i = 1; // private key index starts from 1 since it must be non-zero - if ( - c.shouldUseUpgradesPluginsForProxyDeployment && - opts?.upgradeable === 'transparent' && - !args.includes('initialOwner') - ) { + if (c.upgradeable && opts?.upgradeable === 'transparent' && !args.includes('initialOwner')) { vars.push(`address initialOwner = vm.addr(${i++});`); } for (const arg of args) { @@ -108,24 +147,22 @@ function getAddressArgs(c: Contract): string[] { } const script = (c: Contract, opts?: GenericOptions) => { - return formatLinesWithSpaces(2, ...spaceBetween(getHeader(c), getImports(c), getScript(c))); - - function getImports(c: Contract) { - const result = ['import {Script} from "forge-std/Script.sol";', 'import {console} from "forge-std/console.sol";']; - if (c.shouldUseUpgradesPluginsForProxyDeployment) { - result.push('import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";'); - } - result.push(`import {${c.name}} from "src/${c.name}.sol";`); - return result; - } + return formatLinesWithSpaces( + 2, + ...spaceBetween( + getHeader(c), + getImports(c, ['import {Script} from "forge-std/Script.sol";', 'import {console} from "forge-std/console.sol";']), + getScript(c), + ), + ); function getScript(c: Contract) { const args = getAddressArgs(c); const deploymentLines = [ 'vm.startBroadcast();', ...getAddressVariables(c, args), - ...getDeploymentCode(c, args), - `console.log("${c.shouldUseUpgradesPluginsForProxyDeployment ? 'Proxy' : 'Contract'} deployed to %s", address(instance));`, + ...getDeploymentCode(c, args, true, opts?.upgradeable), + `console.log("${c.upgradeable ? 'Proxy' : 'Contract'} deployed to %s", address(instance));`, 'vm.stopBroadcast();', ]; return [ @@ -138,35 +175,9 @@ const script = (c: Contract, opts?: GenericOptions) => { ]; } - function getDeploymentCode(c: Contract, args: string[]): Lines[] { - if (c.shouldUseUpgradesPluginsForProxyDeployment) { - if (opts?.upgradeable === 'transparent') { - return [ - `address proxy = Upgrades.deployTransparentProxy(`, - [`"${c.name}.sol",`, `initialOwner,`, `abi.encodeCall(${c.name}.initialize, (${args.join(', ')}))`], - ');', - `${c.name} instance = ${c.name}(proxy);`, - ]; - } else { - return [ - `address proxy = Upgrades.deployUUPSProxy(`, - [`"${c.name}.sol",`, `abi.encodeCall(${c.name}.initialize, (${args.join(', ')}))`], - ');', - `${c.name} instance = ${c.name}(proxy);`, - ]; - } - } else { - return [`${c.name} instance = new ${c.name}(${args.join(', ')});`]; - } - } - function getAddressVariables(c: Contract, args: string[]): Lines[] { const vars = []; - if ( - c.shouldUseUpgradesPluginsForProxyDeployment && - opts?.upgradeable === 'transparent' && - !args.includes('initialOwner') - ) { + if (c.upgradeable && opts?.upgradeable === 'transparent' && !args.includes('initialOwner')) { vars.push('address initialOwner = ;'); } for (const arg of args) { @@ -214,23 +225,16 @@ then forge init --force --quiet ${ - c.shouldInstallContractsUpgradeable + c.upgradeable ? `\ - # Install OpenZeppelin Contracts - forge install OpenZeppelin/openzeppelin-contracts-upgradeable@v${contracts.version} --quiet\ + # Install OpenZeppelin Contracts and Upgrades + forge install OpenZeppelin/openzeppelin-contracts-upgradeable@v${contracts.version} --quiet + forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet\ ` : `\ # Install OpenZeppelin Contracts forge install OpenZeppelin/openzeppelin-contracts@v${contracts.version} --quiet\ ` -} -${ - c.shouldUseUpgradesPluginsForProxyDeployment - ? `\ - # Install OpenZeppelin Foundry Upgrades - forge install OpenZeppelin/openzeppelin-foundry-upgrades --quiet\ -` - : '' } # Remove unneeded Foundry template files @@ -248,18 +252,11 @@ ${ echo "" >> remappings.txt fi ${ - c.shouldInstallContractsUpgradeable + c.upgradeable ? `\ echo "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/" >> remappings.txt - echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt\ -` - : `\ - echo "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/" >> remappings.txt\ -` -} -${ - c.shouldUseUpgradesPluginsForProxyDeployment - ? `\ + echo "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/" >> remappings.txt + # Add settings in foundry.toml echo "" >> foundry.toml echo "ffi = true" >> foundry.toml @@ -267,7 +264,9 @@ ${ echo "build_info = true" >> foundry.toml echo "extra_output = [\\"storageLayout\\"]" >> foundry.toml\ ` - : '' + : `\ + echo "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/" >> remappings.txt\ +` } # Perform initial git commit @@ -298,7 +297,7 @@ bash setup.sh ## Testing the contract \`\`\` -forge test${c.shouldUseUpgradesPluginsForProxyDeployment ? ' --force' : ''} +forge test${c.upgradeable ? ' --force' : ''} \`\`\` ## Deploying the contract @@ -306,7 +305,7 @@ forge test${c.shouldUseUpgradesPluginsForProxyDeployment ? ' --force' : ''} You can simulate a deployment by running the script: \`\`\` -forge script script/${c.name}.s.sol${c.shouldUseUpgradesPluginsForProxyDeployment ? ' --force' : ''} +forge script script/${c.name}.s.sol${c.upgradeable ? ' --force' : ''} \`\`\` See [Solidity scripting guide](https://book.getfoundry.sh/guides/scripting-with-solidity) for more information. diff --git a/packages/core/solidity/src/zip-hardhat.test.ts b/packages/core/solidity/src/zip-hardhat.test.ts index 4daa63619..9caab3734 100644 --- a/packages/core/solidity/src/zip-hardhat.test.ts +++ b/packages/core/solidity/src/zip-hardhat.test.ts @@ -102,7 +102,7 @@ test.serial('account ecdsa', async t => { test.serial('account ecdsa uups', async t => { const opts: GenericOptions = { kind: 'Account', name: 'My Account', signer: 'ECDSA', upgradeable: 'uups' }; const c = buildAccount(opts); - await runIgnitionTest(c, t, opts); // Account does not use proxies for deployment, until factories are added + await runDeployScriptTest(c, t, opts); }); test.serial('custom basic', async t => { @@ -138,9 +138,7 @@ async function runIgnitionTest(c: Contract, t: ExecutionContext, opts: } function assertDeployScriptLayout(zip: JSZip, c: Contract, t: ExecutionContext) { - const sorted = Object.values(zip.files) - .map(f => f.name) - .sort(); + const sorted = Object.keys(zip.files).sort(); t.deepEqual(sorted, [ '.gitignore', 'README.md', @@ -158,9 +156,7 @@ function assertDeployScriptLayout(zip: JSZip, c: Contract, t: ExecutionContext) { - const sorted = Object.values(zip.files) - .map(f => f.name) - .sort(); + const sorted = Object.keys(zip.files).sort(); t.deepEqual(sorted, [ '.gitignore', 'README.md', diff --git a/packages/core/solidity/src/zip-hardhat.test.ts.md b/packages/core/solidity/src/zip-hardhat.test.ts.md index c0068444e..745b178b5 100644 --- a/packages/core/solidity/src/zip-hardhat.test.ts.md +++ b/packages/core/solidity/src/zip-hardhat.test.ts.md @@ -162,7 +162,8 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ function initialize(address tokenBridge_, address recipient, address initialOwner)␊ - public initializer␊ + public␊ + initializer␊ {␊ __ERC20_init("My Token", "MTK");␊ __ERC20Bridgeable_init();␊ @@ -499,20 +500,10 @@ Generated by [AVA](https://avajs.dev). import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";␊ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";␊ import {ERC7739} from "@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol";␊ - import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";␊ import {SignerECDSA} from "@openzeppelin/contracts/utils/cryptography/signers/SignerECDSA.sol";␊ ␊ - contract MyAccount is Initializable, Account, EIP712, ERC7739, SignerECDSA, ERC721Holder, ERC1155Holder {␊ - /// @custom:oz-upgrades-unsafe-allow-reachable constructor␊ - constructor(address signer) EIP712("My Account", "1") SignerECDSA(signer) {␊ - // Accounts are typically deployed and initialized as clones during their first user op,␊ - // therefore, initializers are disabled for the implementation contract␊ - _disableInitializers();␊ - }␊ - ␊ - function initialize(address signer) public initializer {␊ - _setSigner(signer);␊ - }␊ + contract MyAccount is Account, EIP712, ERC7739, SignerECDSA, ERC721Holder, ERC1155Holder {␊ + constructor(address signer) EIP712("My Account", "1") SignerECDSA(signer) {}␊ }␊ `, `import { HardhatUserConfig } from "hardhat/config";␊ @@ -600,6 +591,7 @@ Generated by [AVA](https://avajs.dev). ␊ function initialize(address signer) public initializer {␊ __SignerECDSA_init(signer);␊ + __UUPSUpgradeable_init();␊ }␊ ␊ function _authorizeUpgrade(address newImplementation)␊ @@ -611,7 +603,7 @@ Generated by [AVA](https://avajs.dev). `, `import { HardhatUserConfig } from "hardhat/config";␊ import "@nomicfoundation/hardhat-toolbox";␊ - ␊ + import "@openzeppelin/hardhat-upgrades";␊ ␊ const config: HardhatUserConfig = {␊ solidity: {␊ @@ -644,24 +636,35 @@ Generated by [AVA](https://avajs.dev). "hardhat": "^2.16.1"␊ }␊ }`, - `import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";␊ + `import { ethers, upgrades } from "hardhat";␊ ␊ - export default buildModule("MyAccountModule", (m) => {␊ + async function main() {␊ + const ContractFactory = await ethers.getContractFactory("MyAccount");␊ ␊ - ␊ - const myAccount = m.contract("MyAccount", []);␊ + // TODO: Set addresses for the contract arguments below␊ + const instance = await upgrades.deployProxy(ContractFactory, [signer], { unsafeAllow: 'constructor' });␊ + await instance.waitForDeployment();␊ ␊ - return { myAccount };␊ + console.log(\`Proxy deployed to ${await instance.getAddress()}\`);␊ + }␊ + ␊ + // We recommend this pattern to be able to use async/await everywhere␊ + // and properly handle errors.␊ + main().catch((error) => {␊ + console.error(error);␊ + process.exitCode = 1;␊ });␊ `, `import { expect } from "chai";␊ - import { ethers } from "hardhat";␊ + import { ethers, upgrades } from "hardhat";␊ ␊ describe("MyAccount", function () {␊ it("Test contract", async function () {␊ const ContractFactory = await ethers.getContractFactory("MyAccount");␊ ␊ - const instance = await ContractFactory.deploy();␊ + const signer = (await ethers.getSigners())[0].address;␊ + ␊ + const instance = await upgrades.deployProxy(ContractFactory, [signer], { unsafeAllow: 'constructor' });␊ await instance.waitForDeployment();␊ });␊ });␊ diff --git a/packages/core/solidity/src/zip-hardhat.test.ts.snap b/packages/core/solidity/src/zip-hardhat.test.ts.snap index ed7a6bb80..29d2250f4 100644 Binary files a/packages/core/solidity/src/zip-hardhat.test.ts.snap and b/packages/core/solidity/src/zip-hardhat.test.ts.snap differ diff --git a/packages/core/solidity/src/zip-hardhat.ts b/packages/core/solidity/src/zip-hardhat.ts index 2531d4c57..b85d36663 100644 --- a/packages/core/solidity/src/zip-hardhat.ts +++ b/packages/core/solidity/src/zip-hardhat.ts @@ -6,10 +6,10 @@ import SOLIDITY_VERSION from './solidity-version.json'; import type { Lines } from './utils/format-lines'; import { formatLinesWithSpaces, spaceBetween } from './utils/format-lines'; -const hardhatConfig = (useHardhatUpgrades: boolean) => `\ +const hardhatConfig = (upgradeable: boolean) => `\ import { HardhatUserConfig } from "hardhat/config"; import "@nomicfoundation/hardhat-toolbox"; -${useHardhatUpgrades ? `import "@openzeppelin/hardhat-upgrades";` : ''} +${upgradeable ? `import "@openzeppelin/hardhat-upgrades";` : ''} const config: HardhatUserConfig = { solidity: { @@ -119,9 +119,14 @@ function getAddressArgs(c: Contract): string[] { } function getDeploymentCall(c: Contract, args: string[]): string { - return c.shouldUseUpgradesPluginsForProxyDeployment - ? `upgrades.deployProxy(ContractFactory, [${args.join(', ')}])` - : `ContractFactory.deploy(${args.join(', ')})`; + // TODO: remove that selector when the upgrades plugin supports @custom:oz-upgrades-unsafe-allow-reachable + const unsafeAllowConstructor = c.parents.find(p => ['EIP712'].includes(p.contract.name)) !== undefined; + + return !c.upgradeable + ? `ContractFactory.deploy(${args.join(', ')})` + : unsafeAllowConstructor + ? `upgrades.deployProxy(ContractFactory, [${args.join(', ')}], { unsafeAllow: 'constructor' })` + : `upgrades.deployProxy(ContractFactory, [${args.join(', ')}])`; } const script = (c: Contract) => { @@ -136,7 +141,7 @@ async function main() { const instance = await ${getDeploymentCall(c, args)}; await instance.waitForDeployment(); - console.log(\`${c.shouldUseUpgradesPluginsForProxyDeployment ? 'Proxy' : 'Contract'} deployed to \${await instance.getAddress()}\`); + console.log(\`${c.upgradeable ? 'Proxy' : 'Contract'} deployed to \${await instance.getAddress()}\`); } // We recommend this pattern to be able to use async/await everywhere @@ -169,7 +174,7 @@ export default buildModule("${c.name}Module", (m) => { const readme = (c: Contract) => `\ # Sample Hardhat Project -This project demonstrates a basic Hardhat use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, ${c.shouldUseUpgradesPluginsForProxyDeployment ? 'and a script that deploys that contract' : 'and a Hardhat Ignition module that deploys that contract'}. +This project demonstrates a basic Hardhat use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, ${c.upgradeable ? 'and a script that deploys that contract' : 'and a Hardhat Ignition module that deploys that contract'}. ## Installing dependencies @@ -188,13 +193,13 @@ npm test You can target any network from your Hardhat config using: \`\`\` -${c.shouldUseUpgradesPluginsForProxyDeployment ? 'npx hardhat run --network scripts/deploy.ts' : `npx hardhat ignition deploy ignition/modules/${c.name}.ts --network `} +${c.upgradeable ? 'npx hardhat run --network scripts/deploy.ts' : `npx hardhat ignition deploy ignition/modules/${c.name}.ts --network `} \`\`\` `; function getHardhatPlugins(c: Contract) { const plugins = ['ethers']; - if (c.shouldUseUpgradesPluginsForProxyDeployment) { + if (c.upgradeable) { plugins.push('upgrades'); } return plugins; @@ -203,29 +208,27 @@ function getHardhatPlugins(c: Contract) { export async function zipHardhat(c: Contract, opts?: GenericOptions) { const zip = new JSZip(); - const { default: packageJson } = - c.shouldInstallContractsUpgradeable || c.shouldUseUpgradesPluginsForProxyDeployment - ? await import('./environments/hardhat/upgradeable/package.json') - : await import('./environments/hardhat/package.json'); + const { default: packageJson } = c.upgradeable + ? await import('./environments/hardhat/upgradeable/package.json') + : await import('./environments/hardhat/package.json'); packageJson.license = c.license; - const { default: packageLock } = - c.shouldInstallContractsUpgradeable || c.shouldUseUpgradesPluginsForProxyDeployment - ? await import('./environments/hardhat/upgradeable/package-lock.json') - : await import('./environments/hardhat/package-lock.json'); + const { default: packageLock } = c.upgradeable + ? await import('./environments/hardhat/upgradeable/package-lock.json') + : await import('./environments/hardhat/package-lock.json'); packageLock.packages[''].license = c.license; zip.file(`contracts/${c.name}.sol`, printContract(c)); zip.file('test/test.ts', test(c, opts)); - if (c.shouldUseUpgradesPluginsForProxyDeployment) { + if (c.upgradeable) { zip.file('scripts/deploy.ts', script(c)); } else { zip.file(`ignition/modules/${c.name}.ts`, ignitionModule(c)); } zip.file('.gitignore', gitIgnore); - zip.file('hardhat.config.ts', hardhatConfig(c.shouldUseUpgradesPluginsForProxyDeployment)); + zip.file('hardhat.config.ts', hardhatConfig(c.upgradeable)); zip.file('package.json', JSON.stringify(packageJson, null, 2)); zip.file(`package-lock.json`, JSON.stringify(packageLock, null, 2)); zip.file('README.md', readme(c));