Skip to content

Add ERC7579 modules #553

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

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft
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
29 changes: 29 additions & 0 deletions packages/common/src/ai/descriptions/solidity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export const solidityPrompts = {
RWA: 'Make a real-world asset token that uses the ERC-20 standard. Experimental, some features are not audited and are subject to change.',
Account:
'Make an account contract that follows the ERC-4337 standard. Experimental, some features are not audited and are subject to change.',
ERC7579:
'Make an account module contract that follows the ERC-7579 standard. Experimental, some features are not audited and are subject to change.',
Governor: 'Make a contract to implement governance, such as for a DAO.',
Custom: 'Make a custom smart contract.',
};
Expand Down Expand Up @@ -95,3 +97,30 @@ export const solidityGovernorDescriptions = {
storage: 'Enable storage of proposal details and enumerability of proposals',
settings: 'Allow governance to update voting settings (delay, period, proposal threshold)',
};

export const solidityERC7579Descriptions = {
validator: {
signature:
'Whether the account supports signature validation via ERC-7913, enabling cryptographic verification of user operations.',
multisig: {
weighted:
'Whether the multisig validator supports weighted signatures, allowing each signer to have a different voting weight for flexible threshold schemes.',
confirmation:
'Whether the multisig validator requires explicit confirmation (e.g., EIP-712 signature) from each signer when adding them to the multisig module.',
},
_description: `The validator module for the account. Options:
- signature: Whether the account supports signature validation via ERC-7913, enabling cryptographic verification of user operations.
- multisig: The multisig validator module.
- weighted: Whether the multisig validator supports weighted signatures, allowing each signer to have a different voting weight for flexible threshold schemes.
- confirmation: Whether the multisig validator requires explicit confirmation (e.g., EIP-712 signature) from each signer when adding them to the multisig module.
`,
},
executor: {
delayed: 'Whether the executor module supports delayed or scheduled execution of operations.',
_description: `The executor module for the account. Options:
- delayed: Whether the executor module supports delayed or scheduled execution of operations.`,
},
hook: 'Whether the account supports hooks, which are modules that can execute custom logic before and/or after account operations.',
fallback:
'Whether the account supports fallback handlers, which can extend the fallback functionality of the account and handle calls to unknown functions.',
};
3 changes: 3 additions & 0 deletions packages/core/solidity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## Unreleased

- Add `erc7579` contract types for ERC-7579 modules.

## 0.6.0 (2025-06-20)

Expand Down
8 changes: 7 additions & 1 deletion packages/core/solidity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The following contract types are supported:
- `governor`
- `custom`

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

Each contract type has functions/constants as defined below.

Expand All @@ -45,6 +45,9 @@ function print(opts?: StablecoinOptions): string
function print(opts?: AccountOptions): string
```
```js
function print(opts?: ERC7579Options): string
```
```js
function print(opts?: GovernorOptions): string
```
```js
Expand All @@ -69,6 +72,9 @@ const defaults: Required<StablecoinOptions>
const defaults: Required<AccountOptions>
```
```js
const defaults: Required<ERC7579Options>
```
```js
const defaults: Required<GovernorOptions>
```
```js
Expand Down
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
314 changes: 157 additions & 157 deletions packages/core/solidity/src/account.test.ts.md

Large diffs are not rendered by default.

Binary file modified packages/core/solidity/src/account.test.ts.snap
Binary file not shown.
4 changes: 2 additions & 2 deletions packages/core/solidity/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function addSignatureValidation(c: ContractBuilder, opts: AccountOptions) {
case 'ERC7739':
c.addParent({
name: 'ERC7739',
path: '@openzeppelin/community-contracts/utils/cryptography/ERC7739.sol',
path: '@openzeppelin/community-contracts/utils/cryptography/signers/ERC7739.sol',
});
break;
case 'ERC1271':
Expand Down Expand Up @@ -224,7 +224,7 @@ function overrideRawSignatureValidation(c: ContractBuilder, opts: AccountOptions
if (opts.signer && opts.ERC7579Modules) {
c.addImportOnly({
name: 'AbstractSigner',
path: '@openzeppelin/community-contracts/utils/cryptography/AbstractSigner.sol',
path: '@openzeppelin/community-contracts/utils/cryptography/signers/AbstractSigner.sol',
});
c.addOverride({ name: 'AbstractSigner' }, signerFunctions._rawSignatureValidation);
c.addOverride({ name: 'AccountERC7579' }, signerFunctions._rawSignatureValidation);
Expand Down
7 changes: 7 additions & 0 deletions packages/core/solidity/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {
} from './stablecoin';
import type { AccountOptions } from './account';
import { printAccount, defaults as accountDefaults } from './account';
import type { ERC7579Options } from './erc7579';
import { printERC7579, defaults as erc7579Defaults } from './erc7579';
import type { GovernorOptions } from './governor';
import {
printGovernor,
Expand Down Expand Up @@ -64,6 +66,7 @@ export type ERC1155 = WizardContractAPI<ERC1155Options> & AccessControlAPI<ERC11
export type Stablecoin = WizardContractAPI<StablecoinOptions> & AccessControlAPI<StablecoinOptions>;
export type RealWorldAsset = WizardContractAPI<StablecoinOptions> & AccessControlAPI<StablecoinOptions>;
export type Account = WizardContractAPI<AccountOptions>;
export type ERC7579 = WizardContractAPI<ERC7579Options>;
export type Governor = WizardContractAPI<GovernorOptions> & AccessControlAPI<GovernorOptions>;
export type Custom = WizardContractAPI<CustomOptions> & AccessControlAPI<CustomOptions>;

Expand Down Expand Up @@ -91,6 +94,10 @@ export const account: Account = {
print: printAccount,
defaults: accountDefaults,
};
export const erc7579: ERC7579 = {
print: printERC7579,
defaults: erc7579Defaults,
};
export const realWorldAsset: RealWorldAsset = {
print: printStablecoin,
defaults: stablecoinDefaults,
Expand Down
6 changes: 6 additions & 0 deletions packages/core/solidity/src/build-generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { buildGovernor } from './governor';
import type { Contract } from './contract';
import { buildAccount } from './account';
import type { AccountOptions } from './account';
import { buildERC7579 } from './erc7579';
import type { ERC7579Options } from './erc7579';

export interface KindedOptions {
ERC20: { kind: 'ERC20' } & ERC20Options;
Expand All @@ -21,6 +23,7 @@ export interface KindedOptions {
Stablecoin: { kind: 'Stablecoin' } & StablecoinOptions;
RealWorldAsset: { kind: 'RealWorldAsset' } & StablecoinOptions;
Account: { kind: 'Account' } & AccountOptions;
ERC7579: { kind: 'ERC7579' } & ERC7579Options;
Governor: { kind: 'Governor' } & GovernorOptions;
Custom: { kind: 'Custom' } & CustomOptions;
}
Expand All @@ -47,6 +50,9 @@ export function buildGeneric(opts: GenericOptions): Contract {
case 'Account':
return buildAccount(opts);

case 'ERC7579':
return buildERC7579(opts);

case 'Governor':
return buildGovernor(opts);

Expand Down
Loading
Loading