@inco/lightning 0.1.29 → 0.1.31
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/CHANGELOG.md +4 -0
- package/manifest.yaml +23 -0
- package/package.json +8 -5
- package/src/CreateXHelper.sol +14 -0
- package/src/DeployUtils.sol +95 -19
- package/src/Lib.demonet.sol +389 -0
- package/src/Lib.devnet.sol +389 -0
- package/src/Lib.testnet.sol +389 -0
- package/src/Types.sol +54 -52
- package/src/libs/incoLightning_0_1_29__863421733.sol +389 -0
- package/src/lightning-parts/DecryptionHandler.sol +208 -37
- package/src/lightning-parts/primitives/SignatureVerifier.sol +24 -9
- package/src/test/AddTwo.sol +15 -11
- package/src/test/FakeIncoInfra/FakeIncoInfraBase.sol +2 -1
- package/src/test/FibonacciDecrypt.sol +48 -0
- package/src/test/IncoTest.sol +6 -4
- package/src/test/TestAddTwo.t.sol +8 -10
- package/src/version/IncoLightningConfig.sol +2 -2
- package/dumps/incoLightning_0_1_23__547622051.dump.json +0 -1
- package/dumps/incoLightning_0_1_23__547622051.env +0 -15
- package/dumps/incoLightning_0_1_23__830342853.dump.json +0 -1
- package/dumps/incoLightning_0_1_23__830342853.env +0 -15
- package/dumps/incoLightning_0_1_24__266705097.dump.json +0 -1
- package/dumps/incoLightning_0_1_24__266705097.env +0 -15
- package/dumps/incoLightning_0_1_25__861473222.dump.json +0 -1
- package/dumps/incoLightning_0_1_25__861473222.env +0 -15
- package/dumps/incoLightning_0_1_25__986372984.dump.json +0 -1
- package/dumps/incoLightning_0_1_25__986372984.env +0 -15
- package/dumps/incoLightning_0_1_26__18043964.dump.json +0 -1
- package/dumps/incoLightning_0_1_26__18043964.env +0 -15
- package/dumps/incoLightning_0_1_26__444235330.dump.json +0 -1
- package/dumps/incoLightning_0_1_26__444235330.env +0 -15
- package/dumps/incoLightning_0_1_27__125335042.dump.json +0 -1
- package/dumps/incoLightning_0_1_27__125335042.env +0 -14
- package/dumps/incoLightning_0_1_27__558243565.dump.json +0 -1
- package/dumps/incoLightning_0_1_27__558243565.env +0 -14
- package/dumps/incoLightning_0_1_29__183408998.dump.json +0 -1
- package/dumps/incoLightning_0_1_29__183408998.env +0 -14
- package/dumps/incoLightning_0_1_29__340846814.dump.json +0 -1
- package/dumps/incoLightning_0_1_29__340846814.env +0 -14
- package/foundry.toml +0 -20
- package/remappings.txt +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.31
|
|
4
|
+
|
|
5
|
+
- Implement batching callbacks with `DecryptionHandler.sol` as source-of-truth for pending callbacks [#629](https://github.com/Inco-fhevm/inco-monorepo/pull/629) [#616](https://github.com/Inco-fhevm/inco-monorepo/pull/629)
|
|
6
|
+
|
|
3
7
|
## 0.1.29
|
|
4
8
|
|
|
5
9
|
- Publish contracts with verification [#535](https://github.com/Inco-fhevm/inco-monorepo/pull/535)
|
package/manifest.yaml
CHANGED
|
@@ -84,6 +84,29 @@ incoLightning_0_1_29__340846814:
|
|
|
84
84
|
deployDate: 2025-04-22T15:55:47.828Z
|
|
85
85
|
commit: v3-28-g93c05a49-dirty
|
|
86
86
|
addTwoAddress: "0x1A98fB1f7E57C0648b1d2A7DEA6e126C302A7e93"
|
|
87
|
+
incoLightning_0_1_29__863421733:
|
|
88
|
+
release:
|
|
89
|
+
name: incoLightning_0_1_29__863421733
|
|
90
|
+
executorAddress: "0xeBAFF6D578733E4603b99CBdbb221482F29a78E1"
|
|
91
|
+
deployer: "0x8202D2D747784Cb7D48868E44C42C4bf162a70BC"
|
|
92
|
+
pepper: demonet
|
|
93
|
+
version:
|
|
94
|
+
major: 0
|
|
95
|
+
minor: 1
|
|
96
|
+
patch: 29
|
|
97
|
+
shortSalt: "863421733"
|
|
98
|
+
salt: "0x8202d2d747784cb7d48868e44c42c4bf162a70bc00834654f6d289ccc7e5ab25"
|
|
99
|
+
deployments:
|
|
100
|
+
- decryptSigner: "0x000000000000000000000000000000000000baBe"
|
|
101
|
+
eciesPublicKey: "0x000000000000000000000000000000000000000000000000000000000000\
|
|
102
|
+
000000000000000000000000000000000000000000000000000000000000000000babe"
|
|
103
|
+
chainId: "84532"
|
|
104
|
+
blockNumber: "25719113"
|
|
105
|
+
chainName: Base Sepolia
|
|
106
|
+
active: true
|
|
107
|
+
deployDate: 2025-05-14T07:08:39.059Z
|
|
108
|
+
commit: v4
|
|
109
|
+
addTwoAddress: "0x436506A7c6462e5bab1f5CbAF9fD2a1d18F44F08"
|
|
87
110
|
incoLightning_0_1_27__558243565:
|
|
88
111
|
release:
|
|
89
112
|
name: incoLightning_0_1_27__558243565
|
package/package.json
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inco/lightning",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
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
|
-
"
|
|
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",
|
|
22
21
|
"forge-std": "https://github.com/foundry-rs/forge-std",
|
|
23
22
|
"tsx": "^4.19.3"
|
|
24
23
|
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/bun": "latest",
|
|
26
|
+
"prettier": "^3.5.3"
|
|
27
|
+
},
|
|
25
28
|
"publishConfig": {
|
|
26
29
|
"registry": "https://npm.pkg.github.com"
|
|
27
30
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// SPDX-License-Identifier: UNLICENSED
|
|
2
|
+
pragma solidity ^0.8.10;
|
|
3
|
+
|
|
4
|
+
import {CreateX} from "./pasted-dependencies/CreateX.sol";
|
|
5
|
+
|
|
6
|
+
// See: https://github.com/pcaversaccio/createx/issues/140 apparently this is as good as it gets if you fully compute
|
|
7
|
+
// the address from a salt since the internal _guard function is an essential part of the derivation
|
|
8
|
+
contract CreateXHelper is CreateX {
|
|
9
|
+
address internal constant _CREATEX = 0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed;
|
|
10
|
+
|
|
11
|
+
function computeCreate3DeployAddress(bytes32 salt) public view returns (address computedAddress) {
|
|
12
|
+
return CreateX(_CREATEX).computeCreate3Address({salt: _guard(salt) });
|
|
13
|
+
}
|
|
14
|
+
}
|
package/src/DeployUtils.sol
CHANGED
|
@@ -7,6 +7,8 @@ import {Vm} from "forge-std/Vm.sol";
|
|
|
7
7
|
import {CreateX, createXAddress, createXDeployer} from "../src/pasted-dependencies/CreateX.sol";
|
|
8
8
|
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
|
|
9
9
|
import {CONTRACT_NAME, MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION} from "../src/version/IncoLightningConfig.sol";
|
|
10
|
+
import {console} from "forge-std/console.sol";
|
|
11
|
+
import {CreateXHelper} from "./CreateXHelper.sol";
|
|
10
12
|
|
|
11
13
|
// can be set to 0x01 so the inco address can exist on only one chain, we want the same contract at the same address
|
|
12
14
|
// on all chains
|
|
@@ -40,33 +42,45 @@ contract DeployUtils is Script {
|
|
|
40
42
|
) internal pure returns (bytes32) {
|
|
41
43
|
return
|
|
42
44
|
bytes32(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
)
|
|
45
|
+
abi.encodePacked(
|
|
46
|
+
deployer,
|
|
47
|
+
crossChainDeployAuthorizedFlag,
|
|
48
|
+
bytes11(
|
|
49
|
+
keccak256(
|
|
50
|
+
abi.encodePacked(
|
|
51
|
+
name,
|
|
52
|
+
majorVersionNumber,
|
|
53
|
+
minorVersionNumber,
|
|
54
|
+
patchVersionNumber,
|
|
55
|
+
pepper
|
|
55
56
|
)
|
|
56
57
|
)
|
|
57
58
|
)
|
|
58
|
-
)
|
|
59
|
+
)
|
|
60
|
+
);
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/// @dev wrap in prank or broadcast depending on prod or testing environment
|
|
63
|
+
/// @dev deploys an CreateX proxy with an IncoLightning implementation
|
|
64
64
|
/// @param deployer MUST be the signer of the transaction
|
|
65
65
|
/// @param pepper a value used to avoid address collision on deploying the same contract twice with the same deployer
|
|
66
66
|
function deployIncoLightningUsingConfig(
|
|
67
67
|
address deployer,
|
|
68
68
|
string memory pepper
|
|
69
69
|
) internal returns (IncoLightning proxy) {
|
|
70
|
+
return deployIncoLightningUsingConfig(
|
|
71
|
+
deployer,
|
|
72
|
+
pepper,
|
|
73
|
+
MINOR_VERSION,
|
|
74
|
+
PATCH_VERSION
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/// @dev Computes the address of the IncoLightning contract using CreateX based on the deployer and pepper
|
|
79
|
+
function computeIncoLightningAddress(
|
|
80
|
+
address deployer,
|
|
81
|
+
string memory pepper
|
|
82
|
+
) public returns (address) {
|
|
83
|
+
CreateXHelper createX = new CreateXHelper();
|
|
70
84
|
bytes32 salt = getSalt(
|
|
71
85
|
CONTRACT_NAME,
|
|
72
86
|
MAJOR_VERSION,
|
|
@@ -75,6 +89,32 @@ contract DeployUtils is Script {
|
|
|
75
89
|
deployer,
|
|
76
90
|
pepper
|
|
77
91
|
);
|
|
92
|
+
return createX.computeCreate3DeployAddress({salt: salt});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/// @dev wrap in prank or broadcast depending on prod or testing environment
|
|
96
|
+
/// @param deployer MUST be the signer of the transaction
|
|
97
|
+
/// @param pepper a value used to avoid address collision on deploying the same contract twice with the same deployer
|
|
98
|
+
function deployIncoLightningUsingConfig(
|
|
99
|
+
address deployer,
|
|
100
|
+
string memory pepper,
|
|
101
|
+
// FIXME: on the next major version (new contract address and state) we should remove these from the salt altogether
|
|
102
|
+
uint8 minorVersionForSalt,
|
|
103
|
+
uint8 patchVersionForSalt
|
|
104
|
+
) internal returns (IncoLightning proxy) {
|
|
105
|
+
bytes32 salt = getSalt(
|
|
106
|
+
CONTRACT_NAME,
|
|
107
|
+
MAJOR_VERSION,
|
|
108
|
+
minorVersionForSalt,
|
|
109
|
+
patchVersionForSalt,
|
|
110
|
+
deployer,
|
|
111
|
+
pepper
|
|
112
|
+
);
|
|
113
|
+
console.log(
|
|
114
|
+
"Deploying Inco with deployerAddress: %s, salt: %s",
|
|
115
|
+
vm.toString(deployer),
|
|
116
|
+
vm.toString(salt)
|
|
117
|
+
);
|
|
78
118
|
proxy = IncoLightning(
|
|
79
119
|
deployProxy({
|
|
80
120
|
deployer: deployer,
|
|
@@ -85,9 +125,45 @@ contract DeployUtils is Script {
|
|
|
85
125
|
);
|
|
86
126
|
}
|
|
87
127
|
|
|
88
|
-
/// @
|
|
89
|
-
///
|
|
90
|
-
/// @
|
|
128
|
+
/// @dev Upgrades an existing IncoLightning contract whose major version is in IncoLightningConfig.sol but whose
|
|
129
|
+
/// minor and patch versions can be provided to this function in order to perform an upgrade
|
|
130
|
+
/// @param deployer MUST be the signer of the transaction
|
|
131
|
+
/// @param pepper a value used to avoid address collision on deploying the same contract twice with the same deployer
|
|
132
|
+
function upgradeIncoLightningUsingConfig(
|
|
133
|
+
address deployer,
|
|
134
|
+
string memory pepper,
|
|
135
|
+
// FIXME: on the next major version (new contract address and state) we should remove these from the salt altogether
|
|
136
|
+
uint8 minorVersionForSalt,
|
|
137
|
+
uint8 patchVersionForSalt
|
|
138
|
+
) internal returns (IncoLightning proxy) {
|
|
139
|
+
// Here we hack around the fact that we must use the same salt for an ugprade and currently the salt includes
|
|
140
|
+
// the minor and patch versions
|
|
141
|
+
bytes32 salt = getSalt(
|
|
142
|
+
CONTRACT_NAME,
|
|
143
|
+
MAJOR_VERSION,
|
|
144
|
+
minorVersionForSalt,
|
|
145
|
+
patchVersionForSalt,
|
|
146
|
+
deployer,
|
|
147
|
+
pepper
|
|
148
|
+
);
|
|
149
|
+
CreateXHelper createX = new CreateXHelper();
|
|
150
|
+
address proxyAddress = createX.computeCreate3DeployAddress({salt: salt});
|
|
151
|
+
console.log(
|
|
152
|
+
"Upgrading Inco with deployerAddress: %s, salt: %s, proxyAddress: %s",
|
|
153
|
+
vm.toString(deployer),
|
|
154
|
+
vm.toString(salt),
|
|
155
|
+
vm.toString(proxyAddress)
|
|
156
|
+
);
|
|
157
|
+
proxy = IncoLightning(proxyAddress);
|
|
158
|
+
|
|
159
|
+
IncoLightning newImplementation = new IncoLightning(salt);
|
|
160
|
+
proxy.upgradeToAndCall(address(newImplementation), "");
|
|
161
|
+
return proxy;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/// @notice deploys a ERC1967Proxy contract using CreateX (create3 pattern), gives the deployer the ownership of
|
|
165
|
+
/// the proxy
|
|
166
|
+
/// @dev deployer is made the owner of the contract
|
|
91
167
|
function deployProxy(
|
|
92
168
|
address deployer,
|
|
93
169
|
bytes32 salt,
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
// AUTOGENERATED FILE. DO NOT EDIT.
|
|
2
|
+
// This file was generated by the IncoLightning library generator.
|
|
3
|
+
// The original template is located at Lib.template.sol
|
|
4
|
+
|
|
5
|
+
/// SPDX-License-Identifier: No License
|
|
6
|
+
pragma solidity ^0.8;
|
|
7
|
+
|
|
8
|
+
import "./IncoLightning.sol";
|
|
9
|
+
import { ebool, euint256, ETypes } from "./Types.sol";
|
|
10
|
+
|
|
11
|
+
IncoLightning constant inco = IncoLightning(0xeBAFF6D578733E4603b99CBdbb221482F29a78E1);
|
|
12
|
+
address constant deployedBy = 0x8202D2D747784Cb7D48868E44C42C4bf162a70BC;
|
|
13
|
+
uint256 constant defaultDecryptionDelayLimit = 2 hours;
|
|
14
|
+
|
|
15
|
+
library e {
|
|
16
|
+
function sanitize(euint256 a) internal returns (euint256) {
|
|
17
|
+
if (euint256.unwrap(a) == bytes32(0)) {
|
|
18
|
+
return asEuint256(0);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function sanitize(ebool a) internal returns (ebool) {
|
|
24
|
+
if (ebool.unwrap(a) == bytes32(0)) {
|
|
25
|
+
return asEbool(false);
|
|
26
|
+
}
|
|
27
|
+
return a;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function s(euint256 a) internal returns (euint256) {
|
|
31
|
+
return sanitize(a);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function s(ebool a) internal returns (ebool) {
|
|
35
|
+
return sanitize(a);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function add(euint256 a, euint256 b) internal returns (euint256) {
|
|
39
|
+
return inco.eAdd(s(a), s(b));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function add(euint256 a, uint256 b) internal returns (euint256) {
|
|
43
|
+
return inco.eAdd(s(a), asEuint256(b));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function add(uint256 a, euint256 b) internal returns (euint256) {
|
|
47
|
+
return inco.eAdd(asEuint256(a), s(b));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function sub(euint256 a, euint256 b) internal returns (euint256) {
|
|
51
|
+
return inco.eSub(s(a), s(b));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function sub(euint256 a, uint256 b) internal returns (euint256) {
|
|
55
|
+
return inco.eSub(s(a), asEuint256(b));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function sub(uint256 a, euint256 b) internal returns (euint256) {
|
|
59
|
+
return inco.eSub(asEuint256(a), s(b));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function mul(euint256 a, euint256 b) internal returns (euint256) {
|
|
63
|
+
return inco.eMul(s(a), s(b));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function mul(euint256 a, uint256 b) internal returns (euint256) {
|
|
67
|
+
return inco.eMul(s(a), asEuint256(b));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function mul(uint256 a, euint256 b) internal returns (euint256) {
|
|
71
|
+
return inco.eMul(asEuint256(a), s(b));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function div(euint256 a, euint256 b) internal returns (euint256) {
|
|
75
|
+
return inco.eDiv(s(a), s(b));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function div(euint256 a, uint256 b) internal returns (euint256) {
|
|
79
|
+
return inco.eDiv(s(a), asEuint256(b));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function div(uint256 a, euint256 b) internal returns (euint256) {
|
|
83
|
+
return inco.eDiv(asEuint256(a), s(b));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function rem(euint256 a, euint256 b) internal returns (euint256) {
|
|
87
|
+
return inco.eRem(s(a), s(b));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function rem(euint256 a, uint256 b) internal returns (euint256) {
|
|
91
|
+
return inco.eRem(s(a), asEuint256(b));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function rem(uint256 a, euint256 b) internal returns (euint256) {
|
|
95
|
+
return inco.eRem(asEuint256(a), s(b));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function and(euint256 a, euint256 b) internal returns (euint256) {
|
|
99
|
+
return euint256.wrap(inco.eBitAnd(euint256.unwrap(s(a)), euint256.unwrap(s(b))));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function and(euint256 a, uint256 b) internal returns (euint256) {
|
|
103
|
+
return euint256.wrap(inco.eBitAnd(euint256.unwrap(s(a)), euint256.unwrap(asEuint256(b))));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function and(uint256 a, euint256 b) internal returns (euint256) {
|
|
107
|
+
return euint256.wrap(inco.eBitAnd(euint256.unwrap(asEuint256(a)), euint256.unwrap(s(b))));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function and(ebool a, ebool b) internal returns (ebool) {
|
|
111
|
+
return ebool.wrap(inco.eBitAnd(ebool.unwrap(s(a)), ebool.unwrap(s(b))));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function and(ebool a, bool b) internal returns (ebool) {
|
|
115
|
+
return ebool.wrap(inco.eBitAnd(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b))));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function and(bool a, ebool b) internal returns (ebool) {
|
|
119
|
+
return ebool.wrap(inco.eBitAnd(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b))));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function or(euint256 a, euint256 b) internal returns (euint256) {
|
|
123
|
+
return euint256.wrap(inco.eBitOr(euint256.unwrap(s(a)), euint256.unwrap(s(b))));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function or(euint256 a, uint256 b) internal returns (euint256) {
|
|
127
|
+
return euint256.wrap(inco.eBitOr(euint256.unwrap(s(a)), euint256.unwrap(asEuint256(b))));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function or(uint256 a, euint256 b) internal returns (euint256) {
|
|
131
|
+
return euint256.wrap(inco.eBitOr(euint256.unwrap(asEuint256(a)), euint256.unwrap(s(b))));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function or(ebool a, ebool b) internal returns (ebool) {
|
|
135
|
+
return ebool.wrap(inco.eBitOr(ebool.unwrap(s(a)), ebool.unwrap(s(b))));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function or(ebool a, bool b) internal returns (ebool) {
|
|
139
|
+
return ebool.wrap(inco.eBitOr(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b))));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function or(bool a, ebool b) internal returns (ebool) {
|
|
143
|
+
return ebool.wrap(inco.eBitOr(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b))));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function xor(euint256 a, euint256 b) internal returns (euint256) {
|
|
147
|
+
return euint256.wrap(inco.eBitXor(euint256.unwrap(s(a)), euint256.unwrap(s(b))));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function xor(euint256 a, uint256 b) internal returns (euint256) {
|
|
151
|
+
return euint256.wrap(inco.eBitXor(euint256.unwrap(s(a)), euint256.unwrap(asEuint256(b))));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function xor(uint256 a, euint256 b) internal returns (euint256) {
|
|
155
|
+
return euint256.wrap(inco.eBitXor(euint256.unwrap(asEuint256(a)), euint256.unwrap(s(b))));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function xor(ebool a, ebool b) internal returns (ebool) {
|
|
159
|
+
return ebool.wrap(inco.eBitXor(ebool.unwrap(s(a)), ebool.unwrap(s(b))));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function xor(ebool a, bool b) internal returns (ebool) {
|
|
163
|
+
return ebool.wrap(inco.eBitXor(ebool.unwrap(s(a)), ebool.unwrap(asEbool(b))));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function xor(bool a, ebool b) internal returns (ebool) {
|
|
167
|
+
return ebool.wrap(inco.eBitXor(ebool.unwrap(asEbool(a)), ebool.unwrap(s(b))));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function shl(euint256 a, euint256 b) internal returns (euint256) {
|
|
171
|
+
return inco.eShl(s(a), s(b));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function shl(euint256 a, uint256 b) internal returns (euint256) {
|
|
175
|
+
return inco.eShl(s(a), asEuint256(b));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function shl(uint256 a, euint256 b) internal returns (euint256) {
|
|
179
|
+
return inco.eShl(asEuint256(a), s(b));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function shr(euint256 a, euint256 b) internal returns (euint256) {
|
|
183
|
+
return inco.eShr(s(a), s(b));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function shr(euint256 a, uint256 b) internal returns (euint256) {
|
|
187
|
+
return inco.eShr(s(a), asEuint256(b));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function shr(uint256 a, euint256 b) internal returns (euint256) {
|
|
191
|
+
return inco.eShr(asEuint256(a), s(b));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function rotl(euint256 a, euint256 b) internal returns (euint256) {
|
|
195
|
+
return inco.eRotl(s(a), s(b));
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function rotl(euint256 a, uint256 b) internal returns (euint256) {
|
|
199
|
+
return inco.eRotl(s(a), asEuint256(b));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function rotl(uint256 a, euint256 b) internal returns (euint256) {
|
|
203
|
+
return inco.eRotl(asEuint256(a), s(b));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function rotr(euint256 a, euint256 b) internal returns (euint256) {
|
|
207
|
+
return inco.eRotr(s(a), s(b));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function rotr(euint256 a, uint256 b) internal returns (euint256) {
|
|
211
|
+
return inco.eRotr(s(a), asEuint256(b));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function rotr(uint256 a, euint256 b) internal returns (euint256) {
|
|
215
|
+
return inco.eRotr(asEuint256(a), s(b));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function eq(euint256 a, euint256 b) internal returns (ebool) {
|
|
219
|
+
return inco.eEq(s(a), s(b));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function eq(euint256 a, uint256 b) internal returns (ebool) {
|
|
223
|
+
return inco.eEq(s(a), asEuint256(b));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function eq(uint256 a, euint256 b) internal returns (ebool) {
|
|
227
|
+
return inco.eEq(asEuint256(a), s(b));
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function ne(euint256 a, euint256 b) internal returns (ebool) {
|
|
231
|
+
return inco.eNe(s(a), s(b));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function ne(euint256 a, uint256 b) internal returns (ebool) {
|
|
235
|
+
return inco.eNe(s(a), asEuint256(b));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function ne(uint256 a, euint256 b) internal returns (ebool) {
|
|
239
|
+
return inco.eNe(asEuint256(a), s(b));
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function ge(euint256 a, euint256 b) internal returns (ebool) {
|
|
243
|
+
return inco.eGe(s(a), s(b));
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function ge(euint256 a, uint256 b) internal returns (ebool) {
|
|
247
|
+
return inco.eGe(s(a), asEuint256(b));
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function ge(uint256 a, euint256 b) internal returns (ebool) {
|
|
251
|
+
return inco.eGe(asEuint256(a), s(b));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function gt(euint256 a, euint256 b) internal returns (ebool) {
|
|
255
|
+
return inco.eGt(s(a), s(b));
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function gt(euint256 a, uint256 b) internal returns (ebool) {
|
|
259
|
+
return inco.eGt(s(a), asEuint256(b));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function gt(uint256 a, euint256 b) internal returns (ebool) {
|
|
263
|
+
return inco.eGt(asEuint256(a), s(b));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function le(euint256 a, euint256 b) internal returns (ebool) {
|
|
267
|
+
return inco.eLe(s(a), s(b));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function le(euint256 a, uint256 b) internal returns (ebool) {
|
|
271
|
+
return inco.eLe(s(a), asEuint256(b));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function le(uint256 a, euint256 b) internal returns (ebool) {
|
|
275
|
+
return inco.eLe(asEuint256(a), s(b));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function lt(euint256 a, euint256 b) internal returns (ebool) {
|
|
279
|
+
return inco.eLt(s(a), s(b));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function lt(euint256 a, uint256 b) internal returns (ebool) {
|
|
283
|
+
return inco.eLt(s(a), asEuint256(b));
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function lt(uint256 a, euint256 b) internal returns (ebool) {
|
|
287
|
+
return inco.eLt(asEuint256(a), s(b));
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function min(euint256 a, euint256 b) internal returns (euint256) {
|
|
291
|
+
return inco.eMin(s(a), s(b));
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function min(euint256 a, uint256 b) internal returns (euint256) {
|
|
295
|
+
return inco.eMin(s(a), asEuint256(b));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function min(uint256 a, euint256 b) internal returns (euint256) {
|
|
299
|
+
return inco.eMin(asEuint256(a), s(b));
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function max(euint256 a, euint256 b) internal returns (euint256) {
|
|
303
|
+
return inco.eMax(s(a), s(b));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function max(euint256 a, uint256 b) internal returns (euint256) {
|
|
307
|
+
return inco.eMax(s(a), asEuint256(b));
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function max(uint256 a, euint256 b) internal returns (euint256) {
|
|
311
|
+
return inco.eMax(asEuint256(a), s(b));
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function not(ebool a) internal returns (ebool) {
|
|
315
|
+
return inco.eNot(s(a));
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function rand() internal returns (euint256) {
|
|
319
|
+
return euint256.wrap(inco.eRand(ETypes.Uint256));
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function randBounded(uint256 upperBound) internal returns (euint256) {
|
|
323
|
+
return euint256.wrap(inco.eRandBounded(euint256.unwrap(asEuint256(upperBound)), ETypes.Uint256));
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function randBounded(euint256 upperBound) internal returns (euint256) {
|
|
327
|
+
return euint256.wrap(inco.eRandBounded(euint256.unwrap(s(upperBound)), ETypes.Uint256));
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function asEuint256(uint256 a) internal returns (euint256) {
|
|
331
|
+
return inco.asEuint256(a);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function asEbool(bool a) internal returns (ebool) {
|
|
335
|
+
return inco.asEbool(a);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function asEbool(euint256 a) internal returns (ebool) {
|
|
339
|
+
return ebool.wrap(inco.eCast(euint256.unwrap(a), ETypes.Bool));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function asEuint256(ebool a) internal returns (euint256) {
|
|
343
|
+
return euint256.wrap(inco.eCast(ebool.unwrap(a), ETypes.Uint256));
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function newEuint256(bytes memory ciphertext, address user) internal returns (euint256) {
|
|
347
|
+
return inco.newEuint256(ciphertext, user);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function newEbool(bytes memory ciphertext, address user) internal returns (ebool) {
|
|
351
|
+
return inco.newEbool(ciphertext, user);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function allow(euint256 a, address to) internal {
|
|
355
|
+
inco.allow(euint256.unwrap(a), to);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function allow(ebool a, address to) internal {
|
|
359
|
+
inco.allow(ebool.unwrap(a), to);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function allowThis(euint256 a) internal {
|
|
363
|
+
allow(a, address(this));
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function allowThis(ebool a) internal {
|
|
367
|
+
allow(a, address(this));
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function isAllowed(address user, euint256 a) internal view returns (bool) {
|
|
371
|
+
return inco.isAllowed(euint256.unwrap(a), user);
|
|
372
|
+
}
|
|
373
|
+
|
|
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
|
+
}
|