Skip to content

Commit bfe2ece

Browse files
committed
add upgradeable variant of the accounts
1 parent 2b119bf commit bfe2ece

File tree

6 files changed

+7562
-671
lines changed

6 files changed

+7562
-671
lines changed

packages/core/solidity/src/account.test.ts

Lines changed: 90 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -50,72 +50,96 @@ test('account API assert defaults', async t => {
5050
t.is(account.print(account.defaults), account.print());
5151
});
5252

53-
for (const signer of [false, 'ERC7702', 'ECDSA', 'P256', 'RSA', 'Multisig', 'MultisigWeighted'] as const) {
54-
let title = 'Account';
55-
if (signer) {
56-
title += ` with Signer${signer}`;
53+
function format(upgradeable: false | 'uups' | 'transparent') {
54+
switch (upgradeable) {
55+
case false:
56+
return 'non-upgradeable';
57+
case 'uups':
58+
return 'upgradeable uups';
59+
case 'transparent':
60+
return 'upgradeable transparent';
5761
}
62+
}
5863

59-
testAccount(`${title} named`, {
60-
name: `Custom${title}`,
61-
signer,
62-
});
63-
64-
testAccount(`${title} with ERC1271`, {
65-
name: `Custom${title}ERC1271`,
66-
signatureValidation: 'ERC1271',
67-
signer,
68-
});
69-
70-
testAccount(`${title} with ERC7739`, {
71-
name: `Custom${title}ERC7739`,
72-
signatureValidation: 'ERC7739',
73-
signer,
74-
});
75-
76-
testAccount(`${title} with ERC721Holder`, {
77-
name: `Custom${title}ERC721Holder`,
78-
ERC721Holder: true,
79-
signer,
80-
});
81-
82-
testAccount(`${title} with ERC1155Holder`, {
83-
name: `Custom${title}ERC1155Holder`,
84-
ERC1155Holder: true,
85-
signer,
86-
});
87-
88-
testAccount(`${title} with ERC721Holder and ERC1155Holder`, {
89-
name: `Custom${title}ERC721HolderERC1155Holder`,
90-
ERC721Holder: true,
91-
ERC1155Holder: true,
92-
signer,
93-
});
94-
95-
testAccount(`${title} with ERC7821 Execution`, {
96-
signer,
97-
batchedExecution: true,
98-
});
99-
100-
testAccount(`${title} with ERC7579`, {
101-
signer,
102-
ERC7579Modules: 'AccountERC7579',
103-
});
104-
105-
testAccount(`${title} with ERC7579 with ERC1271`, {
106-
signer,
107-
ERC7579Modules: 'AccountERC7579',
108-
signatureValidation: 'ERC1271',
109-
});
110-
111-
testAccount(`${title} with ERC7579 with ERC7739`, {
112-
signer,
113-
ERC7579Modules: 'AccountERC7579',
114-
signatureValidation: 'ERC7739',
115-
});
116-
117-
testAccount(`${title} with ERC7579 hooks`, {
118-
signer,
119-
ERC7579Modules: 'AccountERC7579Hooked',
120-
});
64+
for (const signer of [false, 'ERC7702', 'ECDSA', 'P256', 'RSA', 'Multisig', 'MultisigWeighted'] as const) {
65+
for (const upgradeable of [false, 'uups', 'transparent'] as const) {
66+
let title = 'Account';
67+
if (signer) {
68+
title += ` with Signer${signer}`;
69+
}
70+
71+
testAccount(`${title} named ${format(upgradeable)}`, {
72+
name: `Custom${title}`,
73+
signer,
74+
upgradeable,
75+
});
76+
77+
testAccount(`${title} with ERC1271 ${format(upgradeable)}`, {
78+
name: `Custom${title}ERC1271`,
79+
signatureValidation: 'ERC1271',
80+
signer,
81+
upgradeable,
82+
});
83+
84+
testAccount(`${title} with ERC7739 ${format(upgradeable)}`, {
85+
name: `Custom${title}ERC7739`,
86+
signatureValidation: 'ERC7739',
87+
signer,
88+
upgradeable,
89+
});
90+
91+
testAccount(`${title} with ERC721Holder ${format(upgradeable)}`, {
92+
name: `Custom${title}ERC721Holder`,
93+
ERC721Holder: true,
94+
signer,
95+
upgradeable,
96+
});
97+
98+
testAccount(`${title} with ERC1155Holder ${format(upgradeable)}`, {
99+
name: `Custom${title}ERC1155Holder`,
100+
ERC1155Holder: true,
101+
signer,
102+
upgradeable,
103+
});
104+
105+
testAccount(`${title} with ERC721Holder and ERC1155Holder ${format(upgradeable)}`, {
106+
name: `Custom${title}ERC721HolderERC1155Holder`,
107+
ERC721Holder: true,
108+
ERC1155Holder: true,
109+
signer,
110+
upgradeable,
111+
});
112+
113+
testAccount(`${title} with ERC7821 Execution ${format(upgradeable)}`, {
114+
signer,
115+
upgradeable,
116+
batchedExecution: true,
117+
});
118+
119+
testAccount(`${title} with ERC7579 ${format(upgradeable)}`, {
120+
signer,
121+
upgradeable,
122+
ERC7579Modules: 'AccountERC7579',
123+
});
124+
125+
testAccount(`${title} with ERC7579 with ERC1271 ${format(upgradeable)}`, {
126+
signer,
127+
upgradeable,
128+
ERC7579Modules: 'AccountERC7579',
129+
signatureValidation: 'ERC1271',
130+
});
131+
132+
testAccount(`${title} with ERC7579 with ERC7739 ${format(upgradeable)}`, {
133+
signer,
134+
upgradeable,
135+
ERC7579Modules: 'AccountERC7579',
136+
signatureValidation: 'ERC7739',
137+
});
138+
139+
testAccount(`${title} with ERC7579 hooks ${format(upgradeable)}`, {
140+
signer,
141+
upgradeable,
142+
ERC7579Modules: 'AccountERC7579Hooked',
143+
});
144+
}
121145
}

0 commit comments

Comments
 (0)