@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,145 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "ERC7821WithExecutor",
4
+ "sourceName": "contracts/finance/ERC7821WithExecutor.sol",
5
+ "abi": [
6
+ {
7
+ "inputs": [
8
+ {
9
+ "internalType": "address",
10
+ "name": "sender",
11
+ "type": "address"
12
+ }
13
+ ],
14
+ "name": "AccountUnauthorized",
15
+ "type": "error"
16
+ },
17
+ {
18
+ "inputs": [],
19
+ "name": "ERC7579DecodingError",
20
+ "type": "error"
21
+ },
22
+ {
23
+ "inputs": [
24
+ {
25
+ "internalType": "ExecType",
26
+ "name": "execType",
27
+ "type": "bytes1"
28
+ }
29
+ ],
30
+ "name": "ERC7579UnsupportedExecType",
31
+ "type": "error"
32
+ },
33
+ {
34
+ "inputs": [],
35
+ "name": "FailedCall",
36
+ "type": "error"
37
+ },
38
+ {
39
+ "inputs": [],
40
+ "name": "InvalidInitialization",
41
+ "type": "error"
42
+ },
43
+ {
44
+ "inputs": [],
45
+ "name": "NotInitializing",
46
+ "type": "error"
47
+ },
48
+ {
49
+ "inputs": [],
50
+ "name": "OutOfRangeAccess",
51
+ "type": "error"
52
+ },
53
+ {
54
+ "inputs": [],
55
+ "name": "UnsupportedExecutionMode",
56
+ "type": "error"
57
+ },
58
+ {
59
+ "anonymous": false,
60
+ "inputs": [
61
+ {
62
+ "indexed": false,
63
+ "internalType": "uint256",
64
+ "name": "batchExecutionIndex",
65
+ "type": "uint256"
66
+ },
67
+ {
68
+ "indexed": false,
69
+ "internalType": "bytes",
70
+ "name": "returndata",
71
+ "type": "bytes"
72
+ }
73
+ ],
74
+ "name": "ERC7579TryExecuteFail",
75
+ "type": "event"
76
+ },
77
+ {
78
+ "anonymous": false,
79
+ "inputs": [
80
+ {
81
+ "indexed": false,
82
+ "internalType": "uint64",
83
+ "name": "version",
84
+ "type": "uint64"
85
+ }
86
+ ],
87
+ "name": "Initialized",
88
+ "type": "event"
89
+ },
90
+ {
91
+ "inputs": [
92
+ {
93
+ "internalType": "bytes32",
94
+ "name": "mode",
95
+ "type": "bytes32"
96
+ },
97
+ {
98
+ "internalType": "bytes",
99
+ "name": "executionData",
100
+ "type": "bytes"
101
+ }
102
+ ],
103
+ "name": "execute",
104
+ "outputs": [],
105
+ "stateMutability": "payable",
106
+ "type": "function"
107
+ },
108
+ {
109
+ "inputs": [],
110
+ "name": "executor",
111
+ "outputs": [
112
+ {
113
+ "internalType": "address",
114
+ "name": "",
115
+ "type": "address"
116
+ }
117
+ ],
118
+ "stateMutability": "view",
119
+ "type": "function"
120
+ },
121
+ {
122
+ "inputs": [
123
+ {
124
+ "internalType": "bytes32",
125
+ "name": "mode",
126
+ "type": "bytes32"
127
+ }
128
+ ],
129
+ "name": "supportsExecutionMode",
130
+ "outputs": [
131
+ {
132
+ "internalType": "bool",
133
+ "name": "result",
134
+ "type": "bool"
135
+ }
136
+ ],
137
+ "stateMutability": "view",
138
+ "type": "function"
139
+ }
140
+ ],
141
+ "bytecode": "0x",
142
+ "deployedBytecode": "0x",
143
+ "linkReferences": {},
144
+ "deployedLinkReferences": {}
145
+ }
@@ -0,0 +1,458 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "IConfidentialFungibleToken",
4
+ "sourceName": "contracts/interfaces/IConfidentialFungibleToken.sol",
5
+ "abi": [
6
+ {
7
+ "anonymous": false,
8
+ "inputs": [
9
+ {
10
+ "indexed": true,
11
+ "internalType": "euint64",
12
+ "name": "encryptedAmount",
13
+ "type": "bytes32"
14
+ },
15
+ {
16
+ "indexed": false,
17
+ "internalType": "uint64",
18
+ "name": "amount",
19
+ "type": "uint64"
20
+ }
21
+ ],
22
+ "name": "AmountDisclosed",
23
+ "type": "event"
24
+ },
25
+ {
26
+ "anonymous": false,
27
+ "inputs": [
28
+ {
29
+ "indexed": true,
30
+ "internalType": "address",
31
+ "name": "from",
32
+ "type": "address"
33
+ },
34
+ {
35
+ "indexed": true,
36
+ "internalType": "address",
37
+ "name": "to",
38
+ "type": "address"
39
+ },
40
+ {
41
+ "indexed": true,
42
+ "internalType": "euint64",
43
+ "name": "amount",
44
+ "type": "bytes32"
45
+ }
46
+ ],
47
+ "name": "ConfidentialTransfer",
48
+ "type": "event"
49
+ },
50
+ {
51
+ "anonymous": false,
52
+ "inputs": [
53
+ {
54
+ "indexed": true,
55
+ "internalType": "address",
56
+ "name": "holder",
57
+ "type": "address"
58
+ },
59
+ {
60
+ "indexed": true,
61
+ "internalType": "address",
62
+ "name": "operator",
63
+ "type": "address"
64
+ },
65
+ {
66
+ "indexed": false,
67
+ "internalType": "uint48",
68
+ "name": "until",
69
+ "type": "uint48"
70
+ }
71
+ ],
72
+ "name": "OperatorSet",
73
+ "type": "event"
74
+ },
75
+ {
76
+ "inputs": [
77
+ {
78
+ "internalType": "address",
79
+ "name": "account",
80
+ "type": "address"
81
+ }
82
+ ],
83
+ "name": "confidentialBalanceOf",
84
+ "outputs": [
85
+ {
86
+ "internalType": "euint64",
87
+ "name": "",
88
+ "type": "bytes32"
89
+ }
90
+ ],
91
+ "stateMutability": "view",
92
+ "type": "function"
93
+ },
94
+ {
95
+ "inputs": [],
96
+ "name": "confidentialTotalSupply",
97
+ "outputs": [
98
+ {
99
+ "internalType": "euint64",
100
+ "name": "",
101
+ "type": "bytes32"
102
+ }
103
+ ],
104
+ "stateMutability": "view",
105
+ "type": "function"
106
+ },
107
+ {
108
+ "inputs": [
109
+ {
110
+ "internalType": "address",
111
+ "name": "to",
112
+ "type": "address"
113
+ },
114
+ {
115
+ "internalType": "externalEuint64",
116
+ "name": "encryptedAmount",
117
+ "type": "bytes32"
118
+ },
119
+ {
120
+ "internalType": "bytes",
121
+ "name": "inputProof",
122
+ "type": "bytes"
123
+ }
124
+ ],
125
+ "name": "confidentialTransfer",
126
+ "outputs": [
127
+ {
128
+ "internalType": "euint64",
129
+ "name": "",
130
+ "type": "bytes32"
131
+ }
132
+ ],
133
+ "stateMutability": "nonpayable",
134
+ "type": "function"
135
+ },
136
+ {
137
+ "inputs": [
138
+ {
139
+ "internalType": "address",
140
+ "name": "to",
141
+ "type": "address"
142
+ },
143
+ {
144
+ "internalType": "euint64",
145
+ "name": "amount",
146
+ "type": "bytes32"
147
+ }
148
+ ],
149
+ "name": "confidentialTransfer",
150
+ "outputs": [
151
+ {
152
+ "internalType": "euint64",
153
+ "name": "transferred",
154
+ "type": "bytes32"
155
+ }
156
+ ],
157
+ "stateMutability": "nonpayable",
158
+ "type": "function"
159
+ },
160
+ {
161
+ "inputs": [
162
+ {
163
+ "internalType": "address",
164
+ "name": "to",
165
+ "type": "address"
166
+ },
167
+ {
168
+ "internalType": "euint64",
169
+ "name": "amount",
170
+ "type": "bytes32"
171
+ },
172
+ {
173
+ "internalType": "bytes",
174
+ "name": "data",
175
+ "type": "bytes"
176
+ }
177
+ ],
178
+ "name": "confidentialTransferAndCall",
179
+ "outputs": [
180
+ {
181
+ "internalType": "euint64",
182
+ "name": "transferred",
183
+ "type": "bytes32"
184
+ }
185
+ ],
186
+ "stateMutability": "nonpayable",
187
+ "type": "function"
188
+ },
189
+ {
190
+ "inputs": [
191
+ {
192
+ "internalType": "address",
193
+ "name": "to",
194
+ "type": "address"
195
+ },
196
+ {
197
+ "internalType": "externalEuint64",
198
+ "name": "encryptedAmount",
199
+ "type": "bytes32"
200
+ },
201
+ {
202
+ "internalType": "bytes",
203
+ "name": "inputProof",
204
+ "type": "bytes"
205
+ },
206
+ {
207
+ "internalType": "bytes",
208
+ "name": "data",
209
+ "type": "bytes"
210
+ }
211
+ ],
212
+ "name": "confidentialTransferAndCall",
213
+ "outputs": [
214
+ {
215
+ "internalType": "euint64",
216
+ "name": "transferred",
217
+ "type": "bytes32"
218
+ }
219
+ ],
220
+ "stateMutability": "nonpayable",
221
+ "type": "function"
222
+ },
223
+ {
224
+ "inputs": [
225
+ {
226
+ "internalType": "address",
227
+ "name": "from",
228
+ "type": "address"
229
+ },
230
+ {
231
+ "internalType": "address",
232
+ "name": "to",
233
+ "type": "address"
234
+ },
235
+ {
236
+ "internalType": "externalEuint64",
237
+ "name": "encryptedAmount",
238
+ "type": "bytes32"
239
+ },
240
+ {
241
+ "internalType": "bytes",
242
+ "name": "inputProof",
243
+ "type": "bytes"
244
+ }
245
+ ],
246
+ "name": "confidentialTransferFrom",
247
+ "outputs": [
248
+ {
249
+ "internalType": "euint64",
250
+ "name": "",
251
+ "type": "bytes32"
252
+ }
253
+ ],
254
+ "stateMutability": "nonpayable",
255
+ "type": "function"
256
+ },
257
+ {
258
+ "inputs": [
259
+ {
260
+ "internalType": "address",
261
+ "name": "from",
262
+ "type": "address"
263
+ },
264
+ {
265
+ "internalType": "address",
266
+ "name": "to",
267
+ "type": "address"
268
+ },
269
+ {
270
+ "internalType": "euint64",
271
+ "name": "amount",
272
+ "type": "bytes32"
273
+ }
274
+ ],
275
+ "name": "confidentialTransferFrom",
276
+ "outputs": [
277
+ {
278
+ "internalType": "euint64",
279
+ "name": "transferred",
280
+ "type": "bytes32"
281
+ }
282
+ ],
283
+ "stateMutability": "nonpayable",
284
+ "type": "function"
285
+ },
286
+ {
287
+ "inputs": [
288
+ {
289
+ "internalType": "address",
290
+ "name": "from",
291
+ "type": "address"
292
+ },
293
+ {
294
+ "internalType": "address",
295
+ "name": "to",
296
+ "type": "address"
297
+ },
298
+ {
299
+ "internalType": "externalEuint64",
300
+ "name": "encryptedAmount",
301
+ "type": "bytes32"
302
+ },
303
+ {
304
+ "internalType": "bytes",
305
+ "name": "inputProof",
306
+ "type": "bytes"
307
+ },
308
+ {
309
+ "internalType": "bytes",
310
+ "name": "data",
311
+ "type": "bytes"
312
+ }
313
+ ],
314
+ "name": "confidentialTransferFromAndCall",
315
+ "outputs": [
316
+ {
317
+ "internalType": "euint64",
318
+ "name": "transferred",
319
+ "type": "bytes32"
320
+ }
321
+ ],
322
+ "stateMutability": "nonpayable",
323
+ "type": "function"
324
+ },
325
+ {
326
+ "inputs": [
327
+ {
328
+ "internalType": "address",
329
+ "name": "from",
330
+ "type": "address"
331
+ },
332
+ {
333
+ "internalType": "address",
334
+ "name": "to",
335
+ "type": "address"
336
+ },
337
+ {
338
+ "internalType": "euint64",
339
+ "name": "amount",
340
+ "type": "bytes32"
341
+ },
342
+ {
343
+ "internalType": "bytes",
344
+ "name": "data",
345
+ "type": "bytes"
346
+ }
347
+ ],
348
+ "name": "confidentialTransferFromAndCall",
349
+ "outputs": [
350
+ {
351
+ "internalType": "euint64",
352
+ "name": "transferred",
353
+ "type": "bytes32"
354
+ }
355
+ ],
356
+ "stateMutability": "nonpayable",
357
+ "type": "function"
358
+ },
359
+ {
360
+ "inputs": [],
361
+ "name": "decimals",
362
+ "outputs": [
363
+ {
364
+ "internalType": "uint8",
365
+ "name": "",
366
+ "type": "uint8"
367
+ }
368
+ ],
369
+ "stateMutability": "view",
370
+ "type": "function"
371
+ },
372
+ {
373
+ "inputs": [
374
+ {
375
+ "internalType": "address",
376
+ "name": "holder",
377
+ "type": "address"
378
+ },
379
+ {
380
+ "internalType": "address",
381
+ "name": "spender",
382
+ "type": "address"
383
+ }
384
+ ],
385
+ "name": "isOperator",
386
+ "outputs": [
387
+ {
388
+ "internalType": "bool",
389
+ "name": "",
390
+ "type": "bool"
391
+ }
392
+ ],
393
+ "stateMutability": "view",
394
+ "type": "function"
395
+ },
396
+ {
397
+ "inputs": [],
398
+ "name": "name",
399
+ "outputs": [
400
+ {
401
+ "internalType": "string",
402
+ "name": "",
403
+ "type": "string"
404
+ }
405
+ ],
406
+ "stateMutability": "view",
407
+ "type": "function"
408
+ },
409
+ {
410
+ "inputs": [
411
+ {
412
+ "internalType": "address",
413
+ "name": "operator",
414
+ "type": "address"
415
+ },
416
+ {
417
+ "internalType": "uint48",
418
+ "name": "until",
419
+ "type": "uint48"
420
+ }
421
+ ],
422
+ "name": "setOperator",
423
+ "outputs": [],
424
+ "stateMutability": "nonpayable",
425
+ "type": "function"
426
+ },
427
+ {
428
+ "inputs": [],
429
+ "name": "symbol",
430
+ "outputs": [
431
+ {
432
+ "internalType": "string",
433
+ "name": "",
434
+ "type": "string"
435
+ }
436
+ ],
437
+ "stateMutability": "view",
438
+ "type": "function"
439
+ },
440
+ {
441
+ "inputs": [],
442
+ "name": "tokenURI",
443
+ "outputs": [
444
+ {
445
+ "internalType": "string",
446
+ "name": "",
447
+ "type": "string"
448
+ }
449
+ ],
450
+ "stateMutability": "view",
451
+ "type": "function"
452
+ }
453
+ ],
454
+ "bytecode": "0x",
455
+ "deployedBytecode": "0x",
456
+ "linkReferences": {},
457
+ "deployedLinkReferences": {}
458
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "IConfidentialFungibleTokenReceiver",
4
+ "sourceName": "contracts/interfaces/IConfidentialFungibleTokenReceiver.sol",
5
+ "abi": [
6
+ {
7
+ "inputs": [
8
+ {
9
+ "internalType": "address",
10
+ "name": "operator",
11
+ "type": "address"
12
+ },
13
+ {
14
+ "internalType": "address",
15
+ "name": "from",
16
+ "type": "address"
17
+ },
18
+ {
19
+ "internalType": "euint64",
20
+ "name": "amount",
21
+ "type": "bytes32"
22
+ },
23
+ {
24
+ "internalType": "bytes",
25
+ "name": "data",
26
+ "type": "bytes"
27
+ }
28
+ ],
29
+ "name": "onConfidentialTransferReceived",
30
+ "outputs": [
31
+ {
32
+ "internalType": "ebool",
33
+ "name": "",
34
+ "type": "bytes32"
35
+ }
36
+ ],
37
+ "stateMutability": "nonpayable",
38
+ "type": "function"
39
+ }
40
+ ],
41
+ "bytecode": "0x",
42
+ "deployedBytecode": "0x",
43
+ "linkReferences": {},
44
+ "deployedLinkReferences": {}
45
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "TFHESafeMath",
4
+ "sourceName": "contracts/utils/TFHESafeMath.sol",
5
+ "abi": [],
6
+ "bytecode": "0x60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220a360bdfb9ce166b60c4797a3050030012f08a59e6faec120f3896650e4d97ecc64736f6c634300081d0033",
7
+ "deployedBytecode": "0x730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220a360bdfb9ce166b60c4797a3050030012f08a59e6faec120f3896650e4d97ecc64736f6c634300081d0033",
8
+ "linkReferences": {},
9
+ "deployedLinkReferences": {}
10
+ }