@zentity/fhevm-contracts 0.1.0

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.
Files changed (83) hide show
  1. package/README.md +160 -0
  2. package/abi/ComplianceRules.json +352 -0
  3. package/abi/CompliantERC20.json +493 -0
  4. package/abi/IdentityRegistry.json +712 -0
  5. package/abi/index.d.ts +3 -0
  6. package/abi/index.js +9 -0
  7. package/contracts/ARCHITECTURE.md +66 -0
  8. package/contracts/ARCHITECTURE_EXPLAINER.md +77 -0
  9. package/contracts/compliance/ComplianceRules.sol +255 -0
  10. package/contracts/core/IdentityRegistry.sol +352 -0
  11. package/contracts/interfaces/IIdentityRegistry.sol +226 -0
  12. package/contracts/mocks/.gitkeep +0 -0
  13. package/contracts/tokens/CompliantERC20.sol +379 -0
  14. package/deployments/hardhat/addresses.json +20 -0
  15. package/deployments/localhost/.chainId +1 -0
  16. package/deployments/localhost/ComplianceRules.json +662 -0
  17. package/deployments/localhost/CompliantERC20.json +888 -0
  18. package/deployments/localhost/IdentityRegistry.json +1093 -0
  19. package/deployments/localhost/solcInputs/e36969353329df673b4fae03d39e01c4.json +60 -0
  20. package/deployments/sepolia/.chainId +1 -0
  21. package/deployments/sepolia/.gitkeep +0 -0
  22. package/deployments/sepolia/ComplianceRules.json +662 -0
  23. package/deployments/sepolia/CompliantERC20.json +888 -0
  24. package/deployments/sepolia/IdentityRegistry.json +1093 -0
  25. package/deployments/sepolia/solcInputs/93d280ff0d4e798a18947a9ed6015031.json +60 -0
  26. package/dist/index.d.ts +459 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +135 -0
  29. package/package.json +110 -0
  30. package/typechain-types/@fhevm/index.ts +5 -0
  31. package/typechain-types/@fhevm/solidity/config/ZamaConfig.sol/ZamaConfig.ts +69 -0
  32. package/typechain-types/@fhevm/solidity/config/ZamaConfig.sol/ZamaEthereumConfig.ts +90 -0
  33. package/typechain-types/@fhevm/solidity/config/ZamaConfig.sol/index.ts +5 -0
  34. package/typechain-types/@fhevm/solidity/config/index.ts +5 -0
  35. package/typechain-types/@fhevm/solidity/index.ts +7 -0
  36. package/typechain-types/@fhevm/solidity/lib/FHE.sol/FHE.ts +112 -0
  37. package/typechain-types/@fhevm/solidity/lib/FHE.sol/IKMSVerifier.ts +108 -0
  38. package/typechain-types/@fhevm/solidity/lib/FHE.sol/index.ts +5 -0
  39. package/typechain-types/@fhevm/solidity/lib/Impl.sol/IACL.ts +190 -0
  40. package/typechain-types/@fhevm/solidity/lib/Impl.sol/IFHEVMExecutor.ts +623 -0
  41. package/typechain-types/@fhevm/solidity/lib/Impl.sol/IInputVerifier.ts +90 -0
  42. package/typechain-types/@fhevm/solidity/lib/Impl.sol/index.ts +6 -0
  43. package/typechain-types/@fhevm/solidity/lib/index.ts +7 -0
  44. package/typechain-types/common.ts +131 -0
  45. package/typechain-types/contracts/compliance/ComplianceRules.ts +479 -0
  46. package/typechain-types/contracts/compliance/index.ts +4 -0
  47. package/typechain-types/contracts/core/IdentityRegistry.ts +874 -0
  48. package/typechain-types/contracts/core/index.ts +4 -0
  49. package/typechain-types/contracts/index.ts +11 -0
  50. package/typechain-types/contracts/interfaces/IIdentityRegistry.ts +798 -0
  51. package/typechain-types/contracts/interfaces/index.ts +4 -0
  52. package/typechain-types/contracts/tokens/CompliantERC20.sol/CompliantERC20.ts +572 -0
  53. package/typechain-types/contracts/tokens/CompliantERC20.sol/IComplianceChecker.ts +95 -0
  54. package/typechain-types/contracts/tokens/CompliantERC20.sol/index.ts +5 -0
  55. package/typechain-types/contracts/tokens/index.ts +5 -0
  56. package/typechain-types/factories/@fhevm/index.ts +4 -0
  57. package/typechain-types/factories/@fhevm/solidity/config/ZamaConfig.sol/ZamaConfig__factory.ts +69 -0
  58. package/typechain-types/factories/@fhevm/solidity/config/ZamaConfig.sol/ZamaEthereumConfig__factory.ts +43 -0
  59. package/typechain-types/factories/@fhevm/solidity/config/ZamaConfig.sol/index.ts +5 -0
  60. package/typechain-types/factories/@fhevm/solidity/config/index.ts +4 -0
  61. package/typechain-types/factories/@fhevm/solidity/index.ts +5 -0
  62. package/typechain-types/factories/@fhevm/solidity/lib/FHE.sol/FHE__factory.ts +88 -0
  63. package/typechain-types/factories/@fhevm/solidity/lib/FHE.sol/IKMSVerifier__factory.ts +54 -0
  64. package/typechain-types/factories/@fhevm/solidity/lib/FHE.sol/index.ts +5 -0
  65. package/typechain-types/factories/@fhevm/solidity/lib/Impl.sol/IACL__factory.ts +121 -0
  66. package/typechain-types/factories/@fhevm/solidity/lib/Impl.sol/IFHEVMExecutor__factory.ts +810 -0
  67. package/typechain-types/factories/@fhevm/solidity/lib/Impl.sol/IInputVerifier__factory.ts +32 -0
  68. package/typechain-types/factories/@fhevm/solidity/lib/Impl.sol/index.ts +6 -0
  69. package/typechain-types/factories/@fhevm/solidity/lib/index.ts +5 -0
  70. package/typechain-types/factories/contracts/compliance/ComplianceRules__factory.ts +437 -0
  71. package/typechain-types/factories/contracts/compliance/index.ts +4 -0
  72. package/typechain-types/factories/contracts/core/IdentityRegistry__factory.ts +777 -0
  73. package/typechain-types/factories/contracts/core/index.ts +4 -0
  74. package/typechain-types/factories/contracts/index.ts +7 -0
  75. package/typechain-types/factories/contracts/interfaces/IIdentityRegistry__factory.ts +640 -0
  76. package/typechain-types/factories/contracts/interfaces/index.ts +4 -0
  77. package/typechain-types/factories/contracts/tokens/CompliantERC20.sol/CompliantERC20__factory.ts +581 -0
  78. package/typechain-types/factories/contracts/tokens/CompliantERC20.sol/IComplianceChecker__factory.ts +44 -0
  79. package/typechain-types/factories/contracts/tokens/CompliantERC20.sol/index.ts +5 -0
  80. package/typechain-types/factories/contracts/tokens/index.ts +4 -0
  81. package/typechain-types/factories/index.ts +5 -0
  82. package/typechain-types/hardhat.d.ts +261 -0
  83. package/typechain-types/index.ts +32 -0
@@ -0,0 +1,459 @@
1
+ /**
2
+ * @zentity/fhevm-contracts
3
+ *
4
+ * fhEVM smart contracts for privacy-preserving identity attestations
5
+ */
6
+ export declare const CONTRACT_NAMES: readonly ["IdentityRegistry", "ComplianceRules", "CompliantERC20"];
7
+ export type ContractName = (typeof CONTRACT_NAMES)[number];
8
+ export type ContractAddresses = {
9
+ IdentityRegistry: string;
10
+ ComplianceRules: string;
11
+ CompliantERC20: string;
12
+ };
13
+ export type DeploymentManifest = {
14
+ network: string;
15
+ chainId: number;
16
+ deployedAt?: string;
17
+ deployer?: string;
18
+ contracts: Record<ContractName, {
19
+ address: string;
20
+ txHash?: string;
21
+ }>;
22
+ };
23
+ export declare const CHAIN_ID_BY_NETWORK: {
24
+ readonly hardhat: 31337;
25
+ readonly localhost: 31337;
26
+ readonly sepolia: 11155111;
27
+ };
28
+ export type NetworkName = keyof typeof CHAIN_ID_BY_NETWORK;
29
+ export type ChainId = (typeof CHAIN_ID_BY_NETWORK)[NetworkName];
30
+ export declare const DEPLOYMENTS: Partial<Record<NetworkName, DeploymentManifest>>;
31
+ export declare const ADDRESSES: {
32
+ readonly hardhat: {
33
+ readonly IdentityRegistry: string;
34
+ readonly ComplianceRules: string;
35
+ readonly CompliantERC20: string;
36
+ };
37
+ readonly localhost: {
38
+ readonly IdentityRegistry: string;
39
+ readonly ComplianceRules: string;
40
+ readonly CompliantERC20: string;
41
+ };
42
+ };
43
+ export declare const ABIS: {
44
+ readonly IdentityRegistry: ({
45
+ inputs: never[];
46
+ stateMutability: string;
47
+ type: string;
48
+ name?: undefined;
49
+ anonymous?: undefined;
50
+ outputs?: undefined;
51
+ } | {
52
+ inputs: never[];
53
+ name: string;
54
+ type: string;
55
+ stateMutability?: undefined;
56
+ anonymous?: undefined;
57
+ outputs?: undefined;
58
+ } | {
59
+ anonymous: boolean;
60
+ inputs: {
61
+ indexed: boolean;
62
+ internalType: string;
63
+ name: string;
64
+ type: string;
65
+ }[];
66
+ name: string;
67
+ type: string;
68
+ stateMutability?: undefined;
69
+ outputs?: undefined;
70
+ } | {
71
+ inputs: {
72
+ internalType: string;
73
+ name: string;
74
+ type: string;
75
+ }[];
76
+ name: string;
77
+ outputs: {
78
+ internalType: string;
79
+ name: string;
80
+ type: string;
81
+ }[];
82
+ stateMutability: string;
83
+ type: string;
84
+ anonymous?: undefined;
85
+ })[];
86
+ readonly ComplianceRules: ({
87
+ inputs: {
88
+ internalType: string;
89
+ name: string;
90
+ type: string;
91
+ }[];
92
+ stateMutability: string;
93
+ type: string;
94
+ name?: undefined;
95
+ anonymous?: undefined;
96
+ outputs?: undefined;
97
+ } | {
98
+ inputs: never[];
99
+ name: string;
100
+ type: string;
101
+ stateMutability?: undefined;
102
+ anonymous?: undefined;
103
+ outputs?: undefined;
104
+ } | {
105
+ anonymous: boolean;
106
+ inputs: {
107
+ indexed: boolean;
108
+ internalType: string;
109
+ name: string;
110
+ type: string;
111
+ }[];
112
+ name: string;
113
+ type: string;
114
+ stateMutability?: undefined;
115
+ outputs?: undefined;
116
+ } | {
117
+ inputs: {
118
+ internalType: string;
119
+ name: string;
120
+ type: string;
121
+ }[];
122
+ name: string;
123
+ outputs: {
124
+ internalType: string;
125
+ name: string;
126
+ type: string;
127
+ }[];
128
+ stateMutability: string;
129
+ type: string;
130
+ anonymous?: undefined;
131
+ })[];
132
+ readonly CompliantERC20: ({
133
+ inputs: {
134
+ internalType: string;
135
+ name: string;
136
+ type: string;
137
+ }[];
138
+ stateMutability: string;
139
+ type: string;
140
+ name?: undefined;
141
+ anonymous?: undefined;
142
+ outputs?: undefined;
143
+ } | {
144
+ inputs: never[];
145
+ name: string;
146
+ type: string;
147
+ stateMutability?: undefined;
148
+ anonymous?: undefined;
149
+ outputs?: undefined;
150
+ } | {
151
+ anonymous: boolean;
152
+ inputs: {
153
+ indexed: boolean;
154
+ internalType: string;
155
+ name: string;
156
+ type: string;
157
+ }[];
158
+ name: string;
159
+ type: string;
160
+ stateMutability?: undefined;
161
+ outputs?: undefined;
162
+ } | {
163
+ inputs: {
164
+ internalType: string;
165
+ name: string;
166
+ type: string;
167
+ }[];
168
+ name: string;
169
+ outputs: {
170
+ internalType: string;
171
+ name: string;
172
+ type: string;
173
+ }[];
174
+ stateMutability: string;
175
+ type: string;
176
+ anonymous?: undefined;
177
+ })[];
178
+ };
179
+ export type AbiMap = typeof ABIS;
180
+ export declare function getAbi(name: ContractName): ({
181
+ inputs: {
182
+ internalType: string;
183
+ name: string;
184
+ type: string;
185
+ }[];
186
+ stateMutability: string;
187
+ type: string;
188
+ name?: undefined;
189
+ anonymous?: undefined;
190
+ outputs?: undefined;
191
+ } | {
192
+ inputs: never[];
193
+ name: string;
194
+ type: string;
195
+ stateMutability?: undefined;
196
+ anonymous?: undefined;
197
+ outputs?: undefined;
198
+ } | {
199
+ anonymous: boolean;
200
+ inputs: {
201
+ indexed: boolean;
202
+ internalType: string;
203
+ name: string;
204
+ type: string;
205
+ }[];
206
+ name: string;
207
+ type: string;
208
+ stateMutability?: undefined;
209
+ outputs?: undefined;
210
+ } | {
211
+ inputs: {
212
+ internalType: string;
213
+ name: string;
214
+ type: string;
215
+ }[];
216
+ name: string;
217
+ outputs: {
218
+ internalType: string;
219
+ name: string;
220
+ type: string;
221
+ }[];
222
+ stateMutability: string;
223
+ type: string;
224
+ anonymous?: undefined;
225
+ })[] | ({
226
+ inputs: {
227
+ internalType: string;
228
+ name: string;
229
+ type: string;
230
+ }[];
231
+ stateMutability: string;
232
+ type: string;
233
+ name?: undefined;
234
+ anonymous?: undefined;
235
+ outputs?: undefined;
236
+ } | {
237
+ inputs: never[];
238
+ name: string;
239
+ type: string;
240
+ stateMutability?: undefined;
241
+ anonymous?: undefined;
242
+ outputs?: undefined;
243
+ } | {
244
+ anonymous: boolean;
245
+ inputs: {
246
+ indexed: boolean;
247
+ internalType: string;
248
+ name: string;
249
+ type: string;
250
+ }[];
251
+ name: string;
252
+ type: string;
253
+ stateMutability?: undefined;
254
+ outputs?: undefined;
255
+ } | {
256
+ inputs: {
257
+ internalType: string;
258
+ name: string;
259
+ type: string;
260
+ }[];
261
+ name: string;
262
+ outputs: {
263
+ internalType: string;
264
+ name: string;
265
+ type: string;
266
+ }[];
267
+ stateMutability: string;
268
+ type: string;
269
+ anonymous?: undefined;
270
+ })[] | ({
271
+ inputs: never[];
272
+ stateMutability: string;
273
+ type: string;
274
+ name?: undefined;
275
+ anonymous?: undefined;
276
+ outputs?: undefined;
277
+ } | {
278
+ inputs: never[];
279
+ name: string;
280
+ type: string;
281
+ stateMutability?: undefined;
282
+ anonymous?: undefined;
283
+ outputs?: undefined;
284
+ } | {
285
+ anonymous: boolean;
286
+ inputs: {
287
+ indexed: boolean;
288
+ internalType: string;
289
+ name: string;
290
+ type: string;
291
+ }[];
292
+ name: string;
293
+ type: string;
294
+ stateMutability?: undefined;
295
+ outputs?: undefined;
296
+ } | {
297
+ inputs: {
298
+ internalType: string;
299
+ name: string;
300
+ type: string;
301
+ }[];
302
+ name: string;
303
+ outputs: {
304
+ internalType: string;
305
+ name: string;
306
+ type: string;
307
+ }[];
308
+ stateMutability: string;
309
+ type: string;
310
+ anonymous?: undefined;
311
+ })[];
312
+ export declare const IdentityRegistryABI: ({
313
+ inputs: never[];
314
+ stateMutability: string;
315
+ type: string;
316
+ name?: undefined;
317
+ anonymous?: undefined;
318
+ outputs?: undefined;
319
+ } | {
320
+ inputs: never[];
321
+ name: string;
322
+ type: string;
323
+ stateMutability?: undefined;
324
+ anonymous?: undefined;
325
+ outputs?: undefined;
326
+ } | {
327
+ anonymous: boolean;
328
+ inputs: {
329
+ indexed: boolean;
330
+ internalType: string;
331
+ name: string;
332
+ type: string;
333
+ }[];
334
+ name: string;
335
+ type: string;
336
+ stateMutability?: undefined;
337
+ outputs?: undefined;
338
+ } | {
339
+ inputs: {
340
+ internalType: string;
341
+ name: string;
342
+ type: string;
343
+ }[];
344
+ name: string;
345
+ outputs: {
346
+ internalType: string;
347
+ name: string;
348
+ type: string;
349
+ }[];
350
+ stateMutability: string;
351
+ type: string;
352
+ anonymous?: undefined;
353
+ })[];
354
+ export declare const ComplianceRulesABI: ({
355
+ inputs: {
356
+ internalType: string;
357
+ name: string;
358
+ type: string;
359
+ }[];
360
+ stateMutability: string;
361
+ type: string;
362
+ name?: undefined;
363
+ anonymous?: undefined;
364
+ outputs?: undefined;
365
+ } | {
366
+ inputs: never[];
367
+ name: string;
368
+ type: string;
369
+ stateMutability?: undefined;
370
+ anonymous?: undefined;
371
+ outputs?: undefined;
372
+ } | {
373
+ anonymous: boolean;
374
+ inputs: {
375
+ indexed: boolean;
376
+ internalType: string;
377
+ name: string;
378
+ type: string;
379
+ }[];
380
+ name: string;
381
+ type: string;
382
+ stateMutability?: undefined;
383
+ outputs?: undefined;
384
+ } | {
385
+ inputs: {
386
+ internalType: string;
387
+ name: string;
388
+ type: string;
389
+ }[];
390
+ name: string;
391
+ outputs: {
392
+ internalType: string;
393
+ name: string;
394
+ type: string;
395
+ }[];
396
+ stateMutability: string;
397
+ type: string;
398
+ anonymous?: undefined;
399
+ })[];
400
+ export declare const CompliantERC20ABI: ({
401
+ inputs: {
402
+ internalType: string;
403
+ name: string;
404
+ type: string;
405
+ }[];
406
+ stateMutability: string;
407
+ type: string;
408
+ name?: undefined;
409
+ anonymous?: undefined;
410
+ outputs?: undefined;
411
+ } | {
412
+ inputs: never[];
413
+ name: string;
414
+ type: string;
415
+ stateMutability?: undefined;
416
+ anonymous?: undefined;
417
+ outputs?: undefined;
418
+ } | {
419
+ anonymous: boolean;
420
+ inputs: {
421
+ indexed: boolean;
422
+ internalType: string;
423
+ name: string;
424
+ type: string;
425
+ }[];
426
+ name: string;
427
+ type: string;
428
+ stateMutability?: undefined;
429
+ outputs?: undefined;
430
+ } | {
431
+ inputs: {
432
+ internalType: string;
433
+ name: string;
434
+ type: string;
435
+ }[];
436
+ name: string;
437
+ outputs: {
438
+ internalType: string;
439
+ name: string;
440
+ type: string;
441
+ }[];
442
+ stateMutability: string;
443
+ type: string;
444
+ anonymous?: undefined;
445
+ })[];
446
+ export declare function getDeployment(network: NetworkName): DeploymentManifest;
447
+ export declare function hasDeployment(network: NetworkName): boolean;
448
+ export declare function isNetworkName(value: string): value is NetworkName;
449
+ export declare function getNetworkNames(chainId: number): NetworkName[];
450
+ export declare function getNetworkName(chainId: number, prefer?: NetworkName): NetworkName;
451
+ export declare function getContractAddresses(networkOrChainId: NetworkName | number, options?: {
452
+ prefer?: NetworkName;
453
+ overrides?: Partial<ContractAddresses>;
454
+ }): ContractAddresses;
455
+ export declare function resolveContractAddresses(networkOrChainId: NetworkName | number, options?: {
456
+ prefer?: NetworkName;
457
+ overrides?: Partial<ContractAddresses>;
458
+ }): ContractAddresses;
459
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
package/dist/index.js ADDED
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ /**
3
+ * @zentity/fhevm-contracts
4
+ *
5
+ * fhEVM smart contracts for privacy-preserving identity attestations
6
+ */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.CompliantERC20ABI = exports.ComplianceRulesABI = exports.IdentityRegistryABI = exports.ABIS = exports.ADDRESSES = exports.DEPLOYMENTS = exports.CHAIN_ID_BY_NETWORK = exports.CONTRACT_NAMES = void 0;
12
+ exports.getAbi = getAbi;
13
+ exports.getDeployment = getDeployment;
14
+ exports.hasDeployment = hasDeployment;
15
+ exports.isNetworkName = isNetworkName;
16
+ exports.getNetworkNames = getNetworkNames;
17
+ exports.getNetworkName = getNetworkName;
18
+ exports.getContractAddresses = getContractAddresses;
19
+ exports.resolveContractAddresses = resolveContractAddresses;
20
+ const ComplianceRules_json_1 = __importDefault(require("../abi/ComplianceRules.json"));
21
+ const CompliantERC20_json_1 = __importDefault(require("../abi/CompliantERC20.json"));
22
+ const IdentityRegistry_json_1 = __importDefault(require("../abi/IdentityRegistry.json"));
23
+ const addresses_json_1 = __importDefault(require("../deployments/hardhat/addresses.json"));
24
+ const ComplianceRules_json_2 = __importDefault(require("../deployments/localhost/ComplianceRules.json"));
25
+ const CompliantERC20_json_2 = __importDefault(require("../deployments/localhost/CompliantERC20.json"));
26
+ const IdentityRegistry_json_2 = __importDefault(require("../deployments/localhost/IdentityRegistry.json"));
27
+ exports.CONTRACT_NAMES = ["IdentityRegistry", "ComplianceRules", "CompliantERC20"];
28
+ const hardhatAddresses = addresses_json_1.default;
29
+ exports.CHAIN_ID_BY_NETWORK = {
30
+ hardhat: 31337,
31
+ localhost: 31337,
32
+ sepolia: 11155111,
33
+ };
34
+ exports.DEPLOYMENTS = {
35
+ hardhat: {
36
+ network: hardhatAddresses.network ?? "hardhat",
37
+ chainId: hardhatAddresses.chainId ?? exports.CHAIN_ID_BY_NETWORK.hardhat,
38
+ deployedAt: hardhatAddresses.deployedAt,
39
+ deployer: hardhatAddresses.deployer,
40
+ contracts: {
41
+ IdentityRegistry: hardhatAddresses.contracts.IdentityRegistry,
42
+ ComplianceRules: hardhatAddresses.contracts.ComplianceRules,
43
+ CompliantERC20: hardhatAddresses.contracts.CompliantERC20,
44
+ },
45
+ },
46
+ localhost: {
47
+ network: "localhost",
48
+ chainId: exports.CHAIN_ID_BY_NETWORK.localhost,
49
+ contracts: {
50
+ IdentityRegistry: {
51
+ address: IdentityRegistry_json_2.default.address,
52
+ },
53
+ ComplianceRules: {
54
+ address: ComplianceRules_json_2.default.address,
55
+ },
56
+ CompliantERC20: {
57
+ address: CompliantERC20_json_2.default.address,
58
+ },
59
+ },
60
+ },
61
+ };
62
+ exports.ADDRESSES = {
63
+ hardhat: {
64
+ IdentityRegistry: hardhatAddresses.contracts.IdentityRegistry.address,
65
+ ComplianceRules: hardhatAddresses.contracts.ComplianceRules.address,
66
+ CompliantERC20: hardhatAddresses.contracts.CompliantERC20.address,
67
+ },
68
+ localhost: {
69
+ IdentityRegistry: IdentityRegistry_json_2.default.address,
70
+ ComplianceRules: ComplianceRules_json_2.default.address,
71
+ CompliantERC20: CompliantERC20_json_2.default.address,
72
+ },
73
+ };
74
+ exports.ABIS = {
75
+ IdentityRegistry: IdentityRegistry_json_1.default,
76
+ ComplianceRules: ComplianceRules_json_1.default,
77
+ CompliantERC20: CompliantERC20_json_1.default,
78
+ };
79
+ function getAbi(name) {
80
+ return exports.ABIS[name];
81
+ }
82
+ exports.IdentityRegistryABI = IdentityRegistry_json_1.default;
83
+ exports.ComplianceRulesABI = ComplianceRules_json_1.default;
84
+ exports.CompliantERC20ABI = CompliantERC20_json_1.default;
85
+ function getDeployment(network) {
86
+ const deployment = exports.DEPLOYMENTS[network];
87
+ if (!deployment) {
88
+ throw new Error(`No deployments found for network "${network}". Deploy contracts and add deployments/${network}/*.json.`);
89
+ }
90
+ return deployment;
91
+ }
92
+ function hasDeployment(network) {
93
+ return Boolean(exports.DEPLOYMENTS[network]);
94
+ }
95
+ function isNetworkName(value) {
96
+ return value in exports.CHAIN_ID_BY_NETWORK;
97
+ }
98
+ function getNetworkNames(chainId) {
99
+ return Object.keys(exports.CHAIN_ID_BY_NETWORK).filter((name) => exports.CHAIN_ID_BY_NETWORK[name] === chainId);
100
+ }
101
+ function getNetworkName(chainId, prefer) {
102
+ const matches = getNetworkNames(chainId);
103
+ if (matches.length === 0) {
104
+ throw new Error(`No network mapped for chainId ${chainId}`);
105
+ }
106
+ if (prefer && matches.includes(prefer))
107
+ return prefer;
108
+ return matches[0];
109
+ }
110
+ function getContractAddresses(networkOrChainId, options) {
111
+ const network = typeof networkOrChainId === "number"
112
+ ? getNetworkName(networkOrChainId, options?.prefer)
113
+ : networkOrChainId;
114
+ const deployment = getDeployment(network);
115
+ const base = {
116
+ IdentityRegistry: deployment.contracts.IdentityRegistry.address,
117
+ ComplianceRules: deployment.contracts.ComplianceRules.address,
118
+ CompliantERC20: deployment.contracts.CompliantERC20.address,
119
+ };
120
+ return { ...base, ...(options?.overrides ?? {}) };
121
+ }
122
+ function resolveContractAddresses(networkOrChainId, options) {
123
+ const network = typeof networkOrChainId === "number"
124
+ ? getNetworkName(networkOrChainId, options?.prefer)
125
+ : networkOrChainId;
126
+ if (hasDeployment(network)) {
127
+ return getContractAddresses(network, options);
128
+ }
129
+ const overrides = options?.overrides ?? {};
130
+ const missing = exports.CONTRACT_NAMES.filter((name) => !overrides[name]);
131
+ if (missing.length > 0) {
132
+ throw new Error(`No deployment found for "${network}". Provide overrides for: ${missing.join(", ")}.`);
133
+ }
134
+ return overrides;
135
+ }
package/package.json ADDED
@@ -0,0 +1,110 @@
1
+ {
2
+ "name": "@zentity/fhevm-contracts",
3
+ "version": "0.1.0",
4
+ "description": "fhEVM smart contracts for Zentity privacy-preserving identity attestations",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "abi/",
9
+ "contracts/",
10
+ "deployments/",
11
+ "dist/",
12
+ "typechain-types/"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ },
22
+ "./abi": {
23
+ "types": "./abi/index.d.ts",
24
+ "default": "./abi/index.js"
25
+ },
26
+ "./abi/IdentityRegistry": "./abi/IdentityRegistry.json",
27
+ "./abi/ComplianceRules": "./abi/ComplianceRules.json",
28
+ "./abi/CompliantERC20": "./abi/CompliantERC20.json",
29
+ "./deployments/*": "./deployments/*",
30
+ "./typechain-types": "./typechain-types/index.ts"
31
+ },
32
+ "scripts": {
33
+ "compile": "hardhat compile",
34
+ "test": "hardhat test",
35
+ "test:mocked": "HARDHAT_NETWORK=hardhat hardhat test",
36
+ "test:local": "hardhat test --network localhost",
37
+ "test:sepolia": "hardhat test --network sepolia --grep Integration",
38
+ "lint": "biome check .",
39
+ "lint:fix": "biome check . --write",
40
+ "lint:sol": "solhint 'contracts/**/*.sol'",
41
+ "lint:sol:fix": "solhint 'contracts/**/*.sol' --fix",
42
+ "format": "biome format . --write",
43
+ "typecheck": "tsc --noEmit",
44
+ "fix": "bun run lint:fix && bun run lint:sol:fix && bun run format",
45
+ "fix:verify": "bun run fix && bun run verify",
46
+ "verify": "bun run lint && bun run lint:sol && bun run compile && bun run typecheck",
47
+ "verify:full": "bun run verify && bun run test:mocked",
48
+ "deploy:mocked": "hardhat deploy --network hardhat",
49
+ "deploy:local": "hardhat deploy --network localhost",
50
+ "deploy:sepolia": "hardhat deploy --network sepolia",
51
+ "typechain": "hardhat typechain",
52
+ "export-abi": "bun scripts/export-abi.ts",
53
+ "print:deployments": "bun scripts/print-deployments.ts",
54
+ "build": "bun run compile && bun run typechain && bun run export-abi && tsc -p tsconfig.build.json",
55
+ "prepublishOnly": "bun run build",
56
+ "ci:version": "changeset version && bun update",
57
+ "ci:publish": "changeset publish",
58
+ "clean": "hardhat clean && rm -rf dist typechain-types abi/*.json",
59
+ "prepare": "husky"
60
+ },
61
+ "dependencies": {
62
+ "@fhevm/solidity": "0.9.1",
63
+ "@openzeppelin/confidential-contracts": "0.3.0"
64
+ },
65
+ "devDependencies": {
66
+ "@biomejs/biome": "^2.3.9",
67
+ "@changesets/cli": "^2.29.8",
68
+ "@commitlint/cli": "^20.2.0",
69
+ "@commitlint/config-conventional": "^20.2.0",
70
+ "@fhevm/hardhat-plugin": "^0.3.0-3",
71
+ "@nomicfoundation/hardhat-chai-matchers": "^2.1.0",
72
+ "@nomicfoundation/hardhat-toolbox": "^6.1.0",
73
+ "@openzeppelin/contracts": "^5.4.0",
74
+ "@types/node": "^22.0.0",
75
+ "chai": "^4.5.0",
76
+ "dotenv": "^17.2.3",
77
+ "hardhat": "^2.28.0",
78
+ "hardhat-deploy": "^1.0.4",
79
+ "husky": "^9.1.7",
80
+ "lint-staged": "^16.2.7",
81
+ "solhint": "^6.0.1",
82
+ "solidity-docgen": "^0.6.0-beta.36",
83
+ "typescript": "^5.9.3"
84
+ },
85
+ "peerDependencies": {
86
+ "ethers": "^6.0.0",
87
+ "viem": "^2.0.0"
88
+ },
89
+ "engines": {
90
+ "node": ">=22.0.0 <25.0.0",
91
+ "bun": ">=1.3.0"
92
+ },
93
+ "packageManager": "bun@1.3.1",
94
+ "repository": {
95
+ "type": "git",
96
+ "url": "git+https://github.com/gustavovalverde/zentity-fhevm-contracts.git"
97
+ },
98
+ "keywords": [
99
+ "fhevm",
100
+ "fhe",
101
+ "zama",
102
+ "identity",
103
+ "kyc",
104
+ "privacy",
105
+ "ethereum",
106
+ "solidity"
107
+ ],
108
+ "author": "Gustavo Valverde",
109
+ "license": "MIT"
110
+ }