Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
c307896
WIP: Add Account
ernestognw Mar 15, 2025
bdff9fd
Fix imports and bump OZ Contracts
ernestognw Mar 15, 2025
5c6d48e
Rewrite
ernestognw Mar 15, 2025
f08c43e
UI Update
ernestognw Mar 15, 2025
8db6933
Add ERC-7821 execution
ernestognw Mar 15, 2025
dee4c35
Add Paymaster
ernestognw Mar 16, 2025
c2d9203
UI Changes
ernestognw Mar 16, 2025
194d983
Change compiler version and fix resolution of isValidSignature
ernestognw Mar 27, 2025
6e3d64f
Merge branch 'master' into feature/accounts
ernestognw Mar 27, 2025
9eb0614
Merge branch 'master' into feature/accounts
ernestognw Apr 8, 2025
b192934
Deprecate AccountCore
ernestognw Apr 8, 2025
3d858f0
Add 7821 explanation
ernestognw Apr 8, 2025
2684262
Merge branch 'master' into feature/accounts
ernestognw Apr 8, 2025
131d4a1
Adjust CHANGELOG
ernestognw Apr 8, 2025
57bfd02
up
ernestognw Apr 8, 2025
089fa74
Use 0.8.27
ernestognw Apr 9, 2025
41ca8cc
Remove paymaster
ernestognw Apr 9, 2025
6004cd3
Update
ernestognw Apr 9, 2025
3179fca
Merge branch 'master' into feature/accounts
ernestognw Apr 9, 2025
91ff04a
up
ernestognw Apr 9, 2025
6b44292
Update snapshots
ernestognw Apr 9, 2025
3e35883
up
ernestognw Apr 9, 2025
2791da4
lint
ernestognw Apr 9, 2025
c7a6905
update language.ts
ernestognw Apr 9, 2025
e2c5cf5
ADd solidityAccountAIFunctionDefinition
ernestognw Apr 10, 2025
9ba59e4
Upgrade to hardhat 2.22.11 with support for Solidity 0.8.27
ernestognw Apr 10, 2025
bfc82d7
Upgrade to hardhat 2.22.11 with support for Solidity 0.8.27
ernestognw Apr 10, 2025
5c1eaf8
Improve comments
ernestognw Apr 11, 2025
cdc8591
chore: empty commit
ernestognw Apr 11, 2025
ebee0c8
Update packages/ui/src/solidity/AccountControls.svelte
ernestognw Apr 12, 2025
066fd4a
Update packages/ui/src/solidity/AccountControls.svelte
ernestognw Apr 12, 2025
3081dfb
Update packages/ui/src/solidity/AccountControls.svelte
ernestognw Apr 12, 2025
85ead5c
Update packages/ui/src/solidity/AccountControls.svelte
ernestognw Apr 12, 2025
105ef3d
Update packages/ui/src/solidity/AccountControls.svelte
ernestognw Apr 12, 2025
fbd7ca8
Apply suggestions from code review
ernestognw Apr 12, 2025
111ab67
Update packages/ui/src/solidity/AccountControls.svelte
ernestognw Apr 12, 2025
5fa3f9c
Apply review suggestions
ernestognw Apr 12, 2025
bfdaa32
up
ernestognw Apr 12, 2025
be23c70
Update AccountOptions
ernestognw Apr 12, 2025
505ae67
fix test
ernestognw Apr 12, 2025
d7796cf
Fix issues
ernestognw Apr 12, 2025
bcc673d
up
ernestognw Apr 12, 2025
498a46d
Use ExpandableToggleRadio for signer
ernestognw Apr 12, 2025
8f0cd8f
up
ernestognw Apr 12, 2025
f3a9e50
up
ernestognw Apr 12, 2025
3b7ab59
Adjust styling and grammar
ericglau Apr 12, 2025
d65e8f2
Remove upgradeable and access from Account options type
ericglau Apr 12, 2025
7f9db90
Format svelte
ericglau Apr 12, 2025
872129f
Revert "Remove upgradeable and access from Account options type"
ericglau Apr 12, 2025
2020082
Set access ai options to false
ericglau Apr 12, 2025
ad55698
Force upgradeable and access to false
ericglau Apr 12, 2025
cd84fe5
Update CHANGELOG.md
ericglau Apr 12, 2025
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
"typescript-eslint": "^8.29.0",
"wsrun": "^5.2.4"
}
}
}
7 changes: 7 additions & 0 deletions packages/core/solidity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Unreleased

- Add `account` contract types for ERC-4337. ([#486](https://github.com/OpenZeppelin/contracts-wizard/pull/486))

- **Potentially breaking changes**:
- Update pragma versions to 0.8.27. ([#486](https://github.com/OpenZeppelin/contracts-wizard/pull/486))

## 0.5.4 (2025-04-01)

- Add validation for ERC20 premint field. ([#488](https://github.com/OpenZeppelin/contracts-wizard/pull/488))
Expand Down
16 changes: 13 additions & 3 deletions packages/core/solidity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ The following contract types are supported:
- `erc1155`
- `stablecoin`
- `realWorldAsset`
- `account`
- `governor`
- `custom`

Note that `stablecoin` and `realWorldAsset` are experimental and may be subject to change.
Note that `stablecoin`, `realWorldAsset`, and `account` are experimental and may be subject to change.

Each contract type has functions/constants as defined below.

Expand All @@ -41,6 +42,9 @@ function print(opts?: ERC1155Options): string
function print(opts?: StablecoinOptions): string
```
```js
function print(opts?: AccountOptions): string
```
```js
function print(opts?: GovernorOptions): string
```
```js
Expand All @@ -62,6 +66,9 @@ const defaults: Required<ERC1155Options>
const defaults: Required<StablecoinOptions>
```
```js
const defaults: Required<AccountOptions>
```
```js
const defaults: Required<GovernorOptions>
```
```js
Expand All @@ -88,7 +95,10 @@ function isAccessControlRequired(opts: Partial<GovernorOptions>): boolean
```js
function isAccessControlRequired(opts: Partial<CustomOptions>): boolean
```
Whether any of the provided options require access control to be enabled. If this returns `true`, then calling `print` with the same options would cause the `access` option to default to `'ownable'` if it was `undefined` or `false`.
Whether any of the provided options require access control to be enabled. If this returns `true`, then calling `print` with the same options would cause the `access` option to default to `'ownable'` if it was `undefined` or `false`.

> Note that contracts such as `account`, have its own way of handling permissions and do not support the `access` option.
Thus, that type does not include `isAccessControlRequired`.

### Examples

Expand Down Expand Up @@ -119,4 +129,4 @@ const contract = erc20.print({
...erc20.defaults,
upgradeable: 'uups',
});
```
```
11 changes: 10 additions & 1 deletion packages/core/solidity/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,14 @@ task(TASK_COMPILE_SOLIDITY_MERGE_COMPILATION_JOBS, async ({ compilationJobs }, _
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: SOLIDITY_VERSION,
solidity: {
version: SOLIDITY_VERSION,
settings: {
evmVersion: 'cancun',
optimizer: {
enabled: true,
runs: 200,
},
},
},
};
8 changes: 4 additions & 4 deletions packages/core/solidity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
},
"devDependencies": {
"@openzeppelin/community-contracts": "https://github.com/OpenZeppelin/openzeppelin-community-contracts",
"@openzeppelin/contracts": "^5.1.0",
"@openzeppelin/contracts-upgradeable": "^5.1.0",
"@openzeppelin/contracts": "^5.3.0",
"@openzeppelin/contracts-upgradeable": "^5.3.0",
"@types/node": "^18.0.0",
"@types/semver": "^7.5.7",
"ava": "^6.0.0",
"hardhat": "^2.1.1",
"hardhat": "^2.22.11",
"jszip": "^3.6.0",
"rimraf": "^5.0.0",
"semver": "^7.6.0",
"solidity-ast": "^0.4.18",
"ts-node": "^10.4.0",
"typescript": "^5.0.0"
}
}
}
109 changes: 109 additions & 0 deletions packages/core/solidity/src/account.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import test from 'ava';
import { account } from '.';

import type { AccountOptions } from './account';
import { buildAccount } from './account';
import { printContract } from './print';

/**
* Tests external API for equivalence with internal API
*/
function testAPIEquivalence(title: string, opts?: AccountOptions) {
test(title, t => {
t.is(
account.print(opts),
printContract(
buildAccount({
name: 'MyAccount',
signatureValidation: 'ERC7739',
ERC721Holder: true,
ERC1155Holder: true,
batchedExecution: false,
ERC7579Modules: false,
...opts,
}),
),
);
});
}

function testAccount(title: string, opts: Partial<AccountOptions>) {
const fullOpts = {
name: 'MyAccount',
ERC1271: false as const,
ERC721Holder: false,
ERC1155Holder: false,
ERC7821: false as const,
ERC7579: false as const,
...opts,
};
test(title, t => {
const c = buildAccount(fullOpts);
t.snapshot(printContract(c));
});
testAPIEquivalence(`${title} API equivalence`, fullOpts);
}

testAPIEquivalence('account API default');

test('account API assert defaults', async t => {
t.is(account.print(account.defaults), account.print());
});

for (const signer of [undefined, 'ERC7702', 'ECDSA', 'P256', 'RSA'] as const) {
let title = 'Account';
if (signer) {
title += ` with Signer${signer}`;
}

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 hooks`, {
signer,
ERC7579Modules: 'AccountERC7579Hooked',
});
}
Loading
Loading