@openzeppelin/confidential-contracts 0.2.0-rc.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.
Files changed (31) hide show
  1. package/README.md +24 -0
  2. package/build/contracts/Checkpoints.json +16 -0
  3. package/build/contracts/CheckpointsConfidential.json +16 -0
  4. package/build/contracts/ConfidentialFungibleToken.json +614 -0
  5. package/build/contracts/ConfidentialFungibleTokenERC20Wrapper.json +793 -0
  6. package/build/contracts/ConfidentialFungibleTokenUtils.json +10 -0
  7. package/build/contracts/ConfidentialFungibleTokenVotes.json +1002 -0
  8. package/build/contracts/ERC7821WithExecutor.json +145 -0
  9. package/build/contracts/IConfidentialFungibleToken.json +458 -0
  10. package/build/contracts/IConfidentialFungibleTokenReceiver.json +45 -0
  11. package/build/contracts/TFHESafeMath.json +10 -0
  12. package/build/contracts/VestingWalletCliffConfidential.json +275 -0
  13. package/build/contracts/VestingWalletCliffExecutorConfidential.json +424 -0
  14. package/build/contracts/VestingWalletCliffExecutorConfidentialFactory.json +290 -0
  15. package/build/contracts/VestingWalletConfidential.json +246 -0
  16. package/build/contracts/VotesConfidential.json +412 -0
  17. package/finance/ERC7821WithExecutor.sol +46 -0
  18. package/finance/VestingWalletCliffConfidential.sol +62 -0
  19. package/finance/VestingWalletCliffExecutorConfidentialFactory.sol +203 -0
  20. package/finance/VestingWalletConfidential.sol +130 -0
  21. package/governance/utils/VotesConfidential.sol +202 -0
  22. package/interfaces/IConfidentialFungibleToken.sol +135 -0
  23. package/interfaces/IConfidentialFungibleTokenReceiver.sol +19 -0
  24. package/package.json +39 -0
  25. package/token/ConfidentialFungibleToken.sol +314 -0
  26. package/token/extensions/ConfidentialFungibleTokenERC20Wrapper.sol +175 -0
  27. package/token/extensions/ConfidentialFungibleTokenVotes.sol +29 -0
  28. package/token/utils/ConfidentialFungibleTokenUtils.sol +46 -0
  29. package/utils/TFHESafeMath.sol +37 -0
  30. package/utils/structs/CheckpointsConfidential.sol +193 -0
  31. package/utils/structs/temporary-Checkpoints.sol +835 -0
@@ -0,0 +1,793 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "ConfidentialFungibleTokenERC20Wrapper",
4
+ "sourceName": "contracts/token/extensions/ConfidentialFungibleTokenERC20Wrapper.sol",
5
+ "abi": [
6
+ {
7
+ "inputs": [
8
+ {
9
+ "internalType": "uint256",
10
+ "name": "requestId",
11
+ "type": "uint256"
12
+ }
13
+ ],
14
+ "name": "ConfidentialFungibleTokenInvalidGatewayRequest",
15
+ "type": "error"
16
+ },
17
+ {
18
+ "inputs": [
19
+ {
20
+ "internalType": "address",
21
+ "name": "receiver",
22
+ "type": "address"
23
+ }
24
+ ],
25
+ "name": "ConfidentialFungibleTokenInvalidReceiver",
26
+ "type": "error"
27
+ },
28
+ {
29
+ "inputs": [
30
+ {
31
+ "internalType": "address",
32
+ "name": "sender",
33
+ "type": "address"
34
+ }
35
+ ],
36
+ "name": "ConfidentialFungibleTokenInvalidSender",
37
+ "type": "error"
38
+ },
39
+ {
40
+ "inputs": [
41
+ {
42
+ "internalType": "address",
43
+ "name": "caller",
44
+ "type": "address"
45
+ }
46
+ ],
47
+ "name": "ConfidentialFungibleTokenUnauthorizedCaller",
48
+ "type": "error"
49
+ },
50
+ {
51
+ "inputs": [
52
+ {
53
+ "internalType": "address",
54
+ "name": "holder",
55
+ "type": "address"
56
+ },
57
+ {
58
+ "internalType": "address",
59
+ "name": "spender",
60
+ "type": "address"
61
+ }
62
+ ],
63
+ "name": "ConfidentialFungibleTokenUnauthorizedSpender",
64
+ "type": "error"
65
+ },
66
+ {
67
+ "inputs": [
68
+ {
69
+ "internalType": "euint64",
70
+ "name": "amount",
71
+ "type": "bytes32"
72
+ },
73
+ {
74
+ "internalType": "address",
75
+ "name": "user",
76
+ "type": "address"
77
+ }
78
+ ],
79
+ "name": "ConfidentialFungibleTokenUnauthorizedUseOfEncryptedAmount",
80
+ "type": "error"
81
+ },
82
+ {
83
+ "inputs": [
84
+ {
85
+ "internalType": "address",
86
+ "name": "holder",
87
+ "type": "address"
88
+ }
89
+ ],
90
+ "name": "ConfidentialFungibleTokenZeroBalance",
91
+ "type": "error"
92
+ },
93
+ {
94
+ "inputs": [],
95
+ "name": "HandlesAlreadySavedForRequestID",
96
+ "type": "error"
97
+ },
98
+ {
99
+ "inputs": [],
100
+ "name": "InvalidKMSSignatures",
101
+ "type": "error"
102
+ },
103
+ {
104
+ "inputs": [],
105
+ "name": "NoHandleFoundForRequestID",
106
+ "type": "error"
107
+ },
108
+ {
109
+ "inputs": [
110
+ {
111
+ "internalType": "uint8",
112
+ "name": "bits",
113
+ "type": "uint8"
114
+ },
115
+ {
116
+ "internalType": "uint256",
117
+ "name": "value",
118
+ "type": "uint256"
119
+ }
120
+ ],
121
+ "name": "SafeCastOverflowedUintDowncast",
122
+ "type": "error"
123
+ },
124
+ {
125
+ "inputs": [
126
+ {
127
+ "internalType": "address",
128
+ "name": "token",
129
+ "type": "address"
130
+ }
131
+ ],
132
+ "name": "SafeERC20FailedOperation",
133
+ "type": "error"
134
+ },
135
+ {
136
+ "inputs": [],
137
+ "name": "UnsupportedHandleType",
138
+ "type": "error"
139
+ },
140
+ {
141
+ "anonymous": false,
142
+ "inputs": [
143
+ {
144
+ "indexed": true,
145
+ "internalType": "euint64",
146
+ "name": "encryptedAmount",
147
+ "type": "bytes32"
148
+ },
149
+ {
150
+ "indexed": false,
151
+ "internalType": "uint64",
152
+ "name": "amount",
153
+ "type": "uint64"
154
+ }
155
+ ],
156
+ "name": "AmountDisclosed",
157
+ "type": "event"
158
+ },
159
+ {
160
+ "anonymous": false,
161
+ "inputs": [
162
+ {
163
+ "indexed": true,
164
+ "internalType": "address",
165
+ "name": "from",
166
+ "type": "address"
167
+ },
168
+ {
169
+ "indexed": true,
170
+ "internalType": "address",
171
+ "name": "to",
172
+ "type": "address"
173
+ },
174
+ {
175
+ "indexed": true,
176
+ "internalType": "euint64",
177
+ "name": "amount",
178
+ "type": "bytes32"
179
+ }
180
+ ],
181
+ "name": "ConfidentialTransfer",
182
+ "type": "event"
183
+ },
184
+ {
185
+ "anonymous": false,
186
+ "inputs": [
187
+ {
188
+ "indexed": true,
189
+ "internalType": "uint256",
190
+ "name": "requestID",
191
+ "type": "uint256"
192
+ }
193
+ ],
194
+ "name": "DecryptionFulfilled",
195
+ "type": "event"
196
+ },
197
+ {
198
+ "anonymous": false,
199
+ "inputs": [
200
+ {
201
+ "indexed": true,
202
+ "internalType": "address",
203
+ "name": "holder",
204
+ "type": "address"
205
+ },
206
+ {
207
+ "indexed": true,
208
+ "internalType": "address",
209
+ "name": "operator",
210
+ "type": "address"
211
+ },
212
+ {
213
+ "indexed": false,
214
+ "internalType": "uint48",
215
+ "name": "until",
216
+ "type": "uint48"
217
+ }
218
+ ],
219
+ "name": "OperatorSet",
220
+ "type": "event"
221
+ },
222
+ {
223
+ "inputs": [
224
+ {
225
+ "internalType": "address",
226
+ "name": "account",
227
+ "type": "address"
228
+ }
229
+ ],
230
+ "name": "confidentialBalanceOf",
231
+ "outputs": [
232
+ {
233
+ "internalType": "euint64",
234
+ "name": "",
235
+ "type": "bytes32"
236
+ }
237
+ ],
238
+ "stateMutability": "view",
239
+ "type": "function"
240
+ },
241
+ {
242
+ "inputs": [],
243
+ "name": "confidentialTotalSupply",
244
+ "outputs": [
245
+ {
246
+ "internalType": "euint64",
247
+ "name": "",
248
+ "type": "bytes32"
249
+ }
250
+ ],
251
+ "stateMutability": "view",
252
+ "type": "function"
253
+ },
254
+ {
255
+ "inputs": [
256
+ {
257
+ "internalType": "address",
258
+ "name": "to",
259
+ "type": "address"
260
+ },
261
+ {
262
+ "internalType": "externalEuint64",
263
+ "name": "encryptedAmount",
264
+ "type": "bytes32"
265
+ },
266
+ {
267
+ "internalType": "bytes",
268
+ "name": "inputProof",
269
+ "type": "bytes"
270
+ }
271
+ ],
272
+ "name": "confidentialTransfer",
273
+ "outputs": [
274
+ {
275
+ "internalType": "euint64",
276
+ "name": "",
277
+ "type": "bytes32"
278
+ }
279
+ ],
280
+ "stateMutability": "nonpayable",
281
+ "type": "function"
282
+ },
283
+ {
284
+ "inputs": [
285
+ {
286
+ "internalType": "address",
287
+ "name": "to",
288
+ "type": "address"
289
+ },
290
+ {
291
+ "internalType": "euint64",
292
+ "name": "amount",
293
+ "type": "bytes32"
294
+ }
295
+ ],
296
+ "name": "confidentialTransfer",
297
+ "outputs": [
298
+ {
299
+ "internalType": "euint64",
300
+ "name": "",
301
+ "type": "bytes32"
302
+ }
303
+ ],
304
+ "stateMutability": "nonpayable",
305
+ "type": "function"
306
+ },
307
+ {
308
+ "inputs": [
309
+ {
310
+ "internalType": "address",
311
+ "name": "to",
312
+ "type": "address"
313
+ },
314
+ {
315
+ "internalType": "euint64",
316
+ "name": "amount",
317
+ "type": "bytes32"
318
+ },
319
+ {
320
+ "internalType": "bytes",
321
+ "name": "data",
322
+ "type": "bytes"
323
+ }
324
+ ],
325
+ "name": "confidentialTransferAndCall",
326
+ "outputs": [
327
+ {
328
+ "internalType": "euint64",
329
+ "name": "transferred",
330
+ "type": "bytes32"
331
+ }
332
+ ],
333
+ "stateMutability": "nonpayable",
334
+ "type": "function"
335
+ },
336
+ {
337
+ "inputs": [
338
+ {
339
+ "internalType": "address",
340
+ "name": "to",
341
+ "type": "address"
342
+ },
343
+ {
344
+ "internalType": "externalEuint64",
345
+ "name": "encryptedAmount",
346
+ "type": "bytes32"
347
+ },
348
+ {
349
+ "internalType": "bytes",
350
+ "name": "inputProof",
351
+ "type": "bytes"
352
+ },
353
+ {
354
+ "internalType": "bytes",
355
+ "name": "data",
356
+ "type": "bytes"
357
+ }
358
+ ],
359
+ "name": "confidentialTransferAndCall",
360
+ "outputs": [
361
+ {
362
+ "internalType": "euint64",
363
+ "name": "transferred",
364
+ "type": "bytes32"
365
+ }
366
+ ],
367
+ "stateMutability": "nonpayable",
368
+ "type": "function"
369
+ },
370
+ {
371
+ "inputs": [
372
+ {
373
+ "internalType": "address",
374
+ "name": "from",
375
+ "type": "address"
376
+ },
377
+ {
378
+ "internalType": "address",
379
+ "name": "to",
380
+ "type": "address"
381
+ },
382
+ {
383
+ "internalType": "externalEuint64",
384
+ "name": "encryptedAmount",
385
+ "type": "bytes32"
386
+ },
387
+ {
388
+ "internalType": "bytes",
389
+ "name": "inputProof",
390
+ "type": "bytes"
391
+ }
392
+ ],
393
+ "name": "confidentialTransferFrom",
394
+ "outputs": [
395
+ {
396
+ "internalType": "euint64",
397
+ "name": "transferred",
398
+ "type": "bytes32"
399
+ }
400
+ ],
401
+ "stateMutability": "nonpayable",
402
+ "type": "function"
403
+ },
404
+ {
405
+ "inputs": [
406
+ {
407
+ "internalType": "address",
408
+ "name": "from",
409
+ "type": "address"
410
+ },
411
+ {
412
+ "internalType": "address",
413
+ "name": "to",
414
+ "type": "address"
415
+ },
416
+ {
417
+ "internalType": "euint64",
418
+ "name": "amount",
419
+ "type": "bytes32"
420
+ }
421
+ ],
422
+ "name": "confidentialTransferFrom",
423
+ "outputs": [
424
+ {
425
+ "internalType": "euint64",
426
+ "name": "transferred",
427
+ "type": "bytes32"
428
+ }
429
+ ],
430
+ "stateMutability": "nonpayable",
431
+ "type": "function"
432
+ },
433
+ {
434
+ "inputs": [
435
+ {
436
+ "internalType": "address",
437
+ "name": "from",
438
+ "type": "address"
439
+ },
440
+ {
441
+ "internalType": "address",
442
+ "name": "to",
443
+ "type": "address"
444
+ },
445
+ {
446
+ "internalType": "externalEuint64",
447
+ "name": "encryptedAmount",
448
+ "type": "bytes32"
449
+ },
450
+ {
451
+ "internalType": "bytes",
452
+ "name": "inputProof",
453
+ "type": "bytes"
454
+ },
455
+ {
456
+ "internalType": "bytes",
457
+ "name": "data",
458
+ "type": "bytes"
459
+ }
460
+ ],
461
+ "name": "confidentialTransferFromAndCall",
462
+ "outputs": [
463
+ {
464
+ "internalType": "euint64",
465
+ "name": "transferred",
466
+ "type": "bytes32"
467
+ }
468
+ ],
469
+ "stateMutability": "nonpayable",
470
+ "type": "function"
471
+ },
472
+ {
473
+ "inputs": [
474
+ {
475
+ "internalType": "address",
476
+ "name": "from",
477
+ "type": "address"
478
+ },
479
+ {
480
+ "internalType": "address",
481
+ "name": "to",
482
+ "type": "address"
483
+ },
484
+ {
485
+ "internalType": "euint64",
486
+ "name": "amount",
487
+ "type": "bytes32"
488
+ },
489
+ {
490
+ "internalType": "bytes",
491
+ "name": "data",
492
+ "type": "bytes"
493
+ }
494
+ ],
495
+ "name": "confidentialTransferFromAndCall",
496
+ "outputs": [
497
+ {
498
+ "internalType": "euint64",
499
+ "name": "transferred",
500
+ "type": "bytes32"
501
+ }
502
+ ],
503
+ "stateMutability": "nonpayable",
504
+ "type": "function"
505
+ },
506
+ {
507
+ "inputs": [],
508
+ "name": "decimals",
509
+ "outputs": [
510
+ {
511
+ "internalType": "uint8",
512
+ "name": "",
513
+ "type": "uint8"
514
+ }
515
+ ],
516
+ "stateMutability": "view",
517
+ "type": "function"
518
+ },
519
+ {
520
+ "inputs": [
521
+ {
522
+ "internalType": "euint64",
523
+ "name": "encryptedAmount",
524
+ "type": "bytes32"
525
+ }
526
+ ],
527
+ "name": "discloseEncryptedAmount",
528
+ "outputs": [],
529
+ "stateMutability": "nonpayable",
530
+ "type": "function"
531
+ },
532
+ {
533
+ "inputs": [
534
+ {
535
+ "internalType": "uint256",
536
+ "name": "requestId",
537
+ "type": "uint256"
538
+ },
539
+ {
540
+ "internalType": "uint64",
541
+ "name": "amount",
542
+ "type": "uint64"
543
+ },
544
+ {
545
+ "internalType": "bytes[]",
546
+ "name": "signatures",
547
+ "type": "bytes[]"
548
+ }
549
+ ],
550
+ "name": "finalizeDiscloseEncryptedAmount",
551
+ "outputs": [],
552
+ "stateMutability": "nonpayable",
553
+ "type": "function"
554
+ },
555
+ {
556
+ "inputs": [
557
+ {
558
+ "internalType": "uint256",
559
+ "name": "requestID",
560
+ "type": "uint256"
561
+ },
562
+ {
563
+ "internalType": "uint64",
564
+ "name": "amount",
565
+ "type": "uint64"
566
+ },
567
+ {
568
+ "internalType": "bytes[]",
569
+ "name": "signatures",
570
+ "type": "bytes[]"
571
+ }
572
+ ],
573
+ "name": "finalizeUnwrap",
574
+ "outputs": [],
575
+ "stateMutability": "nonpayable",
576
+ "type": "function"
577
+ },
578
+ {
579
+ "inputs": [
580
+ {
581
+ "internalType": "address",
582
+ "name": "holder",
583
+ "type": "address"
584
+ },
585
+ {
586
+ "internalType": "address",
587
+ "name": "spender",
588
+ "type": "address"
589
+ }
590
+ ],
591
+ "name": "isOperator",
592
+ "outputs": [
593
+ {
594
+ "internalType": "bool",
595
+ "name": "",
596
+ "type": "bool"
597
+ }
598
+ ],
599
+ "stateMutability": "view",
600
+ "type": "function"
601
+ },
602
+ {
603
+ "inputs": [],
604
+ "name": "name",
605
+ "outputs": [
606
+ {
607
+ "internalType": "string",
608
+ "name": "",
609
+ "type": "string"
610
+ }
611
+ ],
612
+ "stateMutability": "view",
613
+ "type": "function"
614
+ },
615
+ {
616
+ "inputs": [
617
+ {
618
+ "internalType": "address",
619
+ "name": "",
620
+ "type": "address"
621
+ },
622
+ {
623
+ "internalType": "address",
624
+ "name": "from",
625
+ "type": "address"
626
+ },
627
+ {
628
+ "internalType": "uint256",
629
+ "name": "amount",
630
+ "type": "uint256"
631
+ },
632
+ {
633
+ "internalType": "bytes",
634
+ "name": "data",
635
+ "type": "bytes"
636
+ }
637
+ ],
638
+ "name": "onTransferReceived",
639
+ "outputs": [
640
+ {
641
+ "internalType": "bytes4",
642
+ "name": "",
643
+ "type": "bytes4"
644
+ }
645
+ ],
646
+ "stateMutability": "nonpayable",
647
+ "type": "function"
648
+ },
649
+ {
650
+ "inputs": [],
651
+ "name": "rate",
652
+ "outputs": [
653
+ {
654
+ "internalType": "uint256",
655
+ "name": "",
656
+ "type": "uint256"
657
+ }
658
+ ],
659
+ "stateMutability": "view",
660
+ "type": "function"
661
+ },
662
+ {
663
+ "inputs": [
664
+ {
665
+ "internalType": "address",
666
+ "name": "operator",
667
+ "type": "address"
668
+ },
669
+ {
670
+ "internalType": "uint48",
671
+ "name": "until",
672
+ "type": "uint48"
673
+ }
674
+ ],
675
+ "name": "setOperator",
676
+ "outputs": [],
677
+ "stateMutability": "nonpayable",
678
+ "type": "function"
679
+ },
680
+ {
681
+ "inputs": [],
682
+ "name": "symbol",
683
+ "outputs": [
684
+ {
685
+ "internalType": "string",
686
+ "name": "",
687
+ "type": "string"
688
+ }
689
+ ],
690
+ "stateMutability": "view",
691
+ "type": "function"
692
+ },
693
+ {
694
+ "inputs": [],
695
+ "name": "tokenURI",
696
+ "outputs": [
697
+ {
698
+ "internalType": "string",
699
+ "name": "",
700
+ "type": "string"
701
+ }
702
+ ],
703
+ "stateMutability": "view",
704
+ "type": "function"
705
+ },
706
+ {
707
+ "inputs": [],
708
+ "name": "underlying",
709
+ "outputs": [
710
+ {
711
+ "internalType": "contract IERC20",
712
+ "name": "",
713
+ "type": "address"
714
+ }
715
+ ],
716
+ "stateMutability": "view",
717
+ "type": "function"
718
+ },
719
+ {
720
+ "inputs": [
721
+ {
722
+ "internalType": "address",
723
+ "name": "from",
724
+ "type": "address"
725
+ },
726
+ {
727
+ "internalType": "address",
728
+ "name": "to",
729
+ "type": "address"
730
+ },
731
+ {
732
+ "internalType": "externalEuint64",
733
+ "name": "encryptedAmount",
734
+ "type": "bytes32"
735
+ },
736
+ {
737
+ "internalType": "bytes",
738
+ "name": "inputProof",
739
+ "type": "bytes"
740
+ }
741
+ ],
742
+ "name": "unwrap",
743
+ "outputs": [],
744
+ "stateMutability": "nonpayable",
745
+ "type": "function"
746
+ },
747
+ {
748
+ "inputs": [
749
+ {
750
+ "internalType": "address",
751
+ "name": "from",
752
+ "type": "address"
753
+ },
754
+ {
755
+ "internalType": "address",
756
+ "name": "to",
757
+ "type": "address"
758
+ },
759
+ {
760
+ "internalType": "euint64",
761
+ "name": "amount",
762
+ "type": "bytes32"
763
+ }
764
+ ],
765
+ "name": "unwrap",
766
+ "outputs": [],
767
+ "stateMutability": "nonpayable",
768
+ "type": "function"
769
+ },
770
+ {
771
+ "inputs": [
772
+ {
773
+ "internalType": "address",
774
+ "name": "to",
775
+ "type": "address"
776
+ },
777
+ {
778
+ "internalType": "uint256",
779
+ "name": "amount",
780
+ "type": "uint256"
781
+ }
782
+ ],
783
+ "name": "wrap",
784
+ "outputs": [],
785
+ "stateMutability": "nonpayable",
786
+ "type": "function"
787
+ }
788
+ ],
789
+ "bytecode": "0x",
790
+ "deployedBytecode": "0x",
791
+ "linkReferences": {},
792
+ "deployedLinkReferences": {}
793
+ }