@inco/lightning 0.6.1 → 0.6.5
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 +1 -1
- package/src/DeployUtils.sol +1 -1
- package/src/Errors.sol +1 -1
- package/src/Lib.alphanet.sol +24 -3
- package/src/Lib.demonet.sol +24 -3
- package/src/Lib.devnet.sol +24 -3
- package/src/Lib.sol +24 -3
- package/src/Lib.template.sol +97 -20
- package/src/Lib.testnet.sol +24 -3
- package/src/libs/incoLightning_alphanet_v0_297966649.sol +24 -3
- package/src/libs/incoLightning_alphanet_v1_725458969.sol +24 -3
- package/src/libs/incoLightning_demonet_v0_863421733.sol +24 -3
- package/src/libs/incoLightning_devnet_v0_340846814.sol +24 -3
- package/src/libs/incoLightning_devnet_v1_904635675.sol +24 -3
- package/src/libs/incoLightning_testnet_v0_183408998.sol +24 -3
- package/src/lightning-parts/AccessControl/test/TestAdvancedAccessControl.t.sol +1 -1
- package/src/lightning-parts/EncryptedInput.sol +52 -16
- package/src/lightning-parts/EncryptedOperations.sol +86 -90
- package/src/lightning-parts/TEELifecycle.sol +153 -66
- package/src/lightning-parts/TEELifecycle.types.sol +7 -0
- package/src/lightning-parts/interfaces/ITEELifecycle.sol +13 -2
- package/src/lightning-parts/primitives/HandleGeneration.sol +23 -57
- package/src/lightning-parts/primitives/interfaces/IHandleGeneration.sol +3 -34
- package/src/lightning-parts/test/HandleMetadata.t.sol +41 -4
- package/src/lightning-parts/test/InputsFee.t.sol +14 -21
- package/src/lightning-parts/test/TestDecryptionAttestationInSynchronousFlow.t.sol +6 -2
- package/src/shared/IOwnable.sol +10 -0
- package/src/shared/IUUPSUpgradable.sol +10 -0
- package/src/shared/JsonUtils.sol +16 -0
- package/src/shared/TestUtils.sol +50 -0
- package/src/shared/TypeUtils.sol +12 -0
- package/src/test/FakeIncoInfra/FakeComputeServer.sol +1 -1
- package/src/test/FakeIncoInfra/FakeDecryptionAttester.sol +36 -34
- package/src/test/FakeIncoInfra/FakeIncoInfraBase.sol +33 -18
- package/src/test/FakeIncoInfra/KVStore.sol +1 -1
- package/src/test/FakeIncoInfra/MockOpHandler.sol +5 -5
- package/src/test/FakeIncoInfra/MockRemoteAttestation.sol +1 -1
- package/src/test/IncoTest.sol +1 -1
- package/src/test/TEELifecycle/TEELifecycleMockTest.t.sol +73 -20
- package/src/test/TestAddTwo.t.sol +1 -1
- package/src/test/TestFakeInfra.t.sol +13 -3
- package/src/version/Version.sol +4 -0
- package/src/version/interfaces/IVersion.sol +1 -0
package/package.json
CHANGED
package/src/DeployUtils.sol
CHANGED
package/src/Errors.sol
CHANGED
package/src/Lib.alphanet.sol
CHANGED
|
@@ -388,17 +388,38 @@ library e {
|
|
|
388
388
|
return euint256.wrap(inco.eCast(ebool.unwrap(a), ETypes.Uint256));
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
/// @
|
|
391
|
+
/// @notice Creates a new encrypted uint256 assuming msg.sender is the user
|
|
392
|
+
/// @dev costs the inco fee
|
|
393
|
+
function newEuint256(bytes memory ciphertext) internal returns (euint256) {
|
|
394
|
+
return newEuint256(ciphertext, msg.sender);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/// @notice Creates a new encrypted uint256 for the given user.
|
|
398
|
+
/// @dev costs the inco fee
|
|
392
399
|
function newEuint256(bytes memory ciphertext, address user) internal returns (euint256) {
|
|
393
400
|
return inco.newEuint256{value: inco.getFee()}(ciphertext, user);
|
|
394
401
|
}
|
|
395
402
|
|
|
396
|
-
/// @
|
|
403
|
+
/// @notice Creates a new encrypted bool assuming msg.sender is the user
|
|
404
|
+
/// @dev costs the inco fee
|
|
405
|
+
function newEbool(bytes memory ciphertext) internal returns (ebool) {
|
|
406
|
+
return newEbool(ciphertext, msg.sender);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/// @notice Creates a new encrypted bool for the given user.
|
|
410
|
+
/// @dev costs the inco fee
|
|
397
411
|
function newEbool(bytes memory ciphertext, address user) internal returns (ebool) {
|
|
398
412
|
return inco.newEbool{value: inco.getFee()}(ciphertext, user);
|
|
399
413
|
}
|
|
400
414
|
|
|
401
|
-
/// @
|
|
415
|
+
/// @notice Creates a new encrypted address assuming msg.sender is the user
|
|
416
|
+
/// @dev costs the inco fee
|
|
417
|
+
function newEaddress(bytes memory ciphertext) internal returns (eaddress) {
|
|
418
|
+
return newEaddress(ciphertext, msg.sender);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/// @notice Creates a new encrypted address for the given user.
|
|
422
|
+
/// @dev costs the inco fee
|
|
402
423
|
function newEaddress(bytes memory ciphertext, address user) internal returns (eaddress) {
|
|
403
424
|
return inco.newEaddress{value: inco.getFee()}(ciphertext, user);
|
|
404
425
|
}
|
package/src/Lib.demonet.sol
CHANGED
|
@@ -388,17 +388,38 @@ library e {
|
|
|
388
388
|
return euint256.wrap(inco.eCast(ebool.unwrap(a), ETypes.Uint256));
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
/// @
|
|
391
|
+
/// @notice Creates a new encrypted uint256 assuming msg.sender is the user
|
|
392
|
+
/// @dev costs the inco fee
|
|
393
|
+
function newEuint256(bytes memory ciphertext) internal returns (euint256) {
|
|
394
|
+
return newEuint256(ciphertext, msg.sender);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/// @notice Creates a new encrypted uint256 for the given user.
|
|
398
|
+
/// @dev costs the inco fee
|
|
392
399
|
function newEuint256(bytes memory ciphertext, address user) internal returns (euint256) {
|
|
393
400
|
return inco.newEuint256{value: inco.getFee()}(ciphertext, user);
|
|
394
401
|
}
|
|
395
402
|
|
|
396
|
-
/// @
|
|
403
|
+
/// @notice Creates a new encrypted bool assuming msg.sender is the user
|
|
404
|
+
/// @dev costs the inco fee
|
|
405
|
+
function newEbool(bytes memory ciphertext) internal returns (ebool) {
|
|
406
|
+
return newEbool(ciphertext, msg.sender);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/// @notice Creates a new encrypted bool for the given user.
|
|
410
|
+
/// @dev costs the inco fee
|
|
397
411
|
function newEbool(bytes memory ciphertext, address user) internal returns (ebool) {
|
|
398
412
|
return inco.newEbool{value: inco.getFee()}(ciphertext, user);
|
|
399
413
|
}
|
|
400
414
|
|
|
401
|
-
/// @
|
|
415
|
+
/// @notice Creates a new encrypted address assuming msg.sender is the user
|
|
416
|
+
/// @dev costs the inco fee
|
|
417
|
+
function newEaddress(bytes memory ciphertext) internal returns (eaddress) {
|
|
418
|
+
return newEaddress(ciphertext, msg.sender);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/// @notice Creates a new encrypted address for the given user.
|
|
422
|
+
/// @dev costs the inco fee
|
|
402
423
|
function newEaddress(bytes memory ciphertext, address user) internal returns (eaddress) {
|
|
403
424
|
return inco.newEaddress{value: inco.getFee()}(ciphertext, user);
|
|
404
425
|
}
|
package/src/Lib.devnet.sol
CHANGED
|
@@ -388,17 +388,38 @@ library e {
|
|
|
388
388
|
return euint256.wrap(inco.eCast(ebool.unwrap(a), ETypes.Uint256));
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
/// @
|
|
391
|
+
/// @notice Creates a new encrypted uint256 assuming msg.sender is the user
|
|
392
|
+
/// @dev costs the inco fee
|
|
393
|
+
function newEuint256(bytes memory ciphertext) internal returns (euint256) {
|
|
394
|
+
return newEuint256(ciphertext, msg.sender);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/// @notice Creates a new encrypted uint256 for the given user.
|
|
398
|
+
/// @dev costs the inco fee
|
|
392
399
|
function newEuint256(bytes memory ciphertext, address user) internal returns (euint256) {
|
|
393
400
|
return inco.newEuint256{value: inco.getFee()}(ciphertext, user);
|
|
394
401
|
}
|
|
395
402
|
|
|
396
|
-
/// @
|
|
403
|
+
/// @notice Creates a new encrypted bool assuming msg.sender is the user
|
|
404
|
+
/// @dev costs the inco fee
|
|
405
|
+
function newEbool(bytes memory ciphertext) internal returns (ebool) {
|
|
406
|
+
return newEbool(ciphertext, msg.sender);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/// @notice Creates a new encrypted bool for the given user.
|
|
410
|
+
/// @dev costs the inco fee
|
|
397
411
|
function newEbool(bytes memory ciphertext, address user) internal returns (ebool) {
|
|
398
412
|
return inco.newEbool{value: inco.getFee()}(ciphertext, user);
|
|
399
413
|
}
|
|
400
414
|
|
|
401
|
-
/// @
|
|
415
|
+
/// @notice Creates a new encrypted address assuming msg.sender is the user
|
|
416
|
+
/// @dev costs the inco fee
|
|
417
|
+
function newEaddress(bytes memory ciphertext) internal returns (eaddress) {
|
|
418
|
+
return newEaddress(ciphertext, msg.sender);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/// @notice Creates a new encrypted address for the given user.
|
|
422
|
+
/// @dev costs the inco fee
|
|
402
423
|
function newEaddress(bytes memory ciphertext, address user) internal returns (eaddress) {
|
|
403
424
|
return inco.newEaddress{value: inco.getFee()}(ciphertext, user);
|
|
404
425
|
}
|
package/src/Lib.sol
CHANGED
|
@@ -388,17 +388,38 @@ library e {
|
|
|
388
388
|
return euint256.wrap(inco.eCast(ebool.unwrap(a), ETypes.Uint256));
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
/// @
|
|
391
|
+
/// @notice Creates a new encrypted uint256 assuming msg.sender is the user
|
|
392
|
+
/// @dev costs the inco fee
|
|
393
|
+
function newEuint256(bytes memory ciphertext) internal returns (euint256) {
|
|
394
|
+
return newEuint256(ciphertext, msg.sender);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/// @notice Creates a new encrypted uint256 for the given user.
|
|
398
|
+
/// @dev costs the inco fee
|
|
392
399
|
function newEuint256(bytes memory ciphertext, address user) internal returns (euint256) {
|
|
393
400
|
return inco.newEuint256{value: inco.getFee()}(ciphertext, user);
|
|
394
401
|
}
|
|
395
402
|
|
|
396
|
-
/// @
|
|
403
|
+
/// @notice Creates a new encrypted bool assuming msg.sender is the user
|
|
404
|
+
/// @dev costs the inco fee
|
|
405
|
+
function newEbool(bytes memory ciphertext) internal returns (ebool) {
|
|
406
|
+
return newEbool(ciphertext, msg.sender);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/// @notice Creates a new encrypted bool for the given user.
|
|
410
|
+
/// @dev costs the inco fee
|
|
397
411
|
function newEbool(bytes memory ciphertext, address user) internal returns (ebool) {
|
|
398
412
|
return inco.newEbool{value: inco.getFee()}(ciphertext, user);
|
|
399
413
|
}
|
|
400
414
|
|
|
401
|
-
/// @
|
|
415
|
+
/// @notice Creates a new encrypted address assuming msg.sender is the user
|
|
416
|
+
/// @dev costs the inco fee
|
|
417
|
+
function newEaddress(bytes memory ciphertext) internal returns (eaddress) {
|
|
418
|
+
return newEaddress(ciphertext, msg.sender);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/// @notice Creates a new encrypted address for the given user.
|
|
422
|
+
/// @dev costs the inco fee
|
|
402
423
|
function newEaddress(bytes memory ciphertext, address user) internal returns (eaddress) {
|
|
403
424
|
return inco.newEaddress{value: inco.getFee()}(ciphertext, user);
|
|
404
425
|
}
|
package/src/Lib.template.sol
CHANGED
|
@@ -51,9 +51,11 @@ library e {
|
|
|
51
51
|
function add(euint256 a, euint256 b) internal returns (euint256) {
|
|
52
52
|
return inco.eAdd(s(a), s(b));
|
|
53
53
|
}
|
|
54
|
+
|
|
54
55
|
function add(euint256 a, uint256 b) internal returns (euint256) {
|
|
55
56
|
return inco.eAdd(s(a), asEuint256(b));
|
|
56
57
|
}
|
|
58
|
+
|
|
57
59
|
function add(uint256 a, euint256 b) internal returns (euint256) {
|
|
58
60
|
return inco.eAdd(asEuint256(a), s(b));
|
|
59
61
|
}
|
|
@@ -61,9 +63,11 @@ library e {
|
|
|
61
63
|
function sub(euint256 a, euint256 b) internal returns (euint256) {
|
|
62
64
|
return inco.eSub(s(a), s(b));
|
|
63
65
|
}
|
|
66
|
+
|
|
64
67
|
function sub(euint256 a, uint256 b) internal returns (euint256) {
|
|
65
68
|
return inco.eSub(s(a), asEuint256(b));
|
|
66
69
|
}
|
|
70
|
+
|
|
67
71
|
function sub(uint256 a, euint256 b) internal returns (euint256) {
|
|
68
72
|
return inco.eSub(asEuint256(a), s(b));
|
|
69
73
|
}
|
|
@@ -71,9 +75,11 @@ library e {
|
|
|
71
75
|
function mul(euint256 a, euint256 b) internal returns (euint256) {
|
|
72
76
|
return inco.eMul(s(a), s(b));
|
|
73
77
|
}
|
|
78
|
+
|
|
74
79
|
function mul(euint256 a, uint256 b) internal returns (euint256) {
|
|
75
80
|
return inco.eMul(s(a), asEuint256(b));
|
|
76
81
|
}
|
|
82
|
+
|
|
77
83
|
function mul(uint256 a, euint256 b) internal returns (euint256) {
|
|
78
84
|
return inco.eMul(asEuint256(a), s(b));
|
|
79
85
|
}
|
|
@@ -81,9 +87,11 @@ library e {
|
|
|
81
87
|
function div(euint256 a, euint256 b) internal returns (euint256) {
|
|
82
88
|
return inco.eDiv(s(a), s(b));
|
|
83
89
|
}
|
|
90
|
+
|
|
84
91
|
function div(euint256 a, uint256 b) internal returns (euint256) {
|
|
85
92
|
return inco.eDiv(s(a), asEuint256(b));
|
|
86
93
|
}
|
|
94
|
+
|
|
87
95
|
function div(uint256 a, euint256 b) internal returns (euint256) {
|
|
88
96
|
return inco.eDiv(asEuint256(a), s(b));
|
|
89
97
|
}
|
|
@@ -91,31 +99,35 @@ library e {
|
|
|
91
99
|
function rem(euint256 a, euint256 b) internal returns (euint256) {
|
|
92
100
|
return inco.eRem(s(a), s(b));
|
|
93
101
|
}
|
|
102
|
+
|
|
94
103
|
function rem(euint256 a, uint256 b) internal returns (euint256) {
|
|
95
104
|
return inco.eRem(s(a), asEuint256(b));
|
|
96
105
|
}
|
|
106
|
+
|
|
97
107
|
function rem(uint256 a, euint256 b) internal returns (euint256) {
|
|
98
108
|
return inco.eRem(asEuint256(a), s(b));
|
|
99
109
|
}
|
|
100
110
|
|
|
101
111
|
function and(euint256 a, euint256 b) internal returns (euint256) {
|
|
102
112
|
return
|
|
103
|
-
|
|
113
|
+
euint256.wrap(
|
|
104
114
|
inco.eBitAnd(euint256.unwrap(s(a)), euint256.unwrap(s(b)))
|
|
105
115
|
);
|
|
106
116
|
}
|
|
117
|
+
|
|
107
118
|
function and(euint256 a, uint256 b) internal returns (euint256) {
|
|
108
119
|
return
|
|
109
|
-
|
|
120
|
+
euint256.wrap(
|
|
110
121
|
inco.eBitAnd(
|
|
111
122
|
euint256.unwrap(s(a)),
|
|
112
123
|
euint256.unwrap(asEuint256(b))
|
|
113
124
|
)
|
|
114
125
|
);
|
|
115
126
|
}
|
|
127
|
+
|
|
116
128
|
function and(uint256 a, euint256 b) internal returns (euint256) {
|
|
117
129
|
return
|
|
118
|
-
|
|
130
|
+
euint256.wrap(
|
|
119
131
|
inco.eBitAnd(
|
|
120
132
|
euint256.unwrap(asEuint256(a)),
|
|
121
133
|
euint256.unwrap(s(b))
|
|
@@ -126,37 +138,41 @@ library e {
|
|
|
126
138
|
function and(ebool a, ebool b) internal returns (ebool) {
|
|
127
139
|
return ebool.wrap(inco.eBitAnd(ebool.unwrap(s(a)), ebool.unwrap(s(b))));
|
|
128
140
|
}
|
|
141
|
+
|
|
129
142
|
function and(ebool a, bool b) internal returns (ebool) {
|
|
130
143
|
return
|
|
131
|
-
|
|
144
|
+
ebool.wrap(
|
|
132
145
|
inco.eBitAnd(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b)))
|
|
133
146
|
);
|
|
134
147
|
}
|
|
148
|
+
|
|
135
149
|
function and(bool a, ebool b) internal returns (ebool) {
|
|
136
150
|
return
|
|
137
|
-
|
|
151
|
+
ebool.wrap(
|
|
138
152
|
inco.eBitAnd(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b)))
|
|
139
153
|
);
|
|
140
154
|
}
|
|
141
155
|
|
|
142
156
|
function or(euint256 a, euint256 b) internal returns (euint256) {
|
|
143
157
|
return
|
|
144
|
-
|
|
158
|
+
euint256.wrap(
|
|
145
159
|
inco.eBitOr(euint256.unwrap(s(a)), euint256.unwrap(s(b)))
|
|
146
160
|
);
|
|
147
161
|
}
|
|
162
|
+
|
|
148
163
|
function or(euint256 a, uint256 b) internal returns (euint256) {
|
|
149
164
|
return
|
|
150
|
-
|
|
165
|
+
euint256.wrap(
|
|
151
166
|
inco.eBitOr(
|
|
152
167
|
euint256.unwrap(s(a)),
|
|
153
168
|
euint256.unwrap(asEuint256(b))
|
|
154
169
|
)
|
|
155
170
|
);
|
|
156
171
|
}
|
|
172
|
+
|
|
157
173
|
function or(uint256 a, euint256 b) internal returns (euint256) {
|
|
158
174
|
return
|
|
159
|
-
|
|
175
|
+
euint256.wrap(
|
|
160
176
|
inco.eBitOr(
|
|
161
177
|
euint256.unwrap(asEuint256(a)),
|
|
162
178
|
euint256.unwrap(s(b))
|
|
@@ -167,37 +183,41 @@ library e {
|
|
|
167
183
|
function or(ebool a, ebool b) internal returns (ebool) {
|
|
168
184
|
return ebool.wrap(inco.eBitOr(ebool.unwrap(s(a)), ebool.unwrap(s(b))));
|
|
169
185
|
}
|
|
186
|
+
|
|
170
187
|
function or(ebool a, bool b) internal returns (ebool) {
|
|
171
188
|
return
|
|
172
|
-
|
|
189
|
+
ebool.wrap(
|
|
173
190
|
inco.eBitOr(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b)))
|
|
174
191
|
);
|
|
175
192
|
}
|
|
193
|
+
|
|
176
194
|
function or(bool a, ebool b) internal returns (ebool) {
|
|
177
195
|
return
|
|
178
|
-
|
|
196
|
+
ebool.wrap(
|
|
179
197
|
inco.eBitOr(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b)))
|
|
180
198
|
);
|
|
181
199
|
}
|
|
182
200
|
|
|
183
201
|
function xor(euint256 a, euint256 b) internal returns (euint256) {
|
|
184
202
|
return
|
|
185
|
-
|
|
203
|
+
euint256.wrap(
|
|
186
204
|
inco.eBitXor(euint256.unwrap(s(a)), euint256.unwrap(s(b)))
|
|
187
205
|
);
|
|
188
206
|
}
|
|
207
|
+
|
|
189
208
|
function xor(euint256 a, uint256 b) internal returns (euint256) {
|
|
190
209
|
return
|
|
191
|
-
|
|
210
|
+
euint256.wrap(
|
|
192
211
|
inco.eBitXor(
|
|
193
212
|
euint256.unwrap(s(a)),
|
|
194
213
|
euint256.unwrap(asEuint256(b))
|
|
195
214
|
)
|
|
196
215
|
);
|
|
197
216
|
}
|
|
217
|
+
|
|
198
218
|
function xor(uint256 a, euint256 b) internal returns (euint256) {
|
|
199
219
|
return
|
|
200
|
-
|
|
220
|
+
euint256.wrap(
|
|
201
221
|
inco.eBitXor(
|
|
202
222
|
euint256.unwrap(asEuint256(a)),
|
|
203
223
|
euint256.unwrap(s(b))
|
|
@@ -208,15 +228,17 @@ library e {
|
|
|
208
228
|
function xor(ebool a, ebool b) internal returns (ebool) {
|
|
209
229
|
return ebool.wrap(inco.eBitXor(ebool.unwrap(s(a)), ebool.unwrap(s(b))));
|
|
210
230
|
}
|
|
231
|
+
|
|
211
232
|
function xor(ebool a, bool b) internal returns (ebool) {
|
|
212
233
|
return
|
|
213
|
-
|
|
234
|
+
ebool.wrap(
|
|
214
235
|
inco.eBitXor(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b)))
|
|
215
236
|
);
|
|
216
237
|
}
|
|
238
|
+
|
|
217
239
|
function xor(bool a, ebool b) internal returns (ebool) {
|
|
218
240
|
return
|
|
219
|
-
|
|
241
|
+
ebool.wrap(
|
|
220
242
|
inco.eBitXor(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b)))
|
|
221
243
|
);
|
|
222
244
|
}
|
|
@@ -224,9 +246,11 @@ library e {
|
|
|
224
246
|
function shl(euint256 a, euint256 b) internal returns (euint256) {
|
|
225
247
|
return inco.eShl(s(a), s(b));
|
|
226
248
|
}
|
|
249
|
+
|
|
227
250
|
function shl(euint256 a, uint256 b) internal returns (euint256) {
|
|
228
251
|
return inco.eShl(s(a), asEuint256(b));
|
|
229
252
|
}
|
|
253
|
+
|
|
230
254
|
function shl(uint256 a, euint256 b) internal returns (euint256) {
|
|
231
255
|
return inco.eShl(asEuint256(a), s(b));
|
|
232
256
|
}
|
|
@@ -234,9 +258,11 @@ library e {
|
|
|
234
258
|
function shr(euint256 a, euint256 b) internal returns (euint256) {
|
|
235
259
|
return inco.eShr(s(a), s(b));
|
|
236
260
|
}
|
|
261
|
+
|
|
237
262
|
function shr(euint256 a, uint256 b) internal returns (euint256) {
|
|
238
263
|
return inco.eShr(s(a), asEuint256(b));
|
|
239
264
|
}
|
|
265
|
+
|
|
240
266
|
function shr(uint256 a, euint256 b) internal returns (euint256) {
|
|
241
267
|
return inco.eShr(asEuint256(a), s(b));
|
|
242
268
|
}
|
|
@@ -244,9 +270,11 @@ library e {
|
|
|
244
270
|
function rotl(euint256 a, euint256 b) internal returns (euint256) {
|
|
245
271
|
return inco.eRotl(s(a), s(b));
|
|
246
272
|
}
|
|
273
|
+
|
|
247
274
|
function rotl(euint256 a, uint256 b) internal returns (euint256) {
|
|
248
275
|
return inco.eRotl(s(a), asEuint256(b));
|
|
249
276
|
}
|
|
277
|
+
|
|
250
278
|
function rotl(uint256 a, euint256 b) internal returns (euint256) {
|
|
251
279
|
return inco.eRotl(asEuint256(a), s(b));
|
|
252
280
|
}
|
|
@@ -254,9 +282,11 @@ library e {
|
|
|
254
282
|
function rotr(euint256 a, euint256 b) internal returns (euint256) {
|
|
255
283
|
return inco.eRotr(s(a), s(b));
|
|
256
284
|
}
|
|
285
|
+
|
|
257
286
|
function rotr(euint256 a, uint256 b) internal returns (euint256) {
|
|
258
287
|
return inco.eRotr(s(a), asEuint256(b));
|
|
259
288
|
}
|
|
289
|
+
|
|
260
290
|
function rotr(uint256 a, euint256 b) internal returns (euint256) {
|
|
261
291
|
return inco.eRotr(asEuint256(a), s(b));
|
|
262
292
|
}
|
|
@@ -264,9 +294,11 @@ library e {
|
|
|
264
294
|
function eq(euint256 a, euint256 b) internal returns (ebool) {
|
|
265
295
|
return inco.eEq(euint256.unwrap(s(a)), euint256.unwrap(s(b)));
|
|
266
296
|
}
|
|
297
|
+
|
|
267
298
|
function eq(euint256 a, uint256 b) internal returns (ebool) {
|
|
268
299
|
return inco.eEq(euint256.unwrap(s(a)), euint256.unwrap(asEuint256(b)));
|
|
269
300
|
}
|
|
301
|
+
|
|
270
302
|
function eq(uint256 a, euint256 b) internal returns (ebool) {
|
|
271
303
|
return inco.eEq(euint256.unwrap(asEuint256(a)), euint256.unwrap(s(b)));
|
|
272
304
|
}
|
|
@@ -274,9 +306,11 @@ library e {
|
|
|
274
306
|
function eq(eaddress a, address b) internal returns (ebool) {
|
|
275
307
|
return inco.eEq(eaddress.unwrap(s(a)), eaddress.unwrap(asEaddress(b)));
|
|
276
308
|
}
|
|
309
|
+
|
|
277
310
|
function eq(eaddress a, eaddress b) internal returns (ebool) {
|
|
278
311
|
return inco.eEq(eaddress.unwrap(s(a)), eaddress.unwrap(s(b)));
|
|
279
312
|
}
|
|
313
|
+
|
|
280
314
|
function eq(address a, eaddress b) internal returns (ebool) {
|
|
281
315
|
return inco.eEq(eaddress.unwrap(asEaddress(a)), eaddress.unwrap(s(b)));
|
|
282
316
|
}
|
|
@@ -284,9 +318,11 @@ library e {
|
|
|
284
318
|
function ne(euint256 a, euint256 b) internal returns (ebool) {
|
|
285
319
|
return inco.eNe(euint256.unwrap(s(a)), euint256.unwrap(s(b)));
|
|
286
320
|
}
|
|
321
|
+
|
|
287
322
|
function ne(euint256 a, uint256 b) internal returns (ebool) {
|
|
288
323
|
return inco.eNe(euint256.unwrap(s(a)), euint256.unwrap(asEuint256(b)));
|
|
289
324
|
}
|
|
325
|
+
|
|
290
326
|
function ne(uint256 a, euint256 b) internal returns (ebool) {
|
|
291
327
|
return inco.eNe(euint256.unwrap(asEuint256(a)), euint256.unwrap(s(b)));
|
|
292
328
|
}
|
|
@@ -294,9 +330,11 @@ library e {
|
|
|
294
330
|
function ne(eaddress a, eaddress b) internal returns (ebool) {
|
|
295
331
|
return inco.eNe(eaddress.unwrap(s(a)), eaddress.unwrap(s(b)));
|
|
296
332
|
}
|
|
333
|
+
|
|
297
334
|
function ne(eaddress a, address b) internal returns (ebool) {
|
|
298
335
|
return inco.eNe(eaddress.unwrap(s(a)), eaddress.unwrap(asEaddress(b)));
|
|
299
336
|
}
|
|
337
|
+
|
|
300
338
|
function ne(address a, eaddress b) internal returns (ebool) {
|
|
301
339
|
return inco.eNe(eaddress.unwrap(asEaddress(a)), eaddress.unwrap(s(b)));
|
|
302
340
|
}
|
|
@@ -304,9 +342,11 @@ library e {
|
|
|
304
342
|
function ge(euint256 a, euint256 b) internal returns (ebool) {
|
|
305
343
|
return inco.eGe(s(a), s(b));
|
|
306
344
|
}
|
|
345
|
+
|
|
307
346
|
function ge(euint256 a, uint256 b) internal returns (ebool) {
|
|
308
347
|
return inco.eGe(s(a), asEuint256(b));
|
|
309
348
|
}
|
|
349
|
+
|
|
310
350
|
function ge(uint256 a, euint256 b) internal returns (ebool) {
|
|
311
351
|
return inco.eGe(asEuint256(a), s(b));
|
|
312
352
|
}
|
|
@@ -314,9 +354,11 @@ library e {
|
|
|
314
354
|
function gt(euint256 a, euint256 b) internal returns (ebool) {
|
|
315
355
|
return inco.eGt(s(a), s(b));
|
|
316
356
|
}
|
|
357
|
+
|
|
317
358
|
function gt(euint256 a, uint256 b) internal returns (ebool) {
|
|
318
359
|
return inco.eGt(s(a), asEuint256(b));
|
|
319
360
|
}
|
|
361
|
+
|
|
320
362
|
function gt(uint256 a, euint256 b) internal returns (ebool) {
|
|
321
363
|
return inco.eGt(asEuint256(a), s(b));
|
|
322
364
|
}
|
|
@@ -324,9 +366,11 @@ library e {
|
|
|
324
366
|
function le(euint256 a, euint256 b) internal returns (ebool) {
|
|
325
367
|
return inco.eLe(s(a), s(b));
|
|
326
368
|
}
|
|
369
|
+
|
|
327
370
|
function le(euint256 a, uint256 b) internal returns (ebool) {
|
|
328
371
|
return inco.eLe(s(a), asEuint256(b));
|
|
329
372
|
}
|
|
373
|
+
|
|
330
374
|
function le(uint256 a, euint256 b) internal returns (ebool) {
|
|
331
375
|
return inco.eLe(asEuint256(a), s(b));
|
|
332
376
|
}
|
|
@@ -334,9 +378,11 @@ library e {
|
|
|
334
378
|
function lt(euint256 a, euint256 b) internal returns (ebool) {
|
|
335
379
|
return inco.eLt(s(a), s(b));
|
|
336
380
|
}
|
|
381
|
+
|
|
337
382
|
function lt(euint256 a, uint256 b) internal returns (ebool) {
|
|
338
383
|
return inco.eLt(s(a), asEuint256(b));
|
|
339
384
|
}
|
|
385
|
+
|
|
340
386
|
function lt(uint256 a, euint256 b) internal returns (ebool) {
|
|
341
387
|
return inco.eLt(asEuint256(a), s(b));
|
|
342
388
|
}
|
|
@@ -344,9 +390,11 @@ library e {
|
|
|
344
390
|
function min(euint256 a, euint256 b) internal returns (euint256) {
|
|
345
391
|
return inco.eMin(s(a), s(b));
|
|
346
392
|
}
|
|
393
|
+
|
|
347
394
|
function min(euint256 a, uint256 b) internal returns (euint256) {
|
|
348
395
|
return inco.eMin(s(a), asEuint256(b));
|
|
349
396
|
}
|
|
397
|
+
|
|
350
398
|
function min(uint256 a, euint256 b) internal returns (euint256) {
|
|
351
399
|
return inco.eMin(asEuint256(a), s(b));
|
|
352
400
|
}
|
|
@@ -354,9 +402,11 @@ library e {
|
|
|
354
402
|
function max(euint256 a, euint256 b) internal returns (euint256) {
|
|
355
403
|
return inco.eMax(s(a), s(b));
|
|
356
404
|
}
|
|
405
|
+
|
|
357
406
|
function max(euint256 a, uint256 b) internal returns (euint256) {
|
|
358
407
|
return inco.eMax(s(a), asEuint256(b));
|
|
359
408
|
}
|
|
409
|
+
|
|
360
410
|
function max(uint256 a, euint256 b) internal returns (euint256) {
|
|
361
411
|
return inco.eMax(asEuint256(a), s(b));
|
|
362
412
|
}
|
|
@@ -373,7 +423,7 @@ library e {
|
|
|
373
423
|
/// @dev costs the inco fee
|
|
374
424
|
function randBounded(uint256 upperBound) internal returns (euint256) {
|
|
375
425
|
return
|
|
376
|
-
|
|
426
|
+
euint256.wrap(
|
|
377
427
|
inco.eRandBounded{value: inco.getFee()}(
|
|
378
428
|
euint256.unwrap(asEuint256(upperBound)),
|
|
379
429
|
ETypes.Uint256
|
|
@@ -384,7 +434,7 @@ library e {
|
|
|
384
434
|
/// @dev costs the inco fee
|
|
385
435
|
function randBounded(euint256 upperBound) internal returns (euint256) {
|
|
386
436
|
return
|
|
387
|
-
|
|
437
|
+
euint256.wrap(
|
|
388
438
|
inco.eRandBounded{value: inco.getFee()}(
|
|
389
439
|
euint256.unwrap(s(upperBound)),
|
|
390
440
|
ETypes.Uint256
|
|
@@ -412,6 +462,15 @@ library e {
|
|
|
412
462
|
return euint256.wrap(inco.eCast(ebool.unwrap(a), ETypes.Uint256));
|
|
413
463
|
}
|
|
414
464
|
|
|
465
|
+
/// @notice Creates a new encrypted uint256 assuming msg.sender is the user
|
|
466
|
+
/// @dev costs the inco fee
|
|
467
|
+
function newEuint256(
|
|
468
|
+
bytes memory ciphertext
|
|
469
|
+
) internal returns (euint256) {
|
|
470
|
+
return newEuint256(ciphertext, msg.sender);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/// @notice Creates a new encrypted uint256 for the given user.
|
|
415
474
|
/// @dev costs the inco fee
|
|
416
475
|
function newEuint256(
|
|
417
476
|
bytes memory ciphertext,
|
|
@@ -420,6 +479,15 @@ library e {
|
|
|
420
479
|
return inco.newEuint256{value: inco.getFee()}(ciphertext, user);
|
|
421
480
|
}
|
|
422
481
|
|
|
482
|
+
/// @notice Creates a new encrypted bool assuming msg.sender is the user
|
|
483
|
+
/// @dev costs the inco fee
|
|
484
|
+
function newEbool(
|
|
485
|
+
bytes memory ciphertext
|
|
486
|
+
) internal returns (ebool) {
|
|
487
|
+
return newEbool(ciphertext, msg.sender);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/// @notice Creates a new encrypted bool for the given user.
|
|
423
491
|
/// @dev costs the inco fee
|
|
424
492
|
function newEbool(
|
|
425
493
|
bytes memory ciphertext,
|
|
@@ -428,6 +496,15 @@ library e {
|
|
|
428
496
|
return inco.newEbool{value: inco.getFee()}(ciphertext, user);
|
|
429
497
|
}
|
|
430
498
|
|
|
499
|
+
/// @notice Creates a new encrypted address assuming msg.sender is the user
|
|
500
|
+
/// @dev costs the inco fee
|
|
501
|
+
function newEaddress(
|
|
502
|
+
bytes memory ciphertext
|
|
503
|
+
) internal returns (eaddress) {
|
|
504
|
+
return newEaddress(ciphertext, msg.sender);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/// @notice Creates a new encrypted address for the given user.
|
|
431
508
|
/// @dev costs the inco fee
|
|
432
509
|
function newEaddress(
|
|
433
510
|
bytes memory ciphertext,
|
|
@@ -482,7 +559,7 @@ library e {
|
|
|
482
559
|
euint256 ifFalse
|
|
483
560
|
) internal returns (euint256) {
|
|
484
561
|
return
|
|
485
|
-
|
|
562
|
+
euint256.wrap(
|
|
486
563
|
inco.eIfThenElse(
|
|
487
564
|
s(control),
|
|
488
565
|
euint256.unwrap(s(ifTrue)),
|
|
@@ -497,7 +574,7 @@ library e {
|
|
|
497
574
|
ebool ifFalse
|
|
498
575
|
) internal returns (ebool) {
|
|
499
576
|
return
|
|
500
|
-
|
|
577
|
+
ebool.wrap(
|
|
501
578
|
inco.eIfThenElse(
|
|
502
579
|
s(control),
|
|
503
580
|
ebool.unwrap(s(ifTrue)),
|
|
@@ -512,7 +589,7 @@ library e {
|
|
|
512
589
|
eaddress ifFalse
|
|
513
590
|
) internal returns (eaddress) {
|
|
514
591
|
return
|
|
515
|
-
|
|
592
|
+
eaddress.wrap(
|
|
516
593
|
inco.eIfThenElse(
|
|
517
594
|
s(control),
|
|
518
595
|
eaddress.unwrap(s(ifTrue)),
|