Skip to content
Open
Show file tree
Hide file tree
Changes from 118 commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
905154b
Add Zama from solidity
ericglau Aug 27, 2025
c97d363
Add zama icon and styles
ericglau Aug 27, 2025
d8df2f1
Rename
ericglau Aug 27, 2025
ca7410e
App switch
ericglau Aug 27, 2025
47a9401
Renames, update readme
ericglau Aug 27, 2025
d16147f
colors, remove other tabs
ericglau Aug 27, 2025
bfdbb32
Remove unused
ericglau Aug 27, 2025
dbe9839
Remove unused
ericglau Aug 27, 2025
0c3bc39
reduce
ericglau Aug 27, 2025
c423205
reduce, placeholder for wrappable
ericglau Aug 27, 2025
2ad44e0
remove
ericglau Aug 27, 2025
b23f713
Delete unused parts
ericglau Aug 27, 2025
bc70870
Enable premint code
ericglau Aug 27, 2025
1f31074
Use confidential votes
ericglau Aug 27, 2025
46dae6c
rename, implement
ericglau Aug 27, 2025
fa05ec3
rename ui
ericglau Aug 27, 2025
8d5d72b
Fix compile
ericglau Aug 27, 2025
0bd7843
Implement wrappable
ericglau Aug 27, 2025
f0b17fb
rename
ericglau Aug 27, 2025
cca51b7
imports
ericglau Aug 27, 2025
10e3eef
add uri field, update help links
ericglau Aug 27, 2025
c41dc8b
Add network config code
ericglau Aug 27, 2025
6154658
Merge imports library comments from https://github.com/OpenZeppelin/c…
ericglau Aug 27, 2025
72de62b
cleanup ui files
ericglau Aug 27, 2025
a270c00
Use solidity wizard imports WIP
ericglau Aug 28, 2025
526ad09
working with solidity imports
ericglau Aug 28, 2025
29c5e80
Fix print with versions
ericglau Aug 28, 2025
f34abc0
handle premint
ericglau Aug 28, 2025
6ebe799
Simplify download single file text
ericglau Aug 28, 2025
74835a6
Fix zip hardhat link
ericglau Aug 28, 2025
f40b4db
Fix hardhat compile and package
ericglau Aug 28, 2025
04e6004
Update lock
ericglau Aug 28, 2025
1be033c
Remove hh-toolbox, use hh-ethers
ericglau Aug 28, 2025
83e6c69
Merge remote-tracking branch 'upstream/master' into confidentialcontr…
ericglau Aug 28, 2025
437700b
Revert lock
ericglau Aug 28, 2025
0db04f3
Fix zip hardhat compilation, update lockfile
ericglau Aug 28, 2025
8116591
lint
ericglau Aug 28, 2025
b63a00c
Fix lint
ericglau Aug 28, 2025
6b00e40
partial fix svelte check
ericglau Aug 28, 2025
6c159c5
Add mcp
ericglau Aug 28, 2025
55a2b1f
Fix svelte check and ai assistant
ericglau Aug 28, 2025
75483ed
fix ai assistant
ericglau Aug 28, 2025
515149e
Rename to confidential
ericglau Sep 5, 2025
4e9b2ff
Change icon and order
ericglau Sep 5, 2025
864312a
Change network config ui
ericglau Sep 5, 2025
194c1e8
Add roles for handle viewer
ericglau Sep 5, 2025
9f03a98
Fix remix tooltip
ericglau Sep 5, 2025
a10b78b
Combine imports from same file, cherry-picked from #661
ericglau Sep 12, 2025
6cc8d38
Only import FHE when needed
ericglau Sep 12, 2025
8c25ed2
Merge branch 'master' into confidentialcontracts
ericglau Sep 12, 2025
3b77129
Remove redundant OZ prefixes in library comments
ericglau Sep 12, 2025
036979e
Define version pins for fhevm/solidity and confidential-contracts
ericglau Sep 12, 2025
8fce750
Inject hyperlinks
ericglau Sep 12, 2025
7ca3d71
Pin versions for all dependencies in Remix
ericglau Sep 12, 2025
5a7ea2b
Add placeholders and fix argument handling in Hardhat package
ericglau Sep 12, 2025
3793838
Fix lint, remove unused params in zip-hardhat
ericglau Sep 12, 2025
af32c4a
Merge branch 'master' into confidentialcontracts
ericglau Sep 12, 2025
3780d36
Fix handling of non-address args in zip-hardhat for solidity
ericglau Sep 12, 2025
b9e2f91
Update solidity snapshots
ericglau Sep 12, 2025
fd45626
Add prepare to rollup
ericglau Sep 12, 2025
b96057e
Fix imports for version pin
ericglau Sep 12, 2025
eb9ad7d
lint
ericglau Sep 12, 2025
9cce68f
fix build
ericglau Sep 12, 2025
3b9f71d
Batch export from solidity wizard
ericglau Sep 15, 2025
a5517bf
Combine import lines
ericglau Sep 15, 2025
9fefa38
Fix lint
ericglau Sep 16, 2025
bed2d7b
Update snapshots
ericglau Sep 16, 2025
a181ab9
Extend confidential hardhat zip from solidity
ericglau Sep 16, 2025
6297ba4
Extract test generator to class, simplify
ericglau Sep 17, 2025
4ebebed
Fix compile
ericglau Sep 17, 2025
4dac1b7
Merge branch 'master' into confidentialcontracts
ericglau Sep 17, 2025
edabe36
Add wizard core dependency
ericglau Sep 17, 2025
40e8717
Update zip tests
ericglau Sep 17, 2025
72e248d
Regen tests
ericglau Sep 17, 2025
fb8a0e7
Cleanup tests
ericglau Sep 17, 2025
e410b83
Update test name, snapshots
ericglau Sep 17, 2025
214596e
Update tokenURI description
ericglau Sep 17, 2025
cc9f53b
Update tool
ericglau Sep 17, 2025
f0e7652
Add changeset
ericglau Sep 17, 2025
2893312
Create MCP inclusion tests
ericglau Sep 17, 2025
8b2bffe
Cleanup mcp tests
ericglau Sep 17, 2025
fee5bf5
Update mcp
ericglau Sep 17, 2025
b535608
Update prompt
ericglau Sep 17, 2025
a9514ab
Shorten MCP tool name
ericglau Sep 17, 2025
b594603
Update readme
ericglau Sep 17, 2025
7aa5c6e
Remove unneeded
ericglau Sep 17, 2025
eb35f8c
Remove unneeded
ericglau Sep 17, 2025
538585f
Update update script
ericglau Sep 17, 2025
1c9ed12
Update zip lock
ericglau Sep 17, 2025
41771f0
Clearly separate public and internal APIs in index
ericglau Sep 17, 2025
5e05963
Remove todo
ericglau Sep 17, 2025
dfbce68
Remove unused devdeps
ericglau Sep 17, 2025
ea922ac
Set workspace order
ericglau Sep 17, 2025
1b17a44
Add 'confidential' package to test workflow
ericglau Sep 17, 2025
ea9fe78
Add confidential package dep to mcp
ericglau Sep 18, 2025
e8e87eb
Add jszip to import map
ericglau Sep 18, 2025
5ee94ca
Remove type
ericglau Sep 18, 2025
8f9d331
Restore import, add wizard to import map
ericglau Sep 18, 2025
5a80fe2
Revert import map changes
ericglau Sep 18, 2025
5f4ad78
Move generic options
ericglau Sep 18, 2025
fef8576
Add jszip and Wizard packages to import map, since there are now inte…
ericglau Sep 18, 2025
9375fc2
Revert "Move generic options"
ericglau Sep 18, 2025
244c005
Merge info defaults
ericglau Sep 18, 2025
2f1b4d3
Merge additionalCompatibleLibraries
ericglau Sep 18, 2025
5b2f127
Use npm ci for tests
ericglau Sep 18, 2025
c441eb5
Use array for unsafeAllow in hardhat
ericglau Sep 18, 2025
3fcbe02
Split rollup startup commands
ericglau Sep 18, 2025
a9ae1fb
Extract premint calculation to common func
ericglau Sep 18, 2025
c353f80
Check premint fits in uint64
ericglau Sep 18, 2025
eb570cf
Test premint with uint64
ericglau Sep 18, 2025
654d45f
Assume 6 decimals
ericglau Sep 18, 2025
07ed06e
Add comment
ericglau Sep 19, 2025
7d5f006
Merge remote-tracking branch 'upstream/master' into confidentialcontr…
ericglau Sep 19, 2025
c061fb4
lint
ericglau Sep 19, 2025
53877d2
Update snapshots
ericglau Sep 19, 2025
6b91439
Merge remote-tracking branch 'upstream/master' into confidentialcontr…
ericglau Sep 22, 2025
56d894b
Use semver range for hardhat package json
ericglau Sep 22, 2025
b921f9b
Update snapshots
ericglau Sep 22, 2025
bf2fd94
Merge remote-tracking branch 'upstream/master' into confidentialcontr…
ericglau Sep 30, 2025
86faff0
Simplify import map
ericglau Sep 30, 2025
14f4879
Add remappings steps
ericglau Oct 2, 2025
8bff85d
Update mcp readme
ericglau Oct 2, 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
8 changes: 8 additions & 0 deletions .changeset/floppy-berries-work.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@openzeppelin/wizard-confidential': minor
'@openzeppelin/wizard': patch
'@openzeppelin/contracts-mcp': patch
'@openzeppelin/wizard-common': patch
---

Add support for Confidential Contracts Wizard
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
package:
- solidity
- cairo
- confidential
- stellar
- stylus
# This variant config creates 2 branches of the matrix a default and a compile one to run the compile tests in their own job
Expand All @@ -59,6 +60,8 @@ jobs:
variant: compile
- package: cairo
variant: compile
- package: confidential
variant: compile
- package: stylus
variant: compile

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ node_modules
.env
.env.local
.vscode/settings.json

fhevmTemp
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"workspaces": {
"packages": [
"packages/common",
"packages/core/solidity",
"packages/core/*",
"packages/mcp",
"packages/ui"
Expand Down
16 changes: 16 additions & 0 deletions packages/common/src/ai/descriptions/confidential.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// IMPORTANT: This file must not have any imports since it is used in both Node and Deno environments,
// which have different requirements for file extensions in import statements.

export const confidentialPrompts = {
ConfidentialFungible:
'Make a confidential fungible token in Solidity according to the ERC-7984 standard, similar to ERC-20 but with confidentiality.',
};

export const confidentialConfidentialFungibleDescriptions = {
tokenURI: 'A URI related to the token.',
premint: 'The number of tokens to premint for the deployer.',
networkConfig: 'Specify the provider and network configuration to use for FHEVM contracts.',
wrappable: 'Whether to allow wrapping an ERC20 token into a confidential fungible token.',
votes:
'Whether to keep track of historical balances for voting in on-chain governance. Voting durations can be expressed as block numbers or timestamps.',
};
1 change: 1 addition & 0 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from './ai/descriptions/cairo';
export * from './ai/descriptions/solidity';
export * from './ai/descriptions/stellar';
export * from './ai/descriptions/stylus';
export * from './ai/descriptions/confidential';
4 changes: 4 additions & 0 deletions packages/core/confidential/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/cache
/artifacts
/contracts/generated
/contract-version-pins.json
2 changes: 2 additions & 0 deletions packages/core/confidential/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Changelog

661 changes: 661 additions & 0 deletions packages/core/confidential/LICENSE

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions packages/core/confidential/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
OpenZeppelin Contracts Wizard
Copyright (C) 2021-2025 Zeppelin Group Ltd

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
59 changes: 59 additions & 0 deletions packages/core/confidential/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# OpenZeppelin Contracts Wizard for Confidential Contracts

[![NPM Package](https://img.shields.io/npm/v/@openzeppelin/wizard-confidential?color=%234e5de4)](https://www.npmjs.com/package/@openzeppelin/wizard-confidential)

Interactively build a contract out of components from OpenZeppelin Confidential Contracts. Provide parameters and desired features for the kind of contract that you want, and the Wizard will generate all of the code necessary. The resulting code is ready to be compiled and deployed, or it can serve as a starting point and customized further with application specific logic.

This package provides a programmatic API. For a web interface, see https://wizard.openzeppelin.com

### Installation

`npm install @openzeppelin/wizard-confidential`

### Contract types

The following contract types are supported:
- `confidentialFungible`

Each contract type has functions/constants as defined below.

### Functions

#### `print`
```js
function print(opts?: ConfidentialFungibleOptions): string
```

Returns a string representation of a contract generated using the provided options. If `opts` is not provided, uses [`defaults`](#defaults).

#### `defaults`
```js
const defaults: Required<ConfidentialFungibleOptions>
```

The default options that are used for [`print`](#print).

### Examples

Import the contract type(s) that you want to use from the `@openzeppelin/wizard-confidential` package:

```js
import { confidentialFungible } from '@openzeppelin/wizard-confidential';
```

To generate the source code for a confidential fungible contract with all of the default settings:
```js
const contract = confidentialFungible.print();
```

To generate the source code for a confidential fungible contract with a custom name, symbol, URI, and network configuration, along with some custom settings:
```js
const contract = confidentialFungible.print({
name: 'ExampleToken',
symbol: 'ETK',
tokenURI: 'https://example.com',
networkConfig: 'zama-sepolia',
premint: '1000000',
wrappable: true,
});
```
9 changes: 9 additions & 0 deletions packages/core/confidential/ava.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
extensions: ['ts'],
require: ['ts-node/register'],
watchmode: {
ignoreChanges: ['contracts', 'artifacts', 'cache'],
},
timeout: '10m',
workerThreads: false,
};
8 changes: 8 additions & 0 deletions packages/core/confidential/contract-version-pins.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface ContractVersionPins {
fhevmSolidityVersion: string;
confidentialContractsVersion: string;
}

declare const contractVersionPins: ContractVersionPins;

export default contractVersionPins;
19 changes: 19 additions & 0 deletions packages/core/confidential/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const SOLIDITY_VERSION = require('@openzeppelin/wizard/src/solidity-version.json');

require('@fhevm/hardhat-plugin');

/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: {
version: SOLIDITY_VERSION,
settings: {
evmVersion: 'cancun',
optimizer: {
enabled: true,
runs: 200,
},
},
},
};
46 changes: 46 additions & 0 deletions packages/core/confidential/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "@openzeppelin/wizard-confidential",
"version": "0.0.1-alpha.0",
"description": "A boilerplate generator to get started with OpenZeppelin Confidential Contracts",
"license": "AGPL-3.0-only",
"repository": "https://github.com/OpenZeppelin/contracts-wizard",
"main": "dist/index.js",
"ts:main": "src/index.ts",
"files": [
"LICENSE",
"NOTICE",
"/dist",
"/src",
"!**/*.test.*"
],
"scripts": {
"prepare": "tsc && node dist/scripts/prepare.js",
"prepublish": "rimraf dist *.tsbuildinfo && hardhat clean",
"test": "ava",
"test:update-snapshots": "ava --update-snapshots",
"test:watch": "ava --watch",
"update-env": "rm ./src/environments/hardhat/package-lock.json && npm install --package-lock-only --prefix ./src/environments/hardhat"
},
"dependencies": {
"@openzeppelin/wizard": "^0.8.0"
},
"devDependencies": {
"@fhevm/core-contracts": "0.7.0-12",
"@fhevm/hardhat-plugin": "0.0.1-6",
"@fhevm/mock-utils": "^0.0.1-6",
"@fhevm/solidity": "0.7.0",
"@nomicfoundation/hardhat-ethers": "^3.1.0",
"@openzeppelin/confidential-contracts": "^0.2.0",
"@openzeppelin/contracts": "^5.4.0",
"@types/node": "^20.0.0",
"@types/semver": "^7.5.7",
"@zama-fhe/oracle-solidity": "^0.1.0",
"@zama-fhe/relayer-sdk": "^0.1.0-5",
"ava": "^6.0.0",
"hardhat": "^2.22.11",
"jszip": "^3.6.0",
"rimraf": "^5.0.0",
"semver": "^7.6.0",
"ts-node": "^10.4.0"
}
}
1 change: 1 addition & 0 deletions packages/core/confidential/print-versioned.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./dist/print-versioned');
1 change: 1 addition & 0 deletions packages/core/confidential/print-versioned.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './src/print-versioned';
22 changes: 22 additions & 0 deletions packages/core/confidential/src/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { CommonOptions } from './common-options';
import type { ConfidentialFungibleOptions } from './confidentialFungible';
import { printConfidentialFungible, defaults as confidentialFungibleDefaults } from './confidentialFungible';

export interface WizardContractAPI<Options extends CommonOptions> {
/**
* Returns a string representation of a contract generated using the provided options. If opts is not provided, uses `defaults`.
*/
print: (opts?: Options) => string;

/**
* The default options that are used for `print`.
*/
defaults: Required<Options>;
}

export type ConfidentialFungible = WizardContractAPI<ConfidentialFungibleOptions>;

export const confidentialFungible: ConfidentialFungible = {
print: printConfidentialFungible,
defaults: confidentialFungibleDefaults,
};
23 changes: 23 additions & 0 deletions packages/core/confidential/src/build-generic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { ConfidentialFungibleOptions } from './confidentialFungible';
import { buildConfidentialFungible } from './confidentialFungible';
import type { Contract } from '@openzeppelin/wizard';

export interface KindedOptions {
ConfidentialFungible: { kind: 'ConfidentialFungible' } & ConfidentialFungibleOptions;
}

export type GenericOptions = KindedOptions[keyof KindedOptions];

export function buildGeneric(opts: GenericOptions): Contract {
switch (opts.kind) {
case 'ConfidentialFungible':
return buildConfidentialFungible(opts);

default: {
// TODO: When other contract kinds are available, change the below to:
// const _: never = opts;
const _: never = opts.kind;
throw new Error('Unknown contract kind');
}
}
}
16 changes: 16 additions & 0 deletions packages/core/confidential/src/common-options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Info } from '@openzeppelin/wizard';
import { infoDefaults } from '@openzeppelin/wizard';

export const defaults: Required<CommonOptions> = {
info: infoDefaults,
} as const;

export interface CommonOptions {
info?: Info;
}

export function withCommonDefaults(opts: CommonOptions): Required<CommonOptions> {
return {
info: { ...defaults.info, ...(opts.info ?? {}) },
};
}
Loading
Loading