create-fhevm-example 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,320 @@
1
+ # create-fhevm-example
2
+
3
+ Create FHEVM example projects with a single command.
4
+
5
+ ## Usage
6
+
7
+ ### Interactive Mode
8
+
9
+ ```bash
10
+ npx create-fhevm-example
11
+ ```
12
+
13
+ This will launch an interactive CLI that guides you through:
14
+
15
+ 1. Choosing between a single example or category project
16
+ 2. Selecting the specific example or category
17
+ 3. Setting the project name and output directory
18
+ 4. Optionally installing dependencies and running tests
19
+
20
+ ### Direct Mode
21
+
22
+ Create a single example:
23
+
24
+ ```bash
25
+ npx create-fhevm-example --example fhe-counter
26
+ ```
27
+
28
+ Create a category project:
29
+
30
+ ```bash
31
+ npx create-fhevm-example --category basic
32
+ ```
33
+
34
+ With custom output directory:
35
+
36
+ ```bash
37
+ npx create-fhevm-example --example fhe-counter --output ./my-project
38
+ ```
39
+
40
+ Auto-install dependencies and run tests:
41
+
42
+ ```bash
43
+ npx create-fhevm-example --example fhe-counter --install --test
44
+ ```
45
+
46
+ ## Available Examples
47
+
48
+ - `fhe-counter` - Confidential counter demonstration
49
+ - `encrypt-single-value` - FHE encryption mechanism
50
+ - `encrypt-multiple-values` - Multiple value encryption
51
+ - `user-decrypt-single-value` - User decryption mechanism
52
+ - `user-decrypt-multiple-values` - Multiple value decryption
53
+ - `public-decrypt-single-value` - Public decryption
54
+ - `public-decrypt-multiple-values` - Multiple public decryption
55
+ - `fhe-add` - Addition operations on encrypted values
56
+ - `fhe-if-then-else` - Conditional operations with FHE
57
+ - `fhe-arithmetic` - All arithmetic operations
58
+ - `fhe-comparison` - All comparison operations
59
+ - `fhe-access-control` - Access control patterns
60
+ - `fhe-input-proof` - Input proof validation
61
+ - `fhe-handles` - FHE handle lifecycle
62
+ - `fhe-anti-patterns` - Common mistakes and solutions
63
+ - `erc7984` - Confidential token standard
64
+ - `erc7984-erc20-wrapper` - ERC20 to ERC7984 wrapper
65
+ - `swap-erc7984-to-erc20` - Token swap example
66
+ - `swap-erc7984-to-erc7984` - Confidential token swap
67
+ - `vesting-wallet` - Token vesting example
68
+ - `blind-auction` - Encrypted blind auction
69
+ - `hidden-voting` - Encrypted voting system
70
+
71
+ ## Available Categories
72
+
73
+ - `basic` - Basic FHEVM Examples (9 contracts)
74
+ - `concepts` - Critical Concepts (4 contracts)
75
+ - `operations` - FHE Operations (4 contracts)
76
+ - `openzeppelin` - OpenZeppelin Confidential Contracts (5 contracts)
77
+ - `advanced` - Advanced Examples (2 contracts)
78
+
79
+ ## CLI Options
80
+
81
+ - `--example <name>` - Create a single example project
82
+ - `--category <name>` - Create a category project
83
+ - `--output <dir>` - Output directory (default: `./<project-name>`)
84
+ - `--install` - Auto-install dependencies
85
+ - `--test` - Auto-run tests (requires `--install`)
86
+ - `--help`, `-h` - Show help message
87
+
88
+ ## What Gets Created
89
+
90
+ Each generated project includes:
91
+
92
+ - ✅ Hardhat configuration for FHEVM
93
+ - ✅ Smart contracts from the selected example(s)
94
+ - ✅ Comprehensive test files
95
+ - ✅ Deployment scripts
96
+ - ✅ README with getting started instructions
97
+ - ✅ All necessary dependencies configured
98
+
99
+ ## Requirements
100
+
101
+ - Node.js >= 20
102
+ - Git (for cloning templates)
103
+
104
+ ## Configuration
105
+
106
+ ### Repository Settings
107
+
108
+ The CLI is configured to use a specific GitHub repository for templates and examples. You can customize this in [`src/config.ts`](./src/config.ts):
109
+
110
+ ```typescript
111
+ export const REPO_URL = "https://github.com/NecipAkgz/fhevm-example-factory";
112
+ export const REPO_BRANCH = "main";
113
+ export const TEMPLATE_SUBMODULE_PATH = "fhevm-hardhat-template";
114
+ ```
115
+
116
+ **Important**: If you fork this repository or want to use a different source:
117
+
118
+ 1. Update `REPO_URL` to your repository URL
119
+ 2. Ensure the repository has the same structure (contracts, test, fhevm-hardhat-template submodule)
120
+ 3. Rebuild the package: `npm run build`
121
+
122
+ ## Adding New Examples
123
+
124
+ To add a new example to the CLI:
125
+
126
+ ### 1. Add Example Configuration
127
+
128
+ Edit [`src/config.ts`](./src/config.ts) and add your example to the `EXAMPLES` object:
129
+
130
+ ```typescript
131
+ export const EXAMPLES: Record<string, ExampleConfig> = {
132
+ // ... existing examples
133
+ "my-new-example": {
134
+ contract: "contracts/path/to/MyContract.sol",
135
+ test: "test/path/to/MyContract.ts",
136
+ description: "Description of what this example demonstrates",
137
+ category: "Basic", // or "Concepts", "Operations", "OpenZeppelin", "Advanced"
138
+ title: "My New Example",
139
+ },
140
+ };
141
+ ```
142
+
143
+ ### 2. Add to Category (Optional)
144
+
145
+ If you want the example to appear in a category project, add it to the relevant category in `CATEGORIES`:
146
+
147
+ ```typescript
148
+ export const CATEGORIES: Record<string, CategoryConfig> = {
149
+ basic: {
150
+ name: "Basic FHEVM Examples",
151
+ description: "...",
152
+ contracts: [
153
+ // ... existing contracts
154
+ {
155
+ sol: "contracts/path/to/MyContract.sol",
156
+ test: "test/path/to/MyContract.ts",
157
+ },
158
+ ],
159
+ },
160
+ };
161
+ ```
162
+
163
+ ### 3. Ensure Files Exist in Repository
164
+
165
+ Make sure the contract and test files exist in your repository at the specified paths:
166
+
167
+ - `contracts/path/to/MyContract.sol`
168
+ - `test/path/to/MyContract.ts`
169
+
170
+ ### 4. Rebuild and Test
171
+
172
+ ```bash
173
+ npm run build
174
+ create-fhevm-example --example my-new-example --output /tmp/test-my-example
175
+ ```
176
+
177
+ ## Development
178
+
179
+ ### Local Development Setup
180
+
181
+ ```bash
182
+ # Clone the repository
183
+ git clone https://github.com/NecipAkgz/fhevm-example-factory.git
184
+ cd fhevm-example-factory/packages/create-fhevm-example
185
+
186
+ # Install dependencies
187
+ npm install
188
+
189
+ # Build the package
190
+ npm run build
191
+
192
+ # Link for local testing
193
+ npm link
194
+
195
+ # Now you can use it globally
196
+ create-fhevm-example --help
197
+ ```
198
+
199
+ ### Making Changes
200
+
201
+ 1. **Edit source files** in `src/`
202
+ 2. **Rebuild**: `npm run build`
203
+ 3. **Test locally**: `create-fhevm-example --example fhe-counter --output /tmp/test`
204
+
205
+ ### File Structure
206
+
207
+ ```
208
+ src/
209
+ ├── index.ts # Main CLI entry point (interactive + direct modes)
210
+ ├── config.ts # Examples and categories configuration
211
+ └── utils.ts # Helper functions (GitHub download, file ops, README generation)
212
+ ```
213
+
214
+ ## Publishing to NPM
215
+
216
+ ### Pre-publish Checklist
217
+
218
+ - [ ] Update version in `package.json`
219
+ - [ ] Test locally with `npm link`
220
+ - [ ] Verify all examples work
221
+ - [ ] Update README if needed
222
+ - [ ] Commit all changes
223
+
224
+ ### Publish Steps
225
+
226
+ ```bash
227
+ # Dry run to see what will be published
228
+ npm publish --dry-run
229
+
230
+ # Check package contents
231
+ npm pack
232
+ tar -xvzf create-fhevm-example-*.tgz
233
+ rm -rf package create-fhevm-example-*.tgz
234
+
235
+ # Publish to NPM
236
+ npm publish
237
+ ```
238
+
239
+ ### Post-publish Verification
240
+
241
+ ```bash
242
+ # Test from NPM in a clean directory
243
+ cd /tmp
244
+ npx create-fhevm-example@latest --example fhe-counter
245
+ ```
246
+
247
+ ## Troubleshooting
248
+
249
+ ### "Repository not found" Error
250
+
251
+ **Problem**: Git clone fails with repository not found.
252
+
253
+ **Solution**: Check `REPO_URL` in `src/config.ts`. Make sure:
254
+
255
+ - The repository exists and is public
256
+ - The URL is correct (without trailing slash)
257
+ - You have internet connection
258
+
259
+ ### "Failed to download" Error
260
+
261
+ **Problem**: File download from GitHub fails.
262
+
263
+ **Solution**:
264
+
265
+ - Verify the file paths in `config.ts` match actual files in the repository
266
+ - Check that `REPO_BRANCH` is correct (usually "main" or "master")
267
+ - Ensure the repository is public or you have access
268
+
269
+ ### Build Errors
270
+
271
+ **Problem**: TypeScript compilation fails.
272
+
273
+ **Solution**:
274
+
275
+ ```bash
276
+ # Clean and rebuild
277
+ rm -rf dist
278
+ npm run build
279
+ ```
280
+
281
+ ### Examples Not Showing Up
282
+
283
+ **Problem**: New example doesn't appear in the CLI.
284
+
285
+ **Solution**:
286
+
287
+ - Make sure you added it to `EXAMPLES` in `config.ts`
288
+ - Rebuild: `npm run build`
289
+ - If using `npm link`, unlink and relink:
290
+ ```bash
291
+ npm unlink -g create-fhevm-example
292
+ npm link
293
+ ```
294
+
295
+ ## Maintenance
296
+
297
+ ### Updating Template Repository
298
+
299
+ When the `fhevm-hardhat-template` submodule is updated:
300
+
301
+ 1. No changes needed in this package - it clones fresh each time
302
+ 2. Users will automatically get the latest template
303
+
304
+ ### Syncing Examples
305
+
306
+ When new examples are added to the main repository:
307
+
308
+ 1. Update `src/config.ts` with new example definitions
309
+ 2. Increment version in `package.json`
310
+ 3. Rebuild and publish: `npm run build && npm publish`
311
+
312
+ ## Learn More
313
+
314
+ - [FHEVM Documentation](https://docs.zama.ai/fhevm)
315
+ - [Example Repository](https://github.com/NecipAkgz/fhevm-example-factory)
316
+ - [Zama](https://www.zama.ai/)
317
+
318
+ ## License
319
+
320
+ BSD-3-Clause-Clear
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Shared configuration for FHEVM examples
3
+ *
4
+ * This configuration is used by the CLI to provide available examples and categories
5
+ */
6
+ export interface ExampleConfig {
7
+ /** Path to the Solidity contract file */
8
+ contract: string;
9
+ /** Path to the TypeScript test file */
10
+ test: string;
11
+ /** Full description for documentation */
12
+ description: string;
13
+ /** Category for grouping */
14
+ category: string;
15
+ /** Title for documentation */
16
+ title: string;
17
+ }
18
+ export interface CategoryConfig {
19
+ /** Display name */
20
+ name: string;
21
+ /** Description of the category */
22
+ description: string;
23
+ /** List of contracts in this category */
24
+ contracts: Array<{
25
+ sol: string;
26
+ test?: string;
27
+ }>;
28
+ }
29
+ export declare const REPO_URL = "https://github.com/NecipAkgz/fhevm-example-factory";
30
+ export declare const REPO_BRANCH = "main";
31
+ export declare const TEMPLATE_SUBMODULE_PATH = "fhevm-hardhat-template";
32
+ export declare const EXAMPLES: Record<string, ExampleConfig>;
33
+ export declare const CATEGORIES: Record<string, CategoryConfig>;
34
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,SAAS,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAMD,eAAO,MAAM,QAAQ,uDAAuD,CAAC;AAC7E,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAMhE,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAiLlD,CAAC;AAMF,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAkIrD,CAAC"}
package/dist/config.js ADDED
@@ -0,0 +1,302 @@
1
+ /**
2
+ * Shared configuration for FHEVM examples
3
+ *
4
+ * This configuration is used by the CLI to provide available examples and categories
5
+ */
6
+ // =============================================================================
7
+ // GitHub Repository Configuration
8
+ // =============================================================================
9
+ export const REPO_URL = "https://github.com/NecipAkgz/fhevm-example-factory";
10
+ export const REPO_BRANCH = "main";
11
+ export const TEMPLATE_SUBMODULE_PATH = "fhevm-hardhat-template";
12
+ // =============================================================================
13
+ // Example Configurations
14
+ // =============================================================================
15
+ export const EXAMPLES = {
16
+ "fhe-counter": {
17
+ contract: "contracts/basic/FHECounter.sol",
18
+ test: "test/basic/FHECounter.ts",
19
+ description: "This example demonstrates how to build a confidential counter using FHEVM, in comparison to a simple counter.",
20
+ category: "Basic",
21
+ title: "FHE Counter",
22
+ },
23
+ "encrypt-single-value": {
24
+ contract: "contracts/basic/encrypt/EncryptSingleValue.sol",
25
+ test: "test/basic/encrypt/EncryptSingleValue.ts",
26
+ description: "This example demonstrates the FHE encryption mechanism and highlights a common pitfall developers may encounter.",
27
+ category: "Basic - Encryption",
28
+ title: "Encrypt Single Value",
29
+ },
30
+ "encrypt-multiple-values": {
31
+ contract: "contracts/basic/encrypt/EncryptMultipleValues.sol",
32
+ test: "test/basic/encrypt/EncryptMultipleValues.ts",
33
+ description: "This example shows how to encrypt and handle multiple values in a single transaction.",
34
+ category: "Basic - Encryption",
35
+ title: "Encrypt Multiple Values",
36
+ },
37
+ "user-decrypt-single-value": {
38
+ contract: "contracts/basic/decrypt/UserDecryptSingleValue.sol",
39
+ test: "test/basic/decrypt/UserDecryptSingleValue.ts",
40
+ description: "This example demonstrates the FHE user decryption mechanism and highlights common pitfalls developers may encounter.",
41
+ category: "Basic - Decryption",
42
+ title: "User Decrypt Single Value",
43
+ },
44
+ "user-decrypt-multiple-values": {
45
+ contract: "contracts/basic/decrypt/UserDecryptMultipleValues.sol",
46
+ test: "test/basic/decrypt/UserDecryptMultipleValues.ts",
47
+ description: "This example shows how to decrypt multiple encrypted values for a user.",
48
+ category: "Basic - Decryption",
49
+ title: "User Decrypt Multiple Values",
50
+ },
51
+ "public-decrypt-single-value": {
52
+ contract: "contracts/basic/decrypt/PublicDecryptSingleValue.sol",
53
+ test: "test/basic/decrypt/PublicDecryptSingleValue.ts",
54
+ description: "This example demonstrates how to publicly decrypt a single encrypted value on-chain.",
55
+ category: "Basic - Decryption",
56
+ title: "Public Decrypt Single Value",
57
+ },
58
+ "public-decrypt-multiple-values": {
59
+ contract: "contracts/basic/decrypt/PublicDecryptMultipleValues.sol",
60
+ test: "test/basic/decrypt/PublicDecryptMultipleValues.ts",
61
+ description: "This example shows how to publicly decrypt multiple encrypted values in a single transaction.",
62
+ category: "Basic - Decryption",
63
+ title: "Public Decrypt Multiple Values",
64
+ },
65
+ "fhe-add": {
66
+ contract: "contracts/basic/fhe-operations/FHEAdd.sol",
67
+ test: "test/basic/fhe-operations/FHEAdd.ts",
68
+ description: "This example demonstrates how to perform addition operations on encrypted values.",
69
+ category: "FHE Operations",
70
+ title: "FHE Add Operation",
71
+ },
72
+ "fhe-if-then-else": {
73
+ contract: "contracts/basic/fhe-operations/FHEIfThenElse.sol",
74
+ test: "test/basic/fhe-operations/FHEIfThenElse.ts",
75
+ description: "This example shows conditional operations on encrypted values using FHE.",
76
+ category: "FHE Operations",
77
+ title: "FHE If-Then-Else",
78
+ },
79
+ "fhe-arithmetic": {
80
+ contract: "contracts/basic/fhe-operations/FHEArithmetic.sol",
81
+ test: "test/basic/fhe-operations/FHEArithmetic.ts",
82
+ description: "Comprehensive example demonstrating all FHE arithmetic operations: add, sub, mul, div, rem, min, max.",
83
+ category: "FHE Operations",
84
+ title: "FHE Arithmetic Operations",
85
+ },
86
+ "fhe-comparison": {
87
+ contract: "contracts/basic/fhe-operations/FHEComparison.sol",
88
+ test: "test/basic/fhe-operations/FHEComparison.ts",
89
+ description: "Demonstrates all FHE comparison operations: eq, ne, gt, lt, ge, le, and the select function for encrypted conditionals.",
90
+ category: "FHE Operations",
91
+ title: "FHE Comparison Operations",
92
+ },
93
+ "fhe-access-control": {
94
+ contract: "contracts/concepts/FHEAccessControl.sol",
95
+ test: "test/concepts/FHEAccessControl.ts",
96
+ description: "Critical access control patterns in FHEVM: FHE.allow, FHE.allowThis, FHE.allowTransient. Includes common mistakes and correct implementations.",
97
+ category: "Concepts",
98
+ title: "FHE Access Control",
99
+ },
100
+ "fhe-input-proof": {
101
+ contract: "contracts/concepts/FHEInputProof.sol",
102
+ test: "test/concepts/FHEInputProof.ts",
103
+ description: "Explains input proof validation in FHEVM: what proofs are, why they are needed, and how to use them correctly with single and batched inputs.",
104
+ category: "Concepts",
105
+ title: "FHE Input Proofs",
106
+ },
107
+ "fhe-handles": {
108
+ contract: "contracts/concepts/FHEHandles.sol",
109
+ test: "test/concepts/FHEHandles.ts",
110
+ description: "Understanding FHE handles: creation, computation, immutability, and symbolic execution in mock mode.",
111
+ category: "Concepts",
112
+ title: "FHE Handles & Lifecycle",
113
+ },
114
+ "fhe-anti-patterns": {
115
+ contract: "contracts/concepts/FHEAntiPatterns.sol",
116
+ test: "test/concepts/FHEAntiPatterns.ts",
117
+ description: "Common FHE mistakes and their correct alternatives. Covers: branching, permissions, require/revert, re-encryption, loops, noise, and deprecated APIs.",
118
+ category: "Concepts",
119
+ title: "FHE Anti-Patterns",
120
+ },
121
+ erc7984: {
122
+ contract: "contracts/openzeppelin/ERC7984.sol",
123
+ test: "test/openzeppelin/ERC7984.ts",
124
+ description: "This example demonstrates how to create a confidential token (ERC7984) using OpenZeppelin's smart contract library powered by ZAMA's FHEVM.",
125
+ category: "OpenZeppelin",
126
+ title: "ERC7984 Tutorial",
127
+ },
128
+ "erc7984-erc20-wrapper": {
129
+ contract: "contracts/openzeppelin/ERC7984ERC20Wrapper.sol",
130
+ test: "test/openzeppelin/ERC7984ERC20Wrapper.ts",
131
+ description: "This example demonstrates how to wrap a standard ERC20 token into a confidential ERC7984 token.",
132
+ category: "OpenZeppelin",
133
+ title: "ERC7984 to ERC20 Wrapper",
134
+ },
135
+ "swap-erc7984-to-erc20": {
136
+ contract: "contracts/openzeppelin/SwapERC7984ToERC20.sol",
137
+ test: "test/openzeppelin/SwapERC7984ToERC20.ts",
138
+ description: "This example demonstrates how to swap between a confidential token (ERC7984) and ERC20 tokens.",
139
+ category: "OpenZeppelin",
140
+ title: "Swap ERC7984 to ERC20",
141
+ },
142
+ "swap-erc7984-to-erc7984": {
143
+ contract: "contracts/openzeppelin/SwapERC7984ToERC7984.sol",
144
+ test: "test/openzeppelin/SwapERC7984ToERC7984.ts",
145
+ description: "This example demonstrates how to perform a fully confidential atomic swap between two ERC7984 tokens.",
146
+ category: "OpenZeppelin",
147
+ title: "Swap ERC7984 to ERC7984",
148
+ },
149
+ "vesting-wallet": {
150
+ contract: "contracts/openzeppelin/VestingWallet.sol",
151
+ test: "test/openzeppelin/VestingWallet.ts",
152
+ description: "This example demonstrates how to create a linear vesting wallet for ERC7984 tokens.",
153
+ category: "OpenZeppelin",
154
+ title: "Vesting Wallet",
155
+ },
156
+ "blind-auction": {
157
+ contract: "contracts/advanced/BlindAuction.sol",
158
+ test: "test/advanced/BlindAuction.ts",
159
+ description: "Encrypted blind auction where bids remain confidential. Uses FHE.gt() and FHE.select() to find the winner without revealing losing bids.",
160
+ category: "Advanced",
161
+ title: "Blind Auction",
162
+ },
163
+ "hidden-voting": {
164
+ contract: "contracts/advanced/HiddenVoting.sol",
165
+ test: "test/advanced/HiddenVoting.ts",
166
+ description: "Encrypted voting mechanism with homomorphic tallying. Individual votes remain private forever while final counts are revealed.",
167
+ category: "Advanced",
168
+ title: "Hidden Voting",
169
+ },
170
+ };
171
+ // =============================================================================
172
+ // Category Configurations
173
+ // =============================================================================
174
+ export const CATEGORIES = {
175
+ basic: {
176
+ name: "Basic FHEVM Examples",
177
+ description: "Fundamental FHEVM operations including encryption, decryption, and basic FHE operations",
178
+ contracts: [
179
+ {
180
+ sol: "contracts/basic/FHECounter.sol",
181
+ test: "test/basic/FHECounter.ts",
182
+ },
183
+ {
184
+ sol: "contracts/basic/encrypt/EncryptSingleValue.sol",
185
+ test: "test/basic/encrypt/EncryptSingleValue.ts",
186
+ },
187
+ {
188
+ sol: "contracts/basic/encrypt/EncryptMultipleValues.sol",
189
+ test: "test/basic/encrypt/EncryptMultipleValues.ts",
190
+ },
191
+ {
192
+ sol: "contracts/basic/decrypt/UserDecryptSingleValue.sol",
193
+ test: "test/basic/decrypt/UserDecryptSingleValue.ts",
194
+ },
195
+ {
196
+ sol: "contracts/basic/decrypt/UserDecryptMultipleValues.sol",
197
+ test: "test/basic/decrypt/UserDecryptMultipleValues.ts",
198
+ },
199
+ {
200
+ sol: "contracts/basic/decrypt/PublicDecryptSingleValue.sol",
201
+ test: "test/basic/decrypt/PublicDecryptSingleValue.ts",
202
+ },
203
+ {
204
+ sol: "contracts/basic/decrypt/PublicDecryptMultipleValues.sol",
205
+ test: "test/basic/decrypt/PublicDecryptMultipleValues.ts",
206
+ },
207
+ {
208
+ sol: "contracts/basic/fhe-operations/FHEAdd.sol",
209
+ test: "test/basic/fhe-operations/FHEAdd.ts",
210
+ },
211
+ {
212
+ sol: "contracts/basic/fhe-operations/FHEIfThenElse.sol",
213
+ test: "test/basic/fhe-operations/FHEIfThenElse.ts",
214
+ },
215
+ ],
216
+ },
217
+ concepts: {
218
+ name: "Critical Concepts",
219
+ description: "Access control, input proofs, handles, and anti-patterns",
220
+ contracts: [
221
+ {
222
+ sol: "contracts/concepts/FHEAccessControl.sol",
223
+ test: "test/concepts/FHEAccessControl.ts",
224
+ },
225
+ {
226
+ sol: "contracts/concepts/FHEInputProof.sol",
227
+ test: "test/concepts/FHEInputProof.ts",
228
+ },
229
+ {
230
+ sol: "contracts/concepts/FHEHandles.sol",
231
+ test: "test/concepts/FHEHandles.ts",
232
+ },
233
+ {
234
+ sol: "contracts/concepts/FHEAntiPatterns.sol",
235
+ test: "test/concepts/FHEAntiPatterns.ts",
236
+ },
237
+ ],
238
+ },
239
+ operations: {
240
+ name: "FHE Operations",
241
+ description: "Arithmetic, comparison, and conditional operations",
242
+ contracts: [
243
+ {
244
+ sol: "contracts/basic/fhe-operations/FHEAdd.sol",
245
+ test: "test/basic/fhe-operations/FHEAdd.ts",
246
+ },
247
+ {
248
+ sol: "contracts/basic/fhe-operations/FHEArithmetic.sol",
249
+ test: "test/basic/fhe-operations/FHEArithmetic.ts",
250
+ },
251
+ {
252
+ sol: "contracts/basic/fhe-operations/FHEComparison.sol",
253
+ test: "test/basic/fhe-operations/FHEComparison.ts",
254
+ },
255
+ {
256
+ sol: "contracts/basic/fhe-operations/FHEIfThenElse.sol",
257
+ test: "test/basic/fhe-operations/FHEIfThenElse.ts",
258
+ },
259
+ ],
260
+ },
261
+ openzeppelin: {
262
+ name: "OpenZeppelin Confidential Contracts",
263
+ description: "ERC7984 confidential token standard, wrappers, swaps, and vesting",
264
+ contracts: [
265
+ {
266
+ sol: "contracts/openzeppelin/ERC7984.sol",
267
+ test: "test/openzeppelin/ERC7984.ts",
268
+ },
269
+ {
270
+ sol: "contracts/openzeppelin/ERC7984ERC20Wrapper.sol",
271
+ test: "test/openzeppelin/ERC7984ERC20Wrapper.ts",
272
+ },
273
+ {
274
+ sol: "contracts/openzeppelin/SwapERC7984ToERC20.sol",
275
+ test: "test/openzeppelin/SwapERC7984ToERC20.ts",
276
+ },
277
+ {
278
+ sol: "contracts/openzeppelin/SwapERC7984ToERC7984.sol",
279
+ test: "test/openzeppelin/SwapERC7984ToERC7984.ts",
280
+ },
281
+ {
282
+ sol: "contracts/openzeppelin/VestingWallet.sol",
283
+ test: "test/openzeppelin/VestingWallet.ts",
284
+ },
285
+ ],
286
+ },
287
+ advanced: {
288
+ name: "Advanced Examples",
289
+ description: "Complex FHE applications: blind auctions, encrypted voting systems",
290
+ contracts: [
291
+ {
292
+ sol: "contracts/advanced/BlindAuction.sol",
293
+ test: "test/advanced/BlindAuction.ts",
294
+ },
295
+ {
296
+ sol: "contracts/advanced/HiddenVoting.sol",
297
+ test: "test/advanced/HiddenVoting.ts",
298
+ },
299
+ ],
300
+ },
301
+ };
302
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA4BH,gFAAgF;AAChF,kCAAkC;AAClC,gFAAgF;AAEhF,MAAM,CAAC,MAAM,QAAQ,GAAG,oDAAoD,CAAC;AAC7E,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,C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AC5C;YACD;gBACE,GAAG,EAAE,kDAAkD;gBACvD,IAAI,EAAE,4CAA4C;aACnD;YACD;gBACE,GAAG,EAAE,kDAAkD;gBACvD,IAAI,EAAE,4CAA4C;aACnD;YACD;gBACE,GAAG,EAAE,kDAAkD;gBACvD,IAAI,EAAE,4CAA4C;aACnD;SACF;KACF;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,qCAAqC;QAC3C,WAAW,EACT,mEAAmE;QACrE,SAAS,EAAE;YACT;gBACE,GAAG,EAAE,oCAAoC;gBACzC,IAAI,EAAE,8BAA8B;aACrC;YACD;gBACE,GAAG,EAAE,gDAAgD;gBACrD,IAAI,EAAE,0CAA0C;aACjD;YACD;gBACE,GAAG,EAAE,+CAA+C;gBACpD,IAAI,EAAE,yCAAyC;aAChD;YACD;gBACE,GAAG,EAAE,iDAAiD;gBACtD,IAAI,EAAE,2CAA2C;aAClD;YACD;gBACE,GAAG,EAAE,0CAA0C;gBAC/C,IAAI,EAAE,oCAAoC;aAC3C;SACF;KACF;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,oEAAoE;QACtE,SAAS,EAAE;YACT;gBACE,GAAG,EAAE,qCAAqC;gBAC1C,IAAI,EAAE,+BAA+B;aACtC;YACD;gBACE,GAAG,EAAE,qCAAqC;gBAC1C,IAAI,EAAE,+BAA+B;aACtC;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * create-fhevm-example - CLI for creating FHEVM example projects
4
+ *
5
+ * Usage:
6
+ * npx create-fhevm-example
7
+ * npx create-fhevm-example --example fhe-counter
8
+ * npx create-fhevm-example --category basic
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;GAOG"}