@inco/lightning 0.1.29 → 0.1.30

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/package.json CHANGED
@@ -1,21 +1,20 @@
1
1
  {
2
2
  "name": "@inco/lightning",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "repository": "https://github.com/Inco-fhevm/inco-monorepo",
5
5
  "files": [
6
6
  "src/",
7
- "foundry.toml",
8
7
  "dumps/",
9
8
  "CHANGELOG.md",
10
- "remappings.txt",
11
- "foundry.toml",
12
9
  "manifest.yaml"
13
10
  ],
14
11
  "scripts": {
12
+ "generate:libraries": "bun run ../pega/lib/deployment/cmd/generate-libraries.ts",
15
13
  "publish:github": "bun publish --registry=https://npm.pkg.github.com",
16
- "generate:libraries": "bun run ../pega/lib/deployment/cmd/generate-libraries.ts"
14
+ "publish:npm": "bun publish --access public"
17
15
  },
18
16
  "dependencies": {
17
+ "@inco/shared": "^0.1.0",
19
18
  "@openzeppelin/contracts": "^5.2.0",
20
19
  "@openzeppelin/contracts-upgradeable": "^5.2.0",
21
20
  "ds-test": "https://github.com/dapphub/ds-test",
package/src/Lib.sol CHANGED
@@ -6,9 +6,11 @@
6
6
  pragma solidity ^0.8;
7
7
 
8
8
  import "./IncoLightning.sol";
9
- import { ebool, euint256, ETypes } from "./Types.sol";
9
+ import {ebool, euint256, ETypes} from "./Types.sol";
10
10
 
11
- IncoLightning constant inco = IncoLightning(0x63D8135aF4D393B1dB43B649010c8D3EE19FC9fd);
11
+ IncoLightning constant inco = IncoLightning(
12
+ 0x63D8135aF4D393B1dB43B649010c8D3EE19FC9fd
13
+ );
12
14
  address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
13
15
  uint256 constant defaultDecryptionDelayLimit = 2 hours;
14
16
 
@@ -96,15 +98,30 @@ library e {
96
98
  }
97
99
 
98
100
  function and(euint256 a, euint256 b) internal returns (euint256) {
99
- return euint256.wrap(inco.eBitAnd(euint256.unwrap(s(a)), euint256.unwrap(s(b))));
101
+ return
102
+ euint256.wrap(
103
+ inco.eBitAnd(euint256.unwrap(s(a)), euint256.unwrap(s(b)))
104
+ );
100
105
  }
101
106
 
102
107
  function and(euint256 a, uint256 b) internal returns (euint256) {
103
- return euint256.wrap(inco.eBitAnd(euint256.unwrap(s(a)), euint256.unwrap(asEuint256(b))));
108
+ return
109
+ euint256.wrap(
110
+ inco.eBitAnd(
111
+ euint256.unwrap(s(a)),
112
+ euint256.unwrap(asEuint256(b))
113
+ )
114
+ );
104
115
  }
105
116
 
106
117
  function and(uint256 a, euint256 b) internal returns (euint256) {
107
- return euint256.wrap(inco.eBitAnd(euint256.unwrap(asEuint256(a)), euint256.unwrap(s(b))));
118
+ return
119
+ euint256.wrap(
120
+ inco.eBitAnd(
121
+ euint256.unwrap(asEuint256(a)),
122
+ euint256.unwrap(s(b))
123
+ )
124
+ );
108
125
  }
109
126
 
110
127
  function and(ebool a, ebool b) internal returns (ebool) {
@@ -112,23 +129,44 @@ library e {
112
129
  }
113
130
 
114
131
  function and(ebool a, bool b) internal returns (ebool) {
115
- return ebool.wrap(inco.eBitAnd(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b))));
132
+ return
133
+ ebool.wrap(
134
+ inco.eBitAnd(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b)))
135
+ );
116
136
  }
117
137
 
118
138
  function and(bool a, ebool b) internal returns (ebool) {
119
- return ebool.wrap(inco.eBitAnd(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b))));
139
+ return
140
+ ebool.wrap(
141
+ inco.eBitAnd(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b)))
142
+ );
120
143
  }
121
144
 
122
145
  function or(euint256 a, euint256 b) internal returns (euint256) {
123
- return euint256.wrap(inco.eBitOr(euint256.unwrap(s(a)), euint256.unwrap(s(b))));
146
+ return
147
+ euint256.wrap(
148
+ inco.eBitOr(euint256.unwrap(s(a)), euint256.unwrap(s(b)))
149
+ );
124
150
  }
125
151
 
126
152
  function or(euint256 a, uint256 b) internal returns (euint256) {
127
- return euint256.wrap(inco.eBitOr(euint256.unwrap(s(a)), euint256.unwrap(asEuint256(b))));
153
+ return
154
+ euint256.wrap(
155
+ inco.eBitOr(
156
+ euint256.unwrap(s(a)),
157
+ euint256.unwrap(asEuint256(b))
158
+ )
159
+ );
128
160
  }
129
161
 
130
162
  function or(uint256 a, euint256 b) internal returns (euint256) {
131
- return euint256.wrap(inco.eBitOr(euint256.unwrap(asEuint256(a)), euint256.unwrap(s(b))));
163
+ return
164
+ euint256.wrap(
165
+ inco.eBitOr(
166
+ euint256.unwrap(asEuint256(a)),
167
+ euint256.unwrap(s(b))
168
+ )
169
+ );
132
170
  }
133
171
 
134
172
  function or(ebool a, ebool b) internal returns (ebool) {
@@ -136,23 +174,44 @@ library e {
136
174
  }
137
175
 
138
176
  function or(ebool a, bool b) internal returns (ebool) {
139
- return ebool.wrap(inco.eBitOr(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b))));
177
+ return
178
+ ebool.wrap(
179
+ inco.eBitOr(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b)))
180
+ );
140
181
  }
141
182
 
142
183
  function or(bool a, ebool b) internal returns (ebool) {
143
- return ebool.wrap(inco.eBitOr(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b))));
184
+ return
185
+ ebool.wrap(
186
+ inco.eBitOr(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b)))
187
+ );
144
188
  }
145
189
 
146
190
  function xor(euint256 a, euint256 b) internal returns (euint256) {
147
- return euint256.wrap(inco.eBitXor(euint256.unwrap(s(a)), euint256.unwrap(s(b))));
191
+ return
192
+ euint256.wrap(
193
+ inco.eBitXor(euint256.unwrap(s(a)), euint256.unwrap(s(b)))
194
+ );
148
195
  }
149
196
 
150
197
  function xor(euint256 a, uint256 b) internal returns (euint256) {
151
- return euint256.wrap(inco.eBitXor(euint256.unwrap(s(a)), euint256.unwrap(asEuint256(b))));
198
+ return
199
+ euint256.wrap(
200
+ inco.eBitXor(
201
+ euint256.unwrap(s(a)),
202
+ euint256.unwrap(asEuint256(b))
203
+ )
204
+ );
152
205
  }
153
206
 
154
207
  function xor(uint256 a, euint256 b) internal returns (euint256) {
155
- return euint256.wrap(inco.eBitXor(euint256.unwrap(asEuint256(a)), euint256.unwrap(s(b))));
208
+ return
209
+ euint256.wrap(
210
+ inco.eBitXor(
211
+ euint256.unwrap(asEuint256(a)),
212
+ euint256.unwrap(s(b))
213
+ )
214
+ );
156
215
  }
157
216
 
158
217
  function xor(ebool a, ebool b) internal returns (ebool) {
@@ -160,11 +219,17 @@ library e {
160
219
  }
161
220
 
162
221
  function xor(ebool a, bool b) internal returns (ebool) {
163
- return ebool.wrap(inco.eBitXor(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b))));
222
+ return
223
+ ebool.wrap(
224
+ inco.eBitXor(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b)))
225
+ );
164
226
  }
165
227
 
166
228
  function xor(bool a, ebool b) internal returns (ebool) {
167
- return ebool.wrap(inco.eBitXor(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b))));
229
+ return
230
+ ebool.wrap(
231
+ inco.eBitXor(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b)))
232
+ );
168
233
  }
169
234
 
170
235
  function shl(euint256 a, euint256 b) internal returns (euint256) {
@@ -320,11 +385,23 @@ library e {
320
385
  }
321
386
 
322
387
  function randBounded(uint256 upperBound) internal returns (euint256) {
323
- return euint256.wrap(inco.eRandBounded(euint256.unwrap(asEuint256(upperBound)), ETypes.Uint256));
388
+ return
389
+ euint256.wrap(
390
+ inco.eRandBounded(
391
+ euint256.unwrap(asEuint256(upperBound)),
392
+ ETypes.Uint256
393
+ )
394
+ );
324
395
  }
325
396
 
326
397
  function randBounded(euint256 upperBound) internal returns (euint256) {
327
- return euint256.wrap(inco.eRandBounded(euint256.unwrap(s(upperBound)), ETypes.Uint256));
398
+ return
399
+ euint256.wrap(
400
+ inco.eRandBounded(
401
+ euint256.unwrap(s(upperBound)),
402
+ ETypes.Uint256
403
+ )
404
+ );
328
405
  }
329
406
 
330
407
  function asEuint256(uint256 a) internal returns (euint256) {
@@ -343,11 +420,17 @@ library e {
343
420
  return euint256.wrap(inco.eCast(ebool.unwrap(a), ETypes.Uint256));
344
421
  }
345
422
 
346
- function newEuint256(bytes memory ciphertext, address user) internal returns (euint256) {
423
+ function newEuint256(
424
+ bytes memory ciphertext,
425
+ address user
426
+ ) internal returns (euint256) {
347
427
  return inco.newEuint256(ciphertext, user);
348
428
  }
349
429
 
350
- function newEbool(bytes memory ciphertext, address user) internal returns (ebool) {
430
+ function newEbool(
431
+ bytes memory ciphertext,
432
+ address user
433
+ ) internal returns (ebool) {
351
434
  return inco.newEbool(ciphertext, user);
352
435
  }
353
436
 
@@ -371,19 +454,59 @@ library e {
371
454
  return inco.isAllowed(euint256.unwrap(a), user);
372
455
  }
373
456
 
374
- function select(ebool control, euint256 ifTrue, euint256 ifFalse) internal returns (euint256) {
375
- return euint256.wrap(inco.eIfThenElse(s(control), euint256.unwrap(s(ifTrue)), euint256.unwrap(s(ifFalse))));
376
- }
377
-
378
- function select(ebool control, ebool ifTrue, ebool ifFalse) internal returns (ebool) {
379
- return ebool.wrap(inco.eIfThenElse(s(control), ebool.unwrap(s(ifTrue)), ebool.unwrap(s(ifFalse))));
380
- }
381
-
382
- function requestDecryption(euint256 a, bytes4 callbackSelector, bytes memory callbackData) internal returns (uint256 requestId) {
383
- requestId = inco.requestDecryption(callbackSelector, block.timestamp + defaultDecryptionDelayLimit, euint256.unwrap(s(a)), callbackData);
384
- }
385
-
386
- function requestDecryption(ebool a, bytes4 callbackSelector, bytes memory callbackData) internal returns (uint256 requestId) {
387
- requestId = inco.requestDecryption(callbackSelector, block.timestamp + defaultDecryptionDelayLimit, ebool.unwrap(s(a)), callbackData);
388
- }
389
- }
457
+ function select(
458
+ ebool control,
459
+ euint256 ifTrue,
460
+ euint256 ifFalse
461
+ ) internal returns (euint256) {
462
+ return
463
+ euint256.wrap(
464
+ inco.eIfThenElse(
465
+ s(control),
466
+ euint256.unwrap(s(ifTrue)),
467
+ euint256.unwrap(s(ifFalse))
468
+ )
469
+ );
470
+ }
471
+
472
+ function select(
473
+ ebool control,
474
+ ebool ifTrue,
475
+ ebool ifFalse
476
+ ) internal returns (ebool) {
477
+ return
478
+ ebool.wrap(
479
+ inco.eIfThenElse(
480
+ s(control),
481
+ ebool.unwrap(s(ifTrue)),
482
+ ebool.unwrap(s(ifFalse))
483
+ )
484
+ );
485
+ }
486
+
487
+ function requestDecryption(
488
+ euint256 a,
489
+ bytes4 callbackSelector,
490
+ bytes memory callbackData
491
+ ) internal returns (uint256 requestId) {
492
+ requestId = inco.requestDecryption(
493
+ callbackSelector,
494
+ block.timestamp + defaultDecryptionDelayLimit,
495
+ euint256.unwrap(s(a)),
496
+ callbackData
497
+ );
498
+ }
499
+
500
+ function requestDecryption(
501
+ ebool a,
502
+ bytes4 callbackSelector,
503
+ bytes memory callbackData
504
+ ) internal returns (uint256 requestId) {
505
+ requestId = inco.requestDecryption(
506
+ callbackSelector,
507
+ block.timestamp + defaultDecryptionDelayLimit,
508
+ ebool.unwrap(s(a)),
509
+ callbackData
510
+ );
511
+ }
512
+ }
package/foundry.toml DELETED
@@ -1,20 +0,0 @@
1
- [profile.default]
2
- src = 'src'
3
- test = 'src'
4
- cache_path = 'out/foundry-cache'
5
- allow_paths = ['../../', "out/*", "broadcast/*"]
6
- evm_version = 'cancun'
7
- solc = '0.8.28'
8
- extra_output = ["storageLayout", "abi", "evm.methodIdentifiers"]
9
- ffi = true
10
- ast = true
11
- build_info = true
12
- fs_permissions = [
13
- { access = "read", path = "./" },
14
- { access = "read-write", path = "./fixtures" },
15
- { access = "write", path = "out/" },
16
- { access = "read-write", path = "deployments/" },
17
- { access = "read-write", path = "src/generated/" },
18
- ]
19
- optimizer = true
20
- optimizer-runs = 10_000_000
package/remappings.txt DELETED
@@ -1,4 +0,0 @@
1
- @openzeppelin/=../../node_modules/@openzeppelin/
2
- forge-std/=../../node_modules/forge-std/src/
3
- ds-test/=../../node_modules/ds-test/src/
4
- @inco/=../