-
Notifications
You must be signed in to change notification settings - Fork 178
Add Confidential tab #652
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
ericglau
wants to merge
122
commits into
OpenZeppelin:master
Choose a base branch
from
ericglau:confidentialcontracts
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+13,284
−990
Open
Add Confidential tab #652
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 c97d363
Add zama icon and styles
ericglau d8df2f1
Rename
ericglau ca7410e
App switch
ericglau 47a9401
Renames, update readme
ericglau d16147f
colors, remove other tabs
ericglau bfdbb32
Remove unused
ericglau dbe9839
Remove unused
ericglau 0c3bc39
reduce
ericglau c423205
reduce, placeholder for wrappable
ericglau 2ad44e0
remove
ericglau b23f713
Delete unused parts
ericglau bc70870
Enable premint code
ericglau 1f31074
Use confidential votes
ericglau 46dae6c
rename, implement
ericglau fa05ec3
rename ui
ericglau 8d5d72b
Fix compile
ericglau 0bd7843
Implement wrappable
ericglau f0b17fb
rename
ericglau cca51b7
imports
ericglau 10e3eef
add uri field, update help links
ericglau c41dc8b
Add network config code
ericglau 6154658
Merge imports library comments from https://github.com/OpenZeppelin/c…
ericglau 72de62b
cleanup ui files
ericglau a270c00
Use solidity wizard imports WIP
ericglau 526ad09
working with solidity imports
ericglau 29c5e80
Fix print with versions
ericglau f34abc0
handle premint
ericglau 6ebe799
Simplify download single file text
ericglau 74835a6
Fix zip hardhat link
ericglau f40b4db
Fix hardhat compile and package
ericglau 04e6004
Update lock
ericglau 1be033c
Remove hh-toolbox, use hh-ethers
ericglau 83e6c69
Merge remote-tracking branch 'upstream/master' into confidentialcontr…
ericglau 437700b
Revert lock
ericglau 0db04f3
Fix zip hardhat compilation, update lockfile
ericglau 8116591
lint
ericglau b63a00c
Fix lint
ericglau 6b00e40
partial fix svelte check
ericglau 6c159c5
Add mcp
ericglau 55a2b1f
Fix svelte check and ai assistant
ericglau 75483ed
fix ai assistant
ericglau 515149e
Rename to confidential
ericglau 4e9b2ff
Change icon and order
ericglau 864312a
Change network config ui
ericglau 194c1e8
Add roles for handle viewer
ericglau 9f03a98
Fix remix tooltip
ericglau a10b78b
Combine imports from same file, cherry-picked from #661
ericglau 6cc8d38
Only import FHE when needed
ericglau 8c25ed2
Merge branch 'master' into confidentialcontracts
ericglau 3b77129
Remove redundant OZ prefixes in library comments
ericglau 036979e
Define version pins for fhevm/solidity and confidential-contracts
ericglau 8fce750
Inject hyperlinks
ericglau 7ca3d71
Pin versions for all dependencies in Remix
ericglau 5a7ea2b
Add placeholders and fix argument handling in Hardhat package
ericglau 3793838
Fix lint, remove unused params in zip-hardhat
ericglau af32c4a
Merge branch 'master' into confidentialcontracts
ericglau 3780d36
Fix handling of non-address args in zip-hardhat for solidity
ericglau b9e2f91
Update solidity snapshots
ericglau fd45626
Add prepare to rollup
ericglau b96057e
Fix imports for version pin
ericglau eb9ad7d
lint
ericglau 9cce68f
fix build
ericglau 3b9f71d
Batch export from solidity wizard
ericglau a5517bf
Combine import lines
ericglau 9fefa38
Fix lint
ericglau bed2d7b
Update snapshots
ericglau a181ab9
Extend confidential hardhat zip from solidity
ericglau 6297ba4
Extract test generator to class, simplify
ericglau 4ebebed
Fix compile
ericglau 4dac1b7
Merge branch 'master' into confidentialcontracts
ericglau edabe36
Add wizard core dependency
ericglau 40e8717
Update zip tests
ericglau 72e248d
Regen tests
ericglau fb8a0e7
Cleanup tests
ericglau e410b83
Update test name, snapshots
ericglau 214596e
Update tokenURI description
ericglau cc9f53b
Update tool
ericglau f0e7652
Add changeset
ericglau 2893312
Create MCP inclusion tests
ericglau 8b2bffe
Cleanup mcp tests
ericglau fee5bf5
Update mcp
ericglau b535608
Update prompt
ericglau a9514ab
Shorten MCP tool name
ericglau b594603
Update readme
ericglau 7aa5c6e
Remove unneeded
ericglau eb35f8c
Remove unneeded
ericglau 538585f
Update update script
ericglau 1c9ed12
Update zip lock
ericglau 41771f0
Clearly separate public and internal APIs in index
ericglau 5e05963
Remove todo
ericglau dfbce68
Remove unused devdeps
ericglau ea922ac
Set workspace order
ericglau 1b17a44
Add 'confidential' package to test workflow
ericglau ea9fe78
Add confidential package dep to mcp
ericglau e8e87eb
Add jszip to import map
ericglau 5ee94ca
Remove type
ericglau 8f9d331
Restore import, add wizard to import map
ericglau 5a80fe2
Revert import map changes
ericglau 5f4ad78
Move generic options
ericglau fef8576
Add jszip and Wizard packages to import map, since there are now inte…
ericglau 9375fc2
Revert "Move generic options"
ericglau 244c005
Merge info defaults
ericglau 2f1b4d3
Merge additionalCompatibleLibraries
ericglau 5b2f127
Use npm ci for tests
ericglau c441eb5
Use array for unsafeAllow in hardhat
ericglau 3fcbe02
Split rollup startup commands
ericglau a9ae1fb
Extract premint calculation to common func
ericglau c353f80
Check premint fits in uint64
ericglau eb570cf
Test premint with uint64
ericglau 654d45f
Assume 6 decimals
ericglau 07ed06e
Add comment
ericglau 7d5f006
Merge remote-tracking branch 'upstream/master' into confidentialcontr…
ericglau c061fb4
lint
ericglau 53877d2
Update snapshots
ericglau 6b91439
Merge remote-tracking branch 'upstream/master' into confidentialcontr…
ericglau 56d894b
Use semver range for hardhat package json
ericglau b921f9b
Update snapshots
ericglau bf2fd94
Merge remote-tracking branch 'upstream/master' into confidentialcontr…
ericglau 86faff0
Simplify import map
ericglau 14f4879
Add remappings steps
ericglau 8bff85d
Update mcp readme
ericglau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ node_modules | |
.env | ||
.env.local | ||
.vscode/settings.json | ||
|
||
fhevmTemp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.', | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/cache | ||
/artifacts | ||
/contracts/generated | ||
/contract-version-pins.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Changelog | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/>. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# OpenZeppelin Contracts Wizard for Confidential Contracts | ||
|
||
[](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, | ||
}); | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./dist/print-versioned'); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './src/print-versioned'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ?? {}) }, | ||
}; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.