Skip to content

Update account generation to use code from 5.4.0-rc.1 #577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/solidity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
},
"devDependencies": {
"@openzeppelin/community-contracts": "https://github.com/OpenZeppelin/openzeppelin-community-contracts",
"@openzeppelin/contracts": "^5.3.0",
"@openzeppelin/contracts-upgradeable": "^5.3.0",
"@openzeppelin/contracts": "^5.4.0-rc.1",
"@openzeppelin/contracts-upgradeable": "^5.4.0-rc.1",
"@types/node": "^20.0.0",
"@types/semver": "^7.5.7",
"ava": "^6.0.0",
Expand Down
156 changes: 90 additions & 66 deletions packages/core/solidity/src/account.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,72 +50,96 @@ test('account API assert defaults', async t => {
t.is(account.print(account.defaults), account.print());
});

for (const signer of [false, 'ERC7702', 'ECDSA', 'P256', 'RSA', 'Multisig', 'MultisigWeighted'] as const) {
let title = 'Account';
if (signer) {
title += ` with Signer${signer}`;
function format(upgradeable: false | 'uups' | 'transparent') {
switch (upgradeable) {
case false:
return 'non-upgradeable';
case 'uups':
return 'upgradeable uups';
case 'transparent':
return 'upgradeable transparent';
}
}

testAccount(`${title} named`, {
name: `Custom${title}`,
signer,
});

testAccount(`${title} with ERC1271`, {
name: `Custom${title}ERC1271`,
signatureValidation: 'ERC1271',
signer,
});

testAccount(`${title} with ERC7739`, {
name: `Custom${title}ERC7739`,
signatureValidation: 'ERC7739',
signer,
});

testAccount(`${title} with ERC721Holder`, {
name: `Custom${title}ERC721Holder`,
ERC721Holder: true,
signer,
});

testAccount(`${title} with ERC1155Holder`, {
name: `Custom${title}ERC1155Holder`,
ERC1155Holder: true,
signer,
});

testAccount(`${title} with ERC721Holder and ERC1155Holder`, {
name: `Custom${title}ERC721HolderERC1155Holder`,
ERC721Holder: true,
ERC1155Holder: true,
signer,
});

testAccount(`${title} with ERC7821 Execution`, {
signer,
batchedExecution: true,
});

testAccount(`${title} with ERC7579`, {
signer,
ERC7579Modules: 'AccountERC7579',
});

testAccount(`${title} with ERC7579 with ERC1271`, {
signer,
ERC7579Modules: 'AccountERC7579',
signatureValidation: 'ERC1271',
});

testAccount(`${title} with ERC7579 with ERC7739`, {
signer,
ERC7579Modules: 'AccountERC7579',
signatureValidation: 'ERC7739',
});

testAccount(`${title} with ERC7579 hooks`, {
signer,
ERC7579Modules: 'AccountERC7579Hooked',
});
for (const signer of [false, 'ERC7702', 'ECDSA', 'P256', 'RSA', 'Multisig', 'MultisigWeighted'] as const) {
for (const upgradeable of [false, 'uups', 'transparent'] as const) {
let title = 'Account';
if (signer) {
title += ` with Signer${signer}`;
}

testAccount(`${title} named ${format(upgradeable)}`, {
name: `Custom${title}`,
signer,
upgradeable,
});

testAccount(`${title} with ERC1271 ${format(upgradeable)}`, {
name: `Custom${title}ERC1271`,
signatureValidation: 'ERC1271',
signer,
upgradeable,
});

testAccount(`${title} with ERC7739 ${format(upgradeable)}`, {
name: `Custom${title}ERC7739`,
signatureValidation: 'ERC7739',
signer,
upgradeable,
});

testAccount(`${title} with ERC721Holder ${format(upgradeable)}`, {
name: `Custom${title}ERC721Holder`,
ERC721Holder: true,
signer,
upgradeable,
});

testAccount(`${title} with ERC1155Holder ${format(upgradeable)}`, {
name: `Custom${title}ERC1155Holder`,
ERC1155Holder: true,
signer,
upgradeable,
});

testAccount(`${title} with ERC721Holder and ERC1155Holder ${format(upgradeable)}`, {
name: `Custom${title}ERC721HolderERC1155Holder`,
ERC721Holder: true,
ERC1155Holder: true,
signer,
upgradeable,
});

testAccount(`${title} with ERC7821 Execution ${format(upgradeable)}`, {
signer,
upgradeable,
batchedExecution: true,
});

testAccount(`${title} with ERC7579 ${format(upgradeable)}`, {
signer,
upgradeable,
ERC7579Modules: 'AccountERC7579',
});

testAccount(`${title} with ERC7579 with ERC1271 ${format(upgradeable)}`, {
signer,
upgradeable,
ERC7579Modules: 'AccountERC7579',
signatureValidation: 'ERC1271',
});

testAccount(`${title} with ERC7579 with ERC7739 ${format(upgradeable)}`, {
signer,
upgradeable,
ERC7579Modules: 'AccountERC7579',
signatureValidation: 'ERC7739',
});

testAccount(`${title} with ERC7579 hooks ${format(upgradeable)}`, {
signer,
upgradeable,
ERC7579Modules: 'AccountERC7579Hooked',
});
}
}
Loading
Loading