@coti-io/coti-contracts 0.1.0
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/.github/workflows/npm-publish.yml +52 -0
- package/CODE_OF_CONDUCT.md +44 -0
- package/CONTRIBUTING.md +101 -0
- package/LICENSE +201 -0
- package/README.md +48 -0
- package/contracts/access/DataPrivacyFramework/DataPrivacyFramework.sol +480 -0
- package/contracts/access/DataPrivacyFramework/README.md +68 -0
- package/contracts/access/DataPrivacyFramework/extensions/DataPrivacyFrameworkMpc.sol +1139 -0
- package/contracts/mocks/README.md +5 -0
- package/contracts/mocks/access/DataPrivacyFramework/DataPrivacyFrameworkMock.sol +9 -0
- package/contracts/mocks/token/PrivateERC20/PrivateERC20Mock.sol +17 -0
- package/contracts/mocks/token/PrivateERC721/PrivateERC721URIStorageMock.sol +34 -0
- package/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol +431 -0
- package/contracts/mocks/utils/mpc/BitwiseTestsContract.sol +361 -0
- package/contracts/mocks/utils/mpc/Comparison1Tests.Contract.sol +307 -0
- package/contracts/mocks/utils/mpc/Comparison2TestsContract.sol +307 -0
- package/contracts/mocks/utils/mpc/MinMaxTestsContract.sol +297 -0
- package/contracts/mocks/utils/mpc/Miscellaneous1TestsContract.sol +185 -0
- package/contracts/mocks/utils/mpc/Miscellaneous2TestsContract.sol +448 -0
- package/contracts/mocks/utils/mpc/OffboardToUserKeyTestsContract.sol +81 -0
- package/contracts/mocks/utils/mpc/README.md +486 -0
- package/contracts/mocks/utils/mpc/ShiftTestsContract.sol +311 -0
- package/contracts/mocks/utils/mpc/StringTestsContract.sol +59 -0
- package/contracts/mocks/utils/mpc/TransferScalarTestsContract.sol +271 -0
- package/contracts/mocks/utils/mpc/TransferTestsContract.sol +715 -0
- package/contracts/mocks/wallet/PrivateERC20Wallet/PrivateERC20WalletMock.sol +25 -0
- package/contracts/onboard/AccountOnboard.sol +21 -0
- package/contracts/onboard/README.md +65 -0
- package/contracts/package.json +11 -0
- package/contracts/token/PrivateERC20/IPrivateERC20.sol +142 -0
- package/contracts/token/PrivateERC20/PrivateERC20.sol +478 -0
- package/contracts/token/PrivateERC20/README.md +104 -0
- package/contracts/token/PrivateERC721/PrivateERC721.sol +458 -0
- package/contracts/token/PrivateERC721/README.md +282 -0
- package/contracts/token/PrivateERC721/extensions/PrivateERC721URIStorage.sol +87 -0
- package/contracts/utils/mpc/MpcCore.sol +3215 -0
- package/contracts/utils/mpc/MpcInterface.sol +41 -0
- package/contracts/utils/mpc/README.md +82 -0
- package/hardhat.config.ts +18 -0
- package/package.json +14 -0
- package/test/access/DataPrivacyFramework/DataPrivacyFramework.test.ts +780 -0
- package/test/onboard/AccountOnboard.test.ts +45 -0
- package/test/token/PrivateERC20/PrivateERC20.test.ts +546 -0
- package/test/token/PrivateERC721/PrivateERC721.test.ts +223 -0
- package/test/utils/accounts.ts +55 -0
- package/test/utils/mpc/Precompile.test.ts +113 -0
- package/test/utils/mpc/String.test.ts +227 -0
- package/tsconfig.json +11 -0
- package/typechain-types/@openzeppelin/contracts/index.ts +9 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/IERC4906.ts +462 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/index.ts +6 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/index.ts +6 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.ts +393 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721Receiver.ts +110 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC721/index.ts +5 -0
- package/typechain-types/@openzeppelin/contracts/token/index.ts +5 -0
- package/typechain-types/@openzeppelin/contracts/utils/index.ts +5 -0
- package/typechain-types/@openzeppelin/contracts/utils/introspection/ERC165.ts +94 -0
- package/typechain-types/@openzeppelin/contracts/utils/introspection/IERC165.ts +94 -0
- package/typechain-types/@openzeppelin/contracts/utils/introspection/index.ts +5 -0
- package/typechain-types/@openzeppelin/index.ts +5 -0
- package/typechain-types/common.ts +131 -0
- package/typechain-types/contracts/access/DataPrivacyFramework/DataPrivacyFramework.ts +598 -0
- package/typechain-types/contracts/access/DataPrivacyFramework/extensions/DataPrivacyFrameworkMpc.ts +598 -0
- package/typechain-types/contracts/access/DataPrivacyFramework/extensions/index.ts +4 -0
- package/typechain-types/contracts/access/DataPrivacyFramework/index.ts +6 -0
- package/typechain-types/contracts/access/index.ts +5 -0
- package/typechain-types/contracts/index.ts +13 -0
- package/typechain-types/contracts/mocks/access/DataPrivacyFramework/DataPrivacyFrameworkMock.ts +598 -0
- package/typechain-types/contracts/mocks/access/DataPrivacyFramework/index.ts +4 -0
- package/typechain-types/contracts/mocks/access/index.ts +5 -0
- package/typechain-types/contracts/mocks/index.ts +11 -0
- package/typechain-types/contracts/mocks/token/PrivateERC20/PrivateERC20Mock.ts +543 -0
- package/typechain-types/contracts/mocks/token/PrivateERC20/index.ts +4 -0
- package/typechain-types/contracts/mocks/token/PrivateERC721/PrivateERC721URIStorageMock.ts +576 -0
- package/typechain-types/contracts/mocks/token/PrivateERC721/index.ts +4 -0
- package/typechain-types/contracts/mocks/token/index.ts +7 -0
- package/typechain-types/contracts/mocks/utils/index.ts +5 -0
- package/typechain-types/contracts/mocks/utils/mpc/ArithmeticTestsContract.ts +354 -0
- package/typechain-types/contracts/mocks/utils/mpc/BitwiseTestsContract.ts +340 -0
- package/typechain-types/contracts/mocks/utils/mpc/Comparison1Tests.Contract.sol/Comparison1TestsContract.ts +340 -0
- package/typechain-types/contracts/mocks/utils/mpc/Comparison1Tests.Contract.sol/index.ts +4 -0
- package/typechain-types/contracts/mocks/utils/mpc/Comparison2TestsContract.ts +340 -0
- package/typechain-types/contracts/mocks/utils/mpc/MinMaxTestsContract.ts +321 -0
- package/typechain-types/contracts/mocks/utils/mpc/Miscellaneous1TestsContract.ts +199 -0
- package/typechain-types/contracts/mocks/utils/mpc/Miscellaneous2TestsContract.ts +384 -0
- package/typechain-types/contracts/mocks/utils/mpc/OffboardToUserKeyTestsContract.sol/OffboardToUserKeyTestContract.ts +218 -0
- package/typechain-types/contracts/mocks/utils/mpc/OffboardToUserKeyTestsContract.sol/index.ts +4 -0
- package/typechain-types/contracts/mocks/utils/mpc/ShiftTestsContract.ts +339 -0
- package/typechain-types/contracts/mocks/utils/mpc/StringTestsContract.ts +211 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferScalarTestsContract.ts +266 -0
- package/typechain-types/contracts/mocks/utils/mpc/TransferTestsContract.ts +288 -0
- package/typechain-types/contracts/mocks/utils/mpc/index.ts +17 -0
- package/typechain-types/contracts/mocks/wallet/PrivateERC20Wallet/PrivateERC20WalletMock.ts +173 -0
- package/typechain-types/contracts/mocks/wallet/PrivateERC20Wallet/index.ts +4 -0
- package/typechain-types/contracts/mocks/wallet/index.ts +5 -0
- package/typechain-types/contracts/onboard/AccountOnboard.ts +135 -0
- package/typechain-types/contracts/onboard/index.ts +4 -0
- package/typechain-types/contracts/token/PrivateERC20/IPrivateERC20.ts +437 -0
- package/typechain-types/contracts/token/PrivateERC20/PrivateERC20.ts +505 -0
- package/typechain-types/contracts/token/PrivateERC20/index.ts +5 -0
- package/typechain-types/contracts/token/PrivateERC721/PrivateERC721.ts +409 -0
- package/typechain-types/contracts/token/PrivateERC721/extensions/PrivateERC721URIStorage.ts +501 -0
- package/typechain-types/contracts/token/PrivateERC721/extensions/index.ts +4 -0
- package/typechain-types/contracts/token/PrivateERC721/index.ts +6 -0
- package/typechain-types/contracts/token/index.ts +7 -0
- package/typechain-types/contracts/utils/index.ts +5 -0
- package/typechain-types/contracts/utils/mpc/MpcInterface.sol/ExtendedOperations.ts +698 -0
- package/typechain-types/contracts/utils/mpc/MpcInterface.sol/index.ts +4 -0
- package/typechain-types/contracts/utils/mpc/index.ts +5 -0
- package/typechain-types/factories/@openzeppelin/contracts/index.ts +6 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC4906__factory.ts +339 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors__factory.ts +127 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors__factory.ts +111 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors__factory.ts +128 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/index.ts +6 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/index.ts +5 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/IERC721Receiver__factory.ts +59 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/IERC721__factory.ts +307 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/index.ts +5 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/introspection/ERC165__factory.ts +41 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/introspection/IERC165__factory.ts +41 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/introspection/index.ts +5 -0
- package/typechain-types/factories/@openzeppelin/index.ts +4 -0
- package/typechain-types/factories/contracts/access/DataPrivacyFramework/DataPrivacyFramework__factory.ts +621 -0
- package/typechain-types/factories/contracts/access/DataPrivacyFramework/extensions/DataPrivacyFrameworkMpc__factory.ts +621 -0
- package/typechain-types/factories/contracts/access/DataPrivacyFramework/extensions/index.ts +4 -0
- package/typechain-types/factories/contracts/access/DataPrivacyFramework/index.ts +5 -0
- package/typechain-types/factories/contracts/access/index.ts +4 -0
- package/typechain-types/factories/contracts/index.ts +8 -0
- package/typechain-types/factories/contracts/mocks/access/DataPrivacyFramework/DataPrivacyFrameworkMock__factory.ts +670 -0
- package/typechain-types/factories/contracts/mocks/access/DataPrivacyFramework/index.ts +4 -0
- package/typechain-types/factories/contracts/mocks/access/index.ts +4 -0
- package/typechain-types/factories/contracts/mocks/index.ts +7 -0
- package/typechain-types/factories/contracts/mocks/token/PrivateERC20/PrivateERC20Mock__factory.ts +615 -0
- package/typechain-types/factories/contracts/mocks/token/PrivateERC20/index.ts +4 -0
- package/typechain-types/factories/contracts/mocks/token/PrivateERC721/PrivateERC721URIStorageMock__factory.ts +630 -0
- package/typechain-types/factories/contracts/mocks/token/PrivateERC721/index.ts +4 -0
- package/typechain-types/factories/contracts/mocks/token/index.ts +5 -0
- package/typechain-types/factories/contracts/mocks/utils/index.ts +4 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/ArithmeticTestsContract__factory.ts +374 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/BitwiseTestsContract__factory.ts +361 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison1Tests.Contract.sol/Comparison1TestsContract__factory.ts +361 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison1Tests.Contract.sol/index.ts +4 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison2TestsContract__factory.ts +361 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/MinMaxTestsContract__factory.ts +337 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/Miscellaneous1TestsContract__factory.ts +236 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/Miscellaneous2TestsContract__factory.ts +432 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/OffboardToUserKeyTestsContract.sol/OffboardToUserKeyTestContract__factory.ts +245 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/OffboardToUserKeyTestsContract.sol/index.ts +4 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/ShiftTestsContract__factory.ts +374 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/StringTestsContract__factory.ts +264 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferScalarTestsContract__factory.ts +360 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferTestsContract__factory.ts +441 -0
- package/typechain-types/factories/contracts/mocks/utils/mpc/index.ts +15 -0
- package/typechain-types/factories/contracts/mocks/wallet/PrivateERC20Wallet/PrivateERC20WalletMock__factory.ts +194 -0
- package/typechain-types/factories/contracts/mocks/wallet/PrivateERC20Wallet/index.ts +4 -0
- package/typechain-types/factories/contracts/mocks/wallet/index.ts +4 -0
- package/typechain-types/factories/contracts/onboard/AccountOnboard__factory.ts +104 -0
- package/typechain-types/factories/contracts/onboard/index.ts +4 -0
- package/typechain-types/factories/contracts/token/PrivateERC20/IPrivateERC20__factory.ts +406 -0
- package/typechain-types/factories/contracts/token/PrivateERC20/PrivateERC20__factory.ts +532 -0
- package/typechain-types/factories/contracts/token/PrivateERC20/index.ts +5 -0
- package/typechain-types/factories/contracts/token/PrivateERC721/PrivateERC721__factory.ts +439 -0
- package/typechain-types/factories/contracts/token/PrivateERC721/extensions/PrivateERC721URIStorage__factory.ts +512 -0
- package/typechain-types/factories/contracts/token/PrivateERC721/extensions/index.ts +4 -0
- package/typechain-types/factories/contracts/token/PrivateERC721/index.ts +5 -0
- package/typechain-types/factories/contracts/token/index.ts +5 -0
- package/typechain-types/factories/contracts/utils/index.ts +4 -0
- package/typechain-types/factories/contracts/utils/mpc/MpcInterface.sol/ExtendedOperations__factory.ts +919 -0
- package/typechain-types/factories/contracts/utils/mpc/MpcInterface.sol/index.ts +4 -0
- package/typechain-types/factories/contracts/utils/mpc/index.ts +4 -0
- package/typechain-types/factories/index.ts +5 -0
- package/typechain-types/hardhat.d.ts +621 -0
- package/typechain-types/index.ts +72 -0
|
@@ -0,0 +1,3215 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.19;
|
|
4
|
+
|
|
5
|
+
type gtBool is uint256;
|
|
6
|
+
type gtUint8 is uint256;
|
|
7
|
+
type gtUint16 is uint256;
|
|
8
|
+
type gtUint32 is uint256;
|
|
9
|
+
type gtUint64 is uint256;
|
|
10
|
+
|
|
11
|
+
// we use a struct because user-defined value types can only be elementary value types
|
|
12
|
+
// 8 characters (in byte form) per cell and the final cell padded with zeroes if needed
|
|
13
|
+
struct gtString {
|
|
14
|
+
gtUint64[] value;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type ctBool is uint256;
|
|
18
|
+
type ctUint8 is uint256;
|
|
19
|
+
type ctUint16 is uint256;
|
|
20
|
+
type ctUint32 is uint256;
|
|
21
|
+
type ctUint64 is uint256;
|
|
22
|
+
|
|
23
|
+
// we use a struct because user-defined value types can only be elementary value types
|
|
24
|
+
// 8 characters (in byte form) per cell and the final cell padded with zeroes if needed
|
|
25
|
+
struct ctString {
|
|
26
|
+
ctUint64[] value;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
struct itBool {
|
|
30
|
+
ctBool ciphertext;
|
|
31
|
+
bytes signature;
|
|
32
|
+
}
|
|
33
|
+
struct itUint8 {
|
|
34
|
+
ctUint8 ciphertext;
|
|
35
|
+
bytes signature;
|
|
36
|
+
}
|
|
37
|
+
struct itUint16 {
|
|
38
|
+
ctUint16 ciphertext;
|
|
39
|
+
bytes signature;
|
|
40
|
+
}
|
|
41
|
+
struct itUint32 {
|
|
42
|
+
ctUint32 ciphertext;
|
|
43
|
+
bytes signature;
|
|
44
|
+
}
|
|
45
|
+
struct itUint64 {
|
|
46
|
+
ctUint64 ciphertext;
|
|
47
|
+
bytes signature;
|
|
48
|
+
}
|
|
49
|
+
struct itString {
|
|
50
|
+
ctString ciphertext;
|
|
51
|
+
bytes[] signature;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
struct utBool {
|
|
55
|
+
ctBool ciphertext;
|
|
56
|
+
ctBool userCiphertext;
|
|
57
|
+
}
|
|
58
|
+
struct utUint8 {
|
|
59
|
+
ctUint8 ciphertext;
|
|
60
|
+
ctUint8 userCiphertext;
|
|
61
|
+
}
|
|
62
|
+
struct utUint16 {
|
|
63
|
+
ctUint16 ciphertext;
|
|
64
|
+
ctUint16 userCiphertext;
|
|
65
|
+
}
|
|
66
|
+
struct utUint32 {
|
|
67
|
+
ctUint32 ciphertext;
|
|
68
|
+
ctUint32 userCiphertext;
|
|
69
|
+
}
|
|
70
|
+
struct utUint64 {
|
|
71
|
+
ctUint64 ciphertext;
|
|
72
|
+
ctUint64 userCiphertext;
|
|
73
|
+
}
|
|
74
|
+
struct utString {
|
|
75
|
+
ctString ciphertext;
|
|
76
|
+
ctString userCiphertext;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
import "./MpcInterface.sol";
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
library MpcCore {
|
|
84
|
+
|
|
85
|
+
enum MPC_TYPE {SBOOL_T, SUINT8_T, SUINT16_T, SUINT32_T, SUINT64_T}
|
|
86
|
+
enum ARGS {BOTH_SECRET, LHS_PUBLIC, RHS_PUBLIC}
|
|
87
|
+
|
|
88
|
+
function combineEnumsToBytes2(MPC_TYPE mpcType, ARGS argsType) internal pure returns (bytes2) {
|
|
89
|
+
return bytes2(uint16(mpcType) << 8 | uint8(argsType));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function combineEnumsToBytes3(MPC_TYPE mpcType1, MPC_TYPE mpcType2, ARGS argsType) internal pure returns (bytes3) {
|
|
93
|
+
return bytes3(uint24(mpcType1) << 16 | uint16(mpcType2) << 8 | uint8(argsType));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function combineEnumsToBytes4(MPC_TYPE mpcType1, MPC_TYPE mpcType2, MPC_TYPE mpcType3, ARGS argsType) internal pure returns (bytes4) {
|
|
97
|
+
return bytes4(uint32(mpcType1) << 24 | uint24(mpcType2) << 16 | uint16(mpcType3) << 8 | uint8(argsType));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function getUserKey(bytes calldata signedEK, bytes calldata signature) internal view returns (bytes memory encryptedKey) {
|
|
101
|
+
// Combine array from signedEK and signature
|
|
102
|
+
bytes memory combined = new bytes(signature.length + signedEK.length);
|
|
103
|
+
|
|
104
|
+
// Copy contents of signature into combined
|
|
105
|
+
for (uint i = 0; i < signature.length; i++) {
|
|
106
|
+
combined[i] = signature[i];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Copy contents of _bytes2 into combined after _bytes1
|
|
110
|
+
for (uint j = 0; j < signedEK.length; j++) {
|
|
111
|
+
combined[signature.length + j] = signedEK[j];
|
|
112
|
+
}
|
|
113
|
+
return ExtendedOperations(MPC_PRECOMPILE).GetUserKey(combined);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
// =========== 1 bit operations ==============
|
|
118
|
+
|
|
119
|
+
function validateCiphertext(itBool memory input) internal returns (gtBool) {
|
|
120
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
121
|
+
ValidateCiphertext(bytes1(uint8(MPC_TYPE.SBOOL_T)), ctBool.unwrap(input.ciphertext), input.signature));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function onBoard(ctBool ct) internal returns (gtBool) {
|
|
125
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
126
|
+
OnBoard(bytes1(uint8(MPC_TYPE.SBOOL_T)), ctBool.unwrap(ct)));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function offBoard(gtBool pt) internal returns (ctBool) {
|
|
130
|
+
return ctBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
131
|
+
OffBoard(bytes1(uint8(MPC_TYPE.SBOOL_T)), gtBool.unwrap(pt)));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function offBoardToUser(gtBool pt, address addr) internal returns (ctBool) {
|
|
135
|
+
return ctBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
136
|
+
OffBoardToUser(bytes1(uint8(MPC_TYPE.SBOOL_T)), gtBool.unwrap(pt), abi.encodePacked(addr)));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function offBoardCombined(gtBool pt, address addr) internal returns (utBool memory ut) {
|
|
140
|
+
ut.ciphertext = offBoard(pt);
|
|
141
|
+
ut.userCiphertext = offBoardToUser(pt, addr);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function setPublic(bool pt) internal returns (gtBool) {
|
|
145
|
+
uint256 temp;
|
|
146
|
+
temp = pt ? 1 : 0;
|
|
147
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
148
|
+
SetPublic(bytes1(uint8(MPC_TYPE.SBOOL_T)), temp));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function rand() internal returns (gtBool) {
|
|
152
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).Rand(bytes1(uint8(MPC_TYPE.SBOOL_T))));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function and(gtBool a, gtBool b) internal returns (gtBool) {
|
|
156
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
157
|
+
And(combineEnumsToBytes3(MPC_TYPE.SBOOL_T, MPC_TYPE.SBOOL_T, ARGS.BOTH_SECRET), gtBool.unwrap(a), gtBool.unwrap(b)));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function or(gtBool a, gtBool b) internal returns (gtBool) {
|
|
161
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
162
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SBOOL_T, MPC_TYPE.SBOOL_T, ARGS.BOTH_SECRET), gtBool.unwrap(a), gtBool.unwrap(b)));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function xor(gtBool a, gtBool b) internal returns (gtBool) {
|
|
166
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
167
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SBOOL_T, MPC_TYPE.SBOOL_T, ARGS.BOTH_SECRET), gtBool.unwrap(a), gtBool.unwrap(b)));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function eq(gtBool a, gtBool b) internal returns (gtBool) {
|
|
171
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
172
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SBOOL_T, MPC_TYPE.SBOOL_T, ARGS.BOTH_SECRET), gtBool.unwrap(a), gtBool.unwrap(b)));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function ne(gtBool a, gtBool b) internal returns (gtBool) {
|
|
176
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
177
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SBOOL_T, MPC_TYPE.SBOOL_T, ARGS.BOTH_SECRET), gtBool.unwrap(a), gtBool.unwrap(b)));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function decrypt(gtBool ct) internal returns (bool){
|
|
181
|
+
uint256 temp = ExtendedOperations(MPC_PRECOMPILE).
|
|
182
|
+
Decrypt(bytes1(uint8(MPC_TYPE.SBOOL_T)), gtBool.unwrap(ct));
|
|
183
|
+
return temp != 0;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function mux(gtBool bit, gtBool a, gtBool b) internal returns (gtBool){
|
|
187
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
188
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SBOOL_T, MPC_TYPE.SBOOL_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtBool.unwrap(a), gtBool.unwrap(b)));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function not(gtBool a) internal returns (gtBool){
|
|
192
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
193
|
+
Not(bytes1(uint8(MPC_TYPE.SBOOL_T)), gtBool.unwrap(a)));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
// =========== Operations with BOTH_SECRET parameter ===========
|
|
198
|
+
// =========== 8 bit operations ==============
|
|
199
|
+
|
|
200
|
+
function validateCiphertext(itUint8 memory input) internal returns (gtUint8) {
|
|
201
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
202
|
+
ValidateCiphertext(bytes1(uint8(MPC_TYPE.SUINT8_T)), ctUint8.unwrap(input.ciphertext), input.signature));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function onBoard(ctUint8 ct) internal returns (gtUint8) {
|
|
206
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
207
|
+
OnBoard(bytes1(uint8(MPC_TYPE.SUINT8_T)), ctUint8.unwrap(ct)));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function offBoard(gtUint8 pt) internal returns (ctUint8) {
|
|
211
|
+
return ctUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
212
|
+
OffBoard(bytes1(uint8(MPC_TYPE.SUINT8_T)), gtUint8.unwrap(pt)));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function offBoardToUser(gtUint8 pt, address addr) internal returns (ctUint8) {
|
|
216
|
+
return ctUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
217
|
+
OffBoardToUser(bytes1(uint8(MPC_TYPE.SUINT8_T)), gtUint8.unwrap(pt), abi.encodePacked(addr)));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function offBoardCombined(gtUint8 pt, address addr) internal returns (utUint8 memory ut) {
|
|
221
|
+
ut.ciphertext = offBoard(pt);
|
|
222
|
+
ut.userCiphertext = offBoardToUser(pt, addr);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function setPublic8(uint8 pt) internal returns (gtUint8) {
|
|
226
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
227
|
+
SetPublic(bytes1(uint8(MPC_TYPE.SUINT8_T)), uint256(pt)));
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function rand8() internal returns (gtUint8) {
|
|
231
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).Rand(bytes1(uint8(MPC_TYPE.SUINT8_T))));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function randBoundedBits8(uint8 numBits) internal returns (gtUint8) {
|
|
235
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).RandBoundedBits(bytes1(uint8(MPC_TYPE.SUINT8_T)), numBits));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function add(gtUint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
239
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
240
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function sub(gtUint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
244
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
245
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function mul(gtUint8 a, gtUint8 b) internal returns (gtUint16) {
|
|
249
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
250
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function div(gtUint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
254
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
255
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function rem(gtUint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
259
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
260
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function and(gtUint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
264
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
265
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function or(gtUint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
269
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
270
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function xor(gtUint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
274
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
275
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function shl(gtUint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
279
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
280
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function shr(gtUint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
284
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
285
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function eq(gtUint8 a, gtUint8 b) internal returns (gtBool) {
|
|
289
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
290
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function ne(gtUint8 a, gtUint8 b) internal returns (gtBool) {
|
|
294
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
295
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function ge(gtUint8 a, gtUint8 b) internal returns (gtBool) {
|
|
299
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
300
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function gt(gtUint8 a, gtUint8 b) internal returns (gtBool) {
|
|
304
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
305
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function le(gtUint8 a, gtUint8 b) internal returns (gtBool) {
|
|
309
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
310
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function lt(gtUint8 a, gtUint8 b) internal returns (gtBool) {
|
|
314
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
315
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function min(gtUint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
319
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
320
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
function max(gtUint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
324
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
325
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function decrypt(gtUint8 ct) internal returns (uint8){
|
|
329
|
+
return uint8(ExtendedOperations(MPC_PRECOMPILE).
|
|
330
|
+
Decrypt(bytes1(uint8(MPC_TYPE.SUINT8_T)), gtUint8.unwrap(ct)));
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function mux(gtBool bit, gtUint8 a, gtUint8 b) internal returns (gtUint8){
|
|
334
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
335
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint8.unwrap(a), gtUint8.unwrap(b)));
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function transfer(gtUint8 a, gtUint8 b, gtUint8 amount) internal returns (gtUint8, gtUint8, gtBool){
|
|
339
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
340
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint8.unwrap(b), gtUint8.unwrap(amount));
|
|
341
|
+
return (gtUint8.wrap(new_a), gtUint8.wrap(new_b), gtBool.wrap(res));
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
// =========== 16 bit operations ==============
|
|
346
|
+
|
|
347
|
+
function validateCiphertext(itUint16 memory input) internal returns (gtUint16) {
|
|
348
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
349
|
+
ValidateCiphertext(bytes1(uint8(MPC_TYPE.SUINT16_T)), ctUint16.unwrap(input.ciphertext), input.signature));
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function onBoard(ctUint16 ct) internal returns (gtUint16) {
|
|
353
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
354
|
+
OnBoard(bytes1(uint8(MPC_TYPE.SUINT16_T)), ctUint16.unwrap(ct)));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function offBoard(gtUint16 pt) internal returns (ctUint16) {
|
|
358
|
+
return ctUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
359
|
+
OffBoard(bytes1(uint8(MPC_TYPE.SUINT16_T)), gtUint16.unwrap(pt)));
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function offBoardToUser(gtUint16 pt, address addr) internal returns (ctUint16) {
|
|
363
|
+
return ctUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
364
|
+
OffBoardToUser(bytes1(uint8(MPC_TYPE.SUINT16_T)), gtUint16.unwrap(pt), abi.encodePacked(addr)));
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function offBoardCombined(gtUint16 pt, address addr) internal returns (utUint16 memory ut) {
|
|
368
|
+
ut.ciphertext = offBoard(pt);
|
|
369
|
+
ut.userCiphertext = offBoardToUser(pt, addr);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function setPublic16(uint16 pt) internal returns (gtUint16) {
|
|
373
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
374
|
+
SetPublic(bytes1(uint8(MPC_TYPE.SUINT16_T)), uint256(pt)));
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function rand16() internal returns (gtUint16) {
|
|
378
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).Rand(bytes1(uint8(MPC_TYPE.SUINT16_T))));
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function randBoundedBits16(uint8 numBits) internal returns (gtUint16) {
|
|
382
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).RandBoundedBits(bytes1(uint8(MPC_TYPE.SUINT16_T)), numBits));
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function add(gtUint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
386
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
387
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function sub(gtUint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
391
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
392
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function mul(gtUint16 a, gtUint16 b) internal returns (gtUint32) {
|
|
396
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
397
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function div(gtUint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
401
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
402
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function rem(gtUint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
406
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
407
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function and(gtUint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
411
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
412
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function or(gtUint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
416
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
417
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
function xor(gtUint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
421
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
422
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function shl(gtUint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
426
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
427
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function shr(gtUint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
431
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
432
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function eq(gtUint16 a, gtUint16 b) internal returns (gtBool) {
|
|
436
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
437
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function ne(gtUint16 a, gtUint16 b) internal returns (gtBool) {
|
|
441
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
442
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
function ge(gtUint16 a, gtUint16 b) internal returns (gtBool) {
|
|
446
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
447
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function gt(gtUint16 a, gtUint16 b) internal returns (gtBool) {
|
|
451
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
452
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function le(gtUint16 a, gtUint16 b) internal returns (gtBool) {
|
|
456
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
457
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function lt(gtUint16 a, gtUint16 b) internal returns (gtBool) {
|
|
461
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
462
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
function min(gtUint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
466
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
467
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function max(gtUint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
471
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
472
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
function decrypt(gtUint16 ct) internal returns (uint16){
|
|
476
|
+
return uint16(ExtendedOperations(MPC_PRECOMPILE).
|
|
477
|
+
Decrypt(bytes1(uint8(MPC_TYPE.SUINT16_T)), gtUint16.unwrap(ct)));
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function mux(gtBool bit, gtUint16 a, gtUint16 b) internal returns (gtUint16){
|
|
481
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
482
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint16.unwrap(a), gtUint16.unwrap(b)));
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
function transfer(gtUint16 a, gtUint16 b, gtUint16 amount) internal returns (gtUint16, gtUint16, gtBool){
|
|
486
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
487
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b), gtUint16.unwrap(amount));
|
|
488
|
+
return (gtUint16.wrap(new_a), gtUint16.wrap(new_b), gtBool.wrap(res));
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
// =========== 32 bit operations ==============
|
|
494
|
+
|
|
495
|
+
function validateCiphertext(itUint32 memory input) internal returns (gtUint32) {
|
|
496
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
497
|
+
ValidateCiphertext(bytes1(uint8(MPC_TYPE.SUINT32_T)), ctUint32.unwrap(input.ciphertext), input.signature));
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function onBoard(ctUint32 ct) internal returns (gtUint32) {
|
|
501
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
502
|
+
OnBoard(bytes1(uint8(MPC_TYPE.SUINT32_T)), ctUint32.unwrap(ct)));
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
function offBoard(gtUint32 pt) internal returns (ctUint32) {
|
|
506
|
+
return ctUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
507
|
+
OffBoard(bytes1(uint8(MPC_TYPE.SUINT32_T)), gtUint32.unwrap(pt)));
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function offBoardToUser(gtUint32 pt, address addr) internal returns (ctUint32) {
|
|
511
|
+
return ctUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
512
|
+
OffBoardToUser(bytes1(uint8(MPC_TYPE.SUINT32_T)), gtUint32.unwrap(pt), abi.encodePacked(addr)));
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
function offBoardCombined(gtUint32 pt, address addr) internal returns (utUint32 memory ut) {
|
|
516
|
+
ut.ciphertext = offBoard(pt);
|
|
517
|
+
ut.userCiphertext = offBoardToUser(pt, addr);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
function setPublic32(uint32 pt) internal returns (gtUint32) {
|
|
521
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
522
|
+
SetPublic(bytes1(uint8(MPC_TYPE.SUINT32_T)), uint256(pt)));
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function rand32() internal returns (gtUint32) {
|
|
526
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).Rand(bytes1(uint8(MPC_TYPE.SUINT32_T))));
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
function randBoundedBits32(uint8 numBits) internal returns (gtUint32) {
|
|
530
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).RandBoundedBits(bytes1(uint8(MPC_TYPE.SUINT32_T)), numBits));
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
function add(gtUint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
534
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
535
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
function sub(gtUint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
539
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
540
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function mul(gtUint32 a, gtUint32 b) internal returns (gtUint64) {
|
|
544
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
545
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function div(gtUint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
549
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
550
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function rem(gtUint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
554
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
555
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function and(gtUint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
559
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
560
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function or(gtUint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
564
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
565
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
function xor(gtUint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
569
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
570
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
function shl(gtUint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
574
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
575
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function shr(gtUint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
579
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
580
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
581
|
+
}
|
|
582
|
+
function eq(gtUint32 a, gtUint32 b) internal returns (gtBool) {
|
|
583
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
584
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
function ne(gtUint32 a, gtUint32 b) internal returns (gtBool) {
|
|
588
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
589
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
function ge(gtUint32 a, gtUint32 b) internal returns (gtBool) {
|
|
593
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
594
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
function gt(gtUint32 a, gtUint32 b) internal returns (gtBool) {
|
|
598
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
599
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function le(gtUint32 a, gtUint32 b) internal returns (gtBool) {
|
|
603
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
604
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
function lt(gtUint32 a, gtUint32 b) internal returns (gtBool) {
|
|
608
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
609
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
function min(gtUint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
613
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
614
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
function max(gtUint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
618
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
619
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
function decrypt(gtUint32 ct) internal returns (uint32){
|
|
623
|
+
return uint32(ExtendedOperations(MPC_PRECOMPILE).
|
|
624
|
+
Decrypt(bytes1(uint8(MPC_TYPE.SUINT32_T)), gtUint32.unwrap(ct)));
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
function mux(gtBool bit, gtUint32 a, gtUint32 b) internal returns (gtUint32){
|
|
628
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
629
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint32.unwrap(a), gtUint32.unwrap(b)));
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
function transfer(gtUint32 a, gtUint32 b, gtUint32 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
633
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
634
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b), gtUint32.unwrap(amount));
|
|
635
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
// =========== 64 bit operations ==============
|
|
640
|
+
|
|
641
|
+
function validateCiphertext(itUint64 memory input) internal returns (gtUint64) {
|
|
642
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
643
|
+
ValidateCiphertext(bytes1(uint8(MPC_TYPE.SUINT64_T)), ctUint64.unwrap(input.ciphertext), input.signature));
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
function onBoard(ctUint64 ct) internal returns (gtUint64) {
|
|
647
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
648
|
+
OnBoard(bytes1(uint8(MPC_TYPE.SUINT64_T)), ctUint64.unwrap(ct)));
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
function offBoard(gtUint64 pt) internal returns (ctUint64) {
|
|
652
|
+
return ctUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
653
|
+
OffBoard(bytes1(uint8(MPC_TYPE.SUINT64_T)), gtUint64.unwrap(pt)));
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function offBoardToUser(gtUint64 pt, address addr) internal returns (ctUint64) {
|
|
657
|
+
return ctUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
658
|
+
OffBoardToUser(bytes1(uint8(MPC_TYPE.SUINT64_T)), gtUint64.unwrap(pt), abi.encodePacked(addr)));
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
function offBoardCombined(gtUint64 pt, address addr) internal returns (utUint64 memory ut) {
|
|
662
|
+
ut.ciphertext = offBoard(pt);
|
|
663
|
+
ut.userCiphertext = offBoardToUser(pt, addr);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function setPublic64(uint64 pt) internal returns (gtUint64) {
|
|
667
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
668
|
+
SetPublic(bytes1(uint8(MPC_TYPE.SUINT64_T)), uint256(pt)));
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
function rand64() internal returns (gtUint64) {
|
|
672
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).Rand(bytes1(uint8(MPC_TYPE.SUINT64_T))));
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
function randBoundedBits64(uint8 numBits) internal returns (gtUint64) {
|
|
676
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).RandBoundedBits(bytes1(uint8(MPC_TYPE.SUINT64_T)), numBits));
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
function add(gtUint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
680
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
681
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
function sub(gtUint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
685
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
686
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
function mul(gtUint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
690
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
691
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
function div(gtUint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
695
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
696
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
function rem(gtUint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
700
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
701
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
function and(gtUint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
705
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
706
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
function or(gtUint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
710
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
711
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
function xor(gtUint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
715
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
716
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
function shl(gtUint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
720
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
721
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
function shr(gtUint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
725
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
726
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
function eq(gtUint64 a, gtUint64 b) internal returns (gtBool) {
|
|
730
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
731
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
function ne(gtUint64 a, gtUint64 b) internal returns (gtBool) {
|
|
735
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
736
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
function ge(gtUint64 a, gtUint64 b) internal returns (gtBool) {
|
|
740
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
741
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
function gt(gtUint64 a, gtUint64 b) internal returns (gtBool) {
|
|
745
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
746
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
function le(gtUint64 a, gtUint64 b) internal returns (gtBool) {
|
|
750
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
751
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
function lt(gtUint64 a, gtUint64 b) internal returns (gtBool) {
|
|
755
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
756
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
function min(gtUint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
760
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
761
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
function max(gtUint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
765
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
766
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
function decrypt(gtUint64 ct) internal returns (uint64){
|
|
770
|
+
return uint64(ExtendedOperations(MPC_PRECOMPILE).
|
|
771
|
+
Decrypt(bytes1(uint8(MPC_TYPE.SUINT64_T)), gtUint64.unwrap(ct)));
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
function mux(gtBool bit, gtUint64 a, gtUint64 b) internal returns (gtUint64){
|
|
775
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
776
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint64.unwrap(a), gtUint64.unwrap(b)));
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
function transfer(gtUint64 a, gtUint64 b, gtUint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
780
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
781
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b), gtUint64.unwrap(amount));
|
|
782
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
function transferWithAllowance(gtUint64 a, gtUint64 b, gtUint64 amount, gtUint64 allowance) internal returns (gtUint64, gtUint64, gtBool, gtUint64){
|
|
786
|
+
(uint256 new_a, uint256 new_b, uint256 res, uint256 new_allowance) = ExtendedOperations(MPC_PRECOMPILE).
|
|
787
|
+
TransferWithAllowance(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b), gtUint64.unwrap(amount), gtUint64.unwrap(allowance));
|
|
788
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res), gtUint64.wrap(new_allowance));
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
function transferWithAllowance(gtUint64 a, gtUint64 b, uint64 amount, gtUint64 allowance) internal returns (gtUint64, gtUint64, gtBool, gtUint64){
|
|
792
|
+
(uint256 new_a, uint256 new_b, uint256 res, uint256 new_allowance) = ExtendedOperations(MPC_PRECOMPILE).
|
|
793
|
+
TransferWithAllowance(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), gtUint64.unwrap(a), gtUint64.unwrap(b), uint256(amount), gtUint64.unwrap(allowance));
|
|
794
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res), gtUint64.wrap(new_allowance));
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
// =========== String operations ============
|
|
799
|
+
|
|
800
|
+
function validateCiphertext(itString memory input) internal returns (gtString memory) {
|
|
801
|
+
uint256 len_ = input.signature.length;
|
|
802
|
+
|
|
803
|
+
require(input.ciphertext.value.length == len_, "MPC_CORE: INVALID_INPUT_TEXT");
|
|
804
|
+
|
|
805
|
+
gtString memory gt_ = gtString(new gtUint64[](len_));
|
|
806
|
+
|
|
807
|
+
itUint64 memory it_;
|
|
808
|
+
|
|
809
|
+
for (uint256 i = 0; i < len_; ++i) {
|
|
810
|
+
it_.ciphertext = input.ciphertext.value[i];
|
|
811
|
+
it_.signature = input.signature[i];
|
|
812
|
+
|
|
813
|
+
gt_.value[i] = validateCiphertext(it_);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
return gt_;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
function onBoard(ctString memory ct) internal returns (gtString memory) {
|
|
820
|
+
uint256 len_ = ct.value.length;
|
|
821
|
+
|
|
822
|
+
gtString memory gt_ = gtString(new gtUint64[](len_));
|
|
823
|
+
|
|
824
|
+
for (uint256 i = 0; i < len_; ++i) {
|
|
825
|
+
gt_.value[i] = onBoard(ct.value[i]);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
return gt_;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
function offBoard(gtString memory pt) internal returns (ctString memory) {
|
|
832
|
+
uint256 len_ = pt.value.length;
|
|
833
|
+
|
|
834
|
+
ctString memory ct_ = ctString(new ctUint64[](len_));
|
|
835
|
+
|
|
836
|
+
for (uint256 i = 0; i < len_; ++i) {
|
|
837
|
+
ct_.value[i] = offBoard(pt.value[i]);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
return ct_;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
function offBoardToUser(gtString memory pt, address addr) internal returns (ctString memory) {
|
|
844
|
+
uint256 len_ = pt.value.length;
|
|
845
|
+
|
|
846
|
+
ctString memory ct_ = ctString(new ctUint64[](len_));
|
|
847
|
+
|
|
848
|
+
for (uint256 i = 0; i < len_; ++i) {
|
|
849
|
+
ct_.value[i] = offBoardToUser(pt.value[i], addr);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
return ct_;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
function offBoardCombined(gtString memory pt, address addr) internal returns (utString memory ut) {
|
|
856
|
+
ut.ciphertext = offBoard(pt);
|
|
857
|
+
ut.userCiphertext = offBoardToUser(pt, addr);
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
function setPublicString(string memory pt) internal returns (gtString memory) {
|
|
861
|
+
bytes memory strBytes_ = bytes(pt);
|
|
862
|
+
uint256 len_ = strBytes_.length;
|
|
863
|
+
uint256 count_ = (len_ + 7) / 8; // Number of bytes8 elements needed
|
|
864
|
+
|
|
865
|
+
gtString memory result_ = gtString(new gtUint64[](count_));
|
|
866
|
+
|
|
867
|
+
bytes8 cell_;
|
|
868
|
+
|
|
869
|
+
for (uint256 i = 0; i < count_ * 8; ++i) {
|
|
870
|
+
if (i % 8 == 0) {
|
|
871
|
+
cell_ = bytes8(0);
|
|
872
|
+
} else {
|
|
873
|
+
cell_ <<= 8;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
if (i < len_) {
|
|
877
|
+
cell_ |= bytes8(strBytes_[i]) >> 56;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
if (i % 8 == 7) {
|
|
881
|
+
result_.value[i / 8] = setPublic64(uint64(cell_));
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
return result_;
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
function decrypt(gtString memory ct) internal returns (string memory){
|
|
889
|
+
uint256 len_ = ct.value.length;
|
|
890
|
+
bytes memory result_ = new bytes(len_ * 8);
|
|
891
|
+
|
|
892
|
+
bytes8 temp_;
|
|
893
|
+
|
|
894
|
+
uint256 resultIndex;
|
|
895
|
+
|
|
896
|
+
for (uint256 i = 0; i < len_; ++i) {
|
|
897
|
+
temp_ = bytes8(decrypt(ct.value[i]));
|
|
898
|
+
|
|
899
|
+
assembly {
|
|
900
|
+
// Copy the bytes directly into the result array using assembly.
|
|
901
|
+
mstore(add(result_, add(0x20, resultIndex)), temp_)
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
resultIndex += 8;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
return string(result_);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
function eq(gtString memory a, gtString memory b) internal returns (gtBool) {
|
|
911
|
+
uint256 len = a.value.length;
|
|
912
|
+
|
|
913
|
+
// note that we are not leaking information since the array length is visible to all
|
|
914
|
+
if (len != b.value.length) return setPublic(false);
|
|
915
|
+
|
|
916
|
+
gtBool result_ = eq(a.value[0], b.value[0]);
|
|
917
|
+
|
|
918
|
+
for (uint256 i = 1; i < len; ++i) {
|
|
919
|
+
result_ = and(result_, eq(a.value[i], b.value[i]));
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
return result_;
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
function ne(gtString memory a, gtString memory b) internal returns (gtBool) {
|
|
926
|
+
uint256 len = a.value.length;
|
|
927
|
+
|
|
928
|
+
// note that we are not leaking information since the array length is visible to all
|
|
929
|
+
if (len != b.value.length) return setPublic(true);
|
|
930
|
+
|
|
931
|
+
gtBool result_ = ne(a.value[0], b.value[0]);
|
|
932
|
+
|
|
933
|
+
for (uint256 i = 1; i < len; ++i) {
|
|
934
|
+
result_ = or(result_, ne(a.value[i], b.value[i]));
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
return result_;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
// =========== Operations with LHS_PUBLIC parameter ===========
|
|
942
|
+
// =========== 8 bit operations ==============
|
|
943
|
+
|
|
944
|
+
function add(uint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
945
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
946
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
function sub(uint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
950
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
951
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
function mul(uint8 a, gtUint8 b) internal returns (gtUint16) {
|
|
955
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
956
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
function div(uint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
960
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
961
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
962
|
+
}
|
|
963
|
+
function rem(uint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
964
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
965
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
function and(uint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
969
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
970
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
function or(uint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
974
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
975
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
function xor(uint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
979
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
980
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
function shl(uint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
984
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
985
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
function shr(uint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
989
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
990
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
function eq(uint8 a, gtUint8 b) internal returns (gtBool) {
|
|
994
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
995
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
function ne(uint8 a, gtUint8 b) internal returns (gtBool) {
|
|
999
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1000
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
function ge(uint8 a, gtUint8 b) internal returns (gtBool) {
|
|
1004
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1005
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
function gt(uint8 a, gtUint8 b) internal returns (gtBool) {
|
|
1009
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1010
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
function le(uint8 a, gtUint8 b) internal returns (gtBool) {
|
|
1014
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1015
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
function lt(uint8 a, gtUint8 b) internal returns (gtBool) {
|
|
1019
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1020
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
function min(uint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
1024
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1025
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
function max(uint8 a, gtUint8 b) internal returns (gtUint8) {
|
|
1029
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1030
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), uint256(a), gtUint8.unwrap(b)));
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
// =========== 16 bit operations ==============
|
|
1035
|
+
|
|
1036
|
+
function add(uint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
1037
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1038
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
function sub(uint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
1042
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1043
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
function mul(uint16 a, gtUint16 b) internal returns (gtUint64) {
|
|
1047
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1048
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
function div(uint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
1052
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1053
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
function rem(uint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
1057
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1058
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
function and(uint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
1062
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1063
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
function or(uint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
1067
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1068
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
function xor(uint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
1072
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1073
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
function shl(uint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
1077
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1078
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
function shr(uint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
1082
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1083
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
function eq(uint16 a, gtUint16 b) internal returns (gtBool) {
|
|
1087
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1088
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
function ne(uint16 a, gtUint16 b) internal returns (gtBool) {
|
|
1092
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1093
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
function ge(uint16 a, gtUint16 b) internal returns (gtBool) {
|
|
1097
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1098
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
function gt(uint16 a, gtUint16 b) internal returns (gtBool) {
|
|
1102
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1103
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
function le(uint16 a, gtUint16 b) internal returns (gtBool) {
|
|
1107
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1108
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
function lt(uint16 a, gtUint16 b) internal returns (gtBool) {
|
|
1112
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1113
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
function min(uint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
1117
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1118
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
function max(uint16 a, gtUint16 b) internal returns (gtUint16) {
|
|
1122
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1123
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), uint256(a), gtUint16.unwrap(b)));
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
// =========== 32 bit operations ==============
|
|
1128
|
+
|
|
1129
|
+
function add(uint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
1130
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1131
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
function sub(uint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
1135
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1136
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
function mul(uint32 a, gtUint32 b) internal returns (gtUint64) {
|
|
1140
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1141
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
function div(uint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
1145
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1146
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
function rem(uint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
1150
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1151
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
function and(uint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
1155
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1156
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
function or(uint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
1160
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1161
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
function xor(uint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
1165
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1166
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
function shl(uint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
1170
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1171
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
function shr(uint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
1175
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1176
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
function eq(uint32 a, gtUint32 b) internal returns (gtBool) {
|
|
1180
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1181
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
function ne(uint32 a, gtUint32 b) internal returns (gtBool) {
|
|
1185
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1186
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
function ge(uint32 a, gtUint32 b) internal returns (gtBool) {
|
|
1190
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1191
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
function gt(uint32 a, gtUint32 b) internal returns (gtBool) {
|
|
1195
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1196
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
function le(uint32 a, gtUint32 b) internal returns (gtBool) {
|
|
1200
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1201
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
function lt(uint32 a, gtUint32 b) internal returns (gtBool) {
|
|
1205
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1206
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
function min(uint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
1210
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1211
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
function max(uint32 a, gtUint32 b) internal returns (gtUint32) {
|
|
1215
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1216
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), uint256(a), gtUint32.unwrap(b)));
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
// =========== 64 bit operations ==============
|
|
1221
|
+
|
|
1222
|
+
function add(uint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
1223
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1224
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
function sub(uint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
1228
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1229
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
function mul(uint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
1233
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1234
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
function div(uint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
1238
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1239
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
function rem(uint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
1243
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1244
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
function and(uint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
1248
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1249
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
function or(uint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
1253
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1254
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
function xor(uint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
1258
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1259
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
function shl(uint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
1263
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1264
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
function shr(uint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
1268
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1269
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
function eq(uint64 a, gtUint64 b) internal returns (gtBool) {
|
|
1273
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1274
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
function ne(uint64 a, gtUint64 b) internal returns (gtBool) {
|
|
1278
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1279
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
function ge(uint64 a, gtUint64 b) internal returns (gtBool) {
|
|
1283
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1284
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
function gt(uint64 a, gtUint64 b) internal returns (gtBool) {
|
|
1288
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1289
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
function le(uint64 a, gtUint64 b) internal returns (gtBool) {
|
|
1293
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1294
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
function lt(uint64 a, gtUint64 b) internal returns (gtBool) {
|
|
1298
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1299
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
function min(uint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
1303
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1304
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
function max(uint64 a, gtUint64 b) internal returns (gtUint64) {
|
|
1308
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1309
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), uint256(a), gtUint64.unwrap(b)));
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
// =========== Operations with RHS_PUBLIC parameter ===========
|
|
1314
|
+
// =========== 8 bit operations ==============
|
|
1315
|
+
|
|
1316
|
+
function add(gtUint8 a, uint8 b) internal returns (gtUint8) {
|
|
1317
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1318
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
function sub(gtUint8 a, uint8 b) internal returns (gtUint8) {
|
|
1322
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1323
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
function mul(gtUint8 a, uint8 b) internal returns (gtUint16) {
|
|
1327
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1328
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
function div(gtUint8 a, uint8 b) internal returns (gtUint8) {
|
|
1332
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1333
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
function rem(gtUint8 a, uint8 b) internal returns (gtUint8) {
|
|
1337
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1338
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
function and(gtUint8 a, uint8 b) internal returns (gtUint8) {
|
|
1342
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1343
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
function or(gtUint8 a, uint8 b) internal returns (gtUint8) {
|
|
1347
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1348
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
function xor(gtUint8 a, uint8 b) internal returns (gtUint8) {
|
|
1352
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1353
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
function shl(gtUint8 a, uint8 b) internal returns (gtUint8) {
|
|
1357
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1358
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
function shr(gtUint8 a, uint8 b) internal returns (gtUint8) {
|
|
1362
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1363
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
function eq(gtUint8 a, uint8 b) internal returns (gtBool) {
|
|
1367
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1368
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
function ne(gtUint8 a, uint8 b) internal returns (gtBool) {
|
|
1372
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1373
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
function ge(gtUint8 a, uint8 b) internal returns (gtBool) {
|
|
1377
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1378
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
function gt(gtUint8 a, uint8 b) internal returns (gtBool) {
|
|
1382
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1383
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
function le(gtUint8 a, uint8 b) internal returns (gtBool) {
|
|
1387
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1388
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
function lt(gtUint8 a, uint8 b) internal returns (gtBool) {
|
|
1392
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1393
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
function min(gtUint8 a, uint8 b) internal returns (gtUint8) {
|
|
1397
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1398
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
function max(gtUint8 a, uint8 b) internal returns (gtUint8) {
|
|
1402
|
+
return gtUint8.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1403
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint8.unwrap(a), uint256(b)));
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
// =========== 16 bit operations ==============
|
|
1407
|
+
|
|
1408
|
+
function add(gtUint16 a, uint16 b) internal returns (gtUint16) {
|
|
1409
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1410
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
function sub(gtUint16 a, uint16 b) internal returns (gtUint16) {
|
|
1414
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1415
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
function mul(gtUint16 a, uint16 b) internal returns (gtUint32) {
|
|
1419
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1420
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
function div(gtUint16 a, uint16 b) internal returns (gtUint16) {
|
|
1424
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1425
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
function rem(gtUint16 a, uint16 b) internal returns (gtUint16) {
|
|
1429
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1430
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
function and(gtUint16 a, uint16 b) internal returns (gtUint16) {
|
|
1434
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1435
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
function or(gtUint16 a, uint16 b) internal returns (gtUint16) {
|
|
1439
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1440
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
function xor(gtUint16 a, uint16 b) internal returns (gtUint16) {
|
|
1444
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1445
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
function shl(gtUint16 a, uint16 b) internal returns (gtUint16) {
|
|
1449
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1450
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
function shr(gtUint16 a, uint16 b) internal returns (gtUint16) {
|
|
1454
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1455
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
function eq(gtUint16 a, uint16 b) internal returns (gtBool) {
|
|
1459
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1460
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
function ne(gtUint16 a, uint16 b) internal returns (gtBool) {
|
|
1464
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1465
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
function ge(gtUint16 a, uint16 b) internal returns (gtBool) {
|
|
1469
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1470
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
function gt(gtUint16 a, uint16 b) internal returns (gtBool) {
|
|
1474
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1475
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
function le(gtUint16 a, uint16 b) internal returns (gtBool) {
|
|
1479
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1480
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
function lt(gtUint16 a, uint16 b) internal returns (gtBool) {
|
|
1484
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1485
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
function min(gtUint16 a, uint16 b) internal returns (gtUint16) {
|
|
1489
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1490
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
function max(gtUint16 a, uint16 b) internal returns (gtUint16) {
|
|
1494
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1495
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.RHS_PUBLIC), gtUint16.unwrap(a), uint256(b)));
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
|
|
1499
|
+
// =========== 32 bit operations ==============
|
|
1500
|
+
|
|
1501
|
+
function add(gtUint32 a, uint32 b) internal returns (gtUint32) {
|
|
1502
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1503
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
function sub(gtUint32 a, uint32 b) internal returns (gtUint32) {
|
|
1507
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1508
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
function mul(gtUint32 a, uint32 b) internal returns (gtUint64) {
|
|
1512
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1513
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
function div(gtUint32 a, uint32 b) internal returns (gtUint32) {
|
|
1517
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1518
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
function rem(gtUint32 a, uint32 b) internal returns (gtUint32) {
|
|
1522
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1523
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
function and(gtUint32 a, uint32 b) internal returns (gtUint32) {
|
|
1527
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1528
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1529
|
+
}
|
|
1530
|
+
function or(gtUint32 a, uint32 b) internal returns (gtUint32) {
|
|
1531
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1532
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
function xor(gtUint32 a, uint32 b) internal returns (gtUint32) {
|
|
1536
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1537
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
function shl(gtUint32 a, uint32 b) internal returns (gtUint32) {
|
|
1541
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1542
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
function shr(gtUint32 a, uint32 b) internal returns (gtUint32) {
|
|
1546
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1547
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
function eq(gtUint32 a, uint32 b) internal returns (gtBool) {
|
|
1551
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1552
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
function ne(gtUint32 a, uint32 b) internal returns (gtBool) {
|
|
1556
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1557
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
function ge(gtUint32 a, uint32 b) internal returns (gtBool) {
|
|
1561
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1562
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
function gt(gtUint32 a, uint32 b) internal returns (gtBool) {
|
|
1566
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1567
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
function le(gtUint32 a, uint32 b) internal returns (gtBool) {
|
|
1571
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1572
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
function lt(gtUint32 a, uint32 b) internal returns (gtBool) {
|
|
1576
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1577
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
function min(gtUint32 a, uint32 b) internal returns (gtUint32) {
|
|
1581
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1582
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
function max(gtUint32 a, uint32 b) internal returns (gtUint32) {
|
|
1586
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1587
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.RHS_PUBLIC), gtUint32.unwrap(a), uint256(b)));
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
// =========== 64 bit operations ==============
|
|
1592
|
+
|
|
1593
|
+
function add(gtUint64 a, uint64 b) internal returns (gtUint64) {
|
|
1594
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1595
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
function sub(gtUint64 a, uint64 b) internal returns (gtUint64) {
|
|
1599
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1600
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
function mul(gtUint64 a, uint64 b) internal returns (gtUint64) {
|
|
1604
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1605
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
function div(gtUint64 a, uint64 b) internal returns (gtUint64) {
|
|
1609
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1610
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
function rem(gtUint64 a, uint64 b) internal returns (gtUint64) {
|
|
1614
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1615
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
function and(gtUint64 a, uint64 b) internal returns (gtUint64) {
|
|
1619
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1620
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
function or(gtUint64 a, uint64 b) internal returns (gtUint64) {
|
|
1624
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1625
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
function xor(gtUint64 a, uint64 b) internal returns (gtUint64) {
|
|
1629
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1630
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
function shl(gtUint64 a, uint64 b) internal returns (gtUint64) {
|
|
1634
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1635
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
function shr(gtUint64 a, uint64 b) internal returns (gtUint64) {
|
|
1639
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1640
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
function eq(gtUint64 a, uint64 b) internal returns (gtBool) {
|
|
1644
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1645
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
function ne(gtUint64 a, uint64 b) internal returns (gtBool) {
|
|
1649
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1650
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
function ge(gtUint64 a, uint64 b) internal returns (gtBool) {
|
|
1654
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1655
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
function gt(gtUint64 a, uint64 b) internal returns (gtBool) {
|
|
1659
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1660
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
function le(gtUint64 a, uint64 b) internal returns (gtBool) {
|
|
1664
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1665
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
function lt(gtUint64 a, uint64 b) internal returns (gtBool) {
|
|
1669
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1670
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
function min(gtUint64 a, uint64 b) internal returns (gtUint64) {
|
|
1674
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1675
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
function max(gtUint64 a, uint64 b) internal returns (gtUint64) {
|
|
1679
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1680
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.RHS_PUBLIC), gtUint64.unwrap(a), uint256(b)));
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
// In the context of a transfer, scalar balances are irrelevant;
|
|
1684
|
+
// The only possibility for a scalar value is within the "amount" parameter.
|
|
1685
|
+
// Therefore, in this scenario, LHS_PUBLIC signifies a scalar amount, not balance1.
|
|
1686
|
+
|
|
1687
|
+
function transfer(gtUint8 a, gtUint8 b, uint8 amount) internal returns (gtUint8, gtUint8, gtBool){
|
|
1688
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1689
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.LHS_PUBLIC), gtUint8.unwrap(a), gtUint8.unwrap(b), uint256(amount));
|
|
1690
|
+
return (gtUint8.wrap(new_a), gtUint8.wrap(new_b), gtBool.wrap(res));
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
function transfer(gtUint16 a, gtUint16 b, uint16 amount) internal returns (gtUint16, gtUint16, gtBool){
|
|
1694
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1695
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), gtUint16.unwrap(a), gtUint16.unwrap(b), uint256(amount));
|
|
1696
|
+
return (gtUint16.wrap(new_a), gtUint16.wrap(new_b), gtBool.wrap(res));
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
function transfer(gtUint8 a, gtUint16 b, uint16 amount) internal returns (gtUint16, gtUint16, gtBool){
|
|
1700
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1701
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), gtUint8.unwrap(a), gtUint16.unwrap(b), uint256(amount));
|
|
1702
|
+
return (gtUint16.wrap(new_a), gtUint16.wrap(new_b), gtBool.wrap(res));
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
function transfer(gtUint16 a, gtUint8 b, uint16 amount) internal returns (gtUint16, gtUint16, gtBool){
|
|
1706
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1707
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.LHS_PUBLIC), gtUint16.unwrap(a), gtUint8.unwrap(b), uint256(amount));
|
|
1708
|
+
return (gtUint16.wrap(new_a), gtUint16.wrap(new_b), gtBool.wrap(res));
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
function transfer(gtUint32 a, gtUint32 b, uint32 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
1712
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1713
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), gtUint32.unwrap(a), gtUint32.unwrap(b), uint256(amount));
|
|
1714
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
function transfer(gtUint8 a, gtUint32 b, uint32 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
1718
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1719
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), gtUint8.unwrap(a), gtUint32.unwrap(b), uint256(amount));
|
|
1720
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
function transfer(gtUint32 a, gtUint8 b, uint32 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
1724
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1725
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), gtUint32.unwrap(a), gtUint8.unwrap(b), uint256(amount));
|
|
1726
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
function transfer(gtUint16 a, gtUint32 b, uint32 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
1730
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1731
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), gtUint16.unwrap(a), gtUint32.unwrap(b), uint256(amount));
|
|
1732
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
function transfer(gtUint32 a, gtUint16 b, uint32 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
1736
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1737
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.LHS_PUBLIC), gtUint32.unwrap(a), gtUint16.unwrap(b), uint256(amount));
|
|
1738
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
function transfer(gtUint64 a, gtUint64 b, uint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
1742
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1743
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), gtUint64.unwrap(a), gtUint64.unwrap(b), uint256(amount));
|
|
1744
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
function transfer(gtUint8 a, gtUint64 b, uint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
1748
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1749
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), gtUint8.unwrap(a), gtUint64.unwrap(b), uint256(amount));
|
|
1750
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
function transfer(gtUint64 a, gtUint8 b, uint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
1754
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1755
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), gtUint64.unwrap(a), gtUint8.unwrap(b), uint256(amount));
|
|
1756
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
function transfer(gtUint16 a, gtUint64 b, uint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
1760
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1761
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), gtUint16.unwrap(a), gtUint64.unwrap(b), uint256(amount));
|
|
1762
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
function transfer(gtUint64 a, gtUint16 b, uint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
1766
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1767
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), gtUint64.unwrap(a), gtUint16.unwrap(b), uint256(amount));
|
|
1768
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
function transfer(gtUint32 a, gtUint64 b, uint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
1772
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1773
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), gtUint32.unwrap(a), gtUint64.unwrap(b), uint256(amount));
|
|
1774
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
function transfer(gtUint64 a, gtUint32 b, uint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
1778
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1779
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.LHS_PUBLIC), gtUint64.unwrap(a), gtUint32.unwrap(b), uint256(amount));
|
|
1780
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
|
|
1784
|
+
// ================= Cast operation =================
|
|
1785
|
+
// =========== 8 - 16 bit operations ==============
|
|
1786
|
+
|
|
1787
|
+
function add(gtUint8 a, gtUint16 b) internal returns (gtUint16) {
|
|
1788
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1789
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
function add(gtUint16 a, gtUint8 b) internal returns (gtUint16) {
|
|
1793
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1794
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
function sub(gtUint8 a, gtUint16 b) internal returns (gtUint16) {
|
|
1798
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1799
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
function sub(gtUint16 a, gtUint8 b) internal returns (gtUint16) {
|
|
1803
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1804
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
function mul(gtUint8 a, gtUint16 b) internal returns (gtUint32) {
|
|
1808
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1809
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
function mul(gtUint16 a, gtUint8 b) internal returns (gtUint32) {
|
|
1813
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1814
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
function div(gtUint8 a, gtUint16 b) internal returns (gtUint16) {
|
|
1818
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1819
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
function div(gtUint16 a, gtUint8 b) internal returns (gtUint16) {
|
|
1823
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1824
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
function rem(gtUint8 a, gtUint16 b) internal returns (gtUint16) {
|
|
1828
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1829
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
function rem(gtUint16 a, gtUint8 b) internal returns (gtUint16) {
|
|
1833
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1834
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
function and(gtUint8 a, gtUint16 b) internal returns (gtUint16) {
|
|
1838
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1839
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
function and(gtUint16 a, gtUint8 b) internal returns (gtUint16) {
|
|
1843
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1844
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
function or(gtUint8 a, gtUint16 b) internal returns (gtUint16) {
|
|
1848
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1849
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
function or(gtUint16 a, gtUint8 b) internal returns (gtUint16) {
|
|
1853
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1854
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
function xor(gtUint8 a, gtUint16 b) internal returns (gtUint16) {
|
|
1858
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1859
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
function xor(gtUint16 a, gtUint8 b) internal returns (gtUint16) {
|
|
1863
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1864
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
function shl(gtUint8 a, gtUint16 b) internal returns (gtUint16) {
|
|
1868
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1869
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
function shl(gtUint16 a, gtUint8 b) internal returns (gtUint16) {
|
|
1873
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1874
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
function shr(gtUint8 a, gtUint16 b) internal returns (gtUint16) {
|
|
1878
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1879
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
function shr(gtUint16 a, gtUint8 b) internal returns (gtUint16) {
|
|
1883
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1884
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
function eq(gtUint8 a, gtUint16 b) internal returns (gtBool) {
|
|
1888
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1889
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
function eq(gtUint16 a, gtUint8 b) internal returns (gtBool) {
|
|
1893
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1894
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
function ne(gtUint8 a, gtUint16 b) internal returns (gtBool) {
|
|
1898
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1899
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
function ne(gtUint16 a, gtUint8 b) internal returns (gtBool) {
|
|
1903
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1904
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
function ge(gtUint8 a, gtUint16 b) internal returns (gtBool) {
|
|
1908
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1909
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
function ge(gtUint16 a, gtUint8 b) internal returns (gtBool) {
|
|
1913
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1914
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
function gt(gtUint8 a, gtUint16 b) internal returns (gtBool) {
|
|
1918
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1919
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
function gt(gtUint16 a, gtUint8 b) internal returns (gtBool) {
|
|
1923
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1924
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
function le(gtUint8 a, gtUint16 b) internal returns (gtBool) {
|
|
1928
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1929
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
function le(gtUint16 a, gtUint8 b) internal returns (gtBool) {
|
|
1933
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1934
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
function lt(gtUint8 a, gtUint16 b) internal returns (gtBool) {
|
|
1938
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1939
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
function lt(gtUint16 a, gtUint8 b) internal returns (gtBool) {
|
|
1943
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1944
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
function min(gtUint8 a, gtUint16 b) internal returns (gtUint16) {
|
|
1948
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1949
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
function min(gtUint16 a, gtUint8 b) internal returns (gtUint16) {
|
|
1953
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1954
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
function max(gtUint8 a, gtUint16 b) internal returns (gtUint16) {
|
|
1958
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1959
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
function max(gtUint16 a, gtUint8 b) internal returns (gtUint16) {
|
|
1963
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1964
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
function mux(gtBool bit, gtUint8 a, gtUint16 b) internal returns (gtUint16){
|
|
1968
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1969
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint8.unwrap(a), gtUint16.unwrap(b)));
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
function mux(gtBool bit, gtUint16 a, gtUint8 b) internal returns (gtUint16){
|
|
1973
|
+
return gtUint16.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
1974
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint16.unwrap(a), gtUint8.unwrap(b)));
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
function transfer(gtUint8 a, gtUint16 b, gtUint16 amount) internal returns (gtUint16, gtUint16, gtBool){
|
|
1978
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1979
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b), gtUint16.unwrap(amount));
|
|
1980
|
+
return (gtUint16.wrap(new_a), gtUint16.wrap(new_b), gtBool.wrap(res));
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
function transfer(gtUint16 a, gtUint8 b, gtUint16 amount) internal returns (gtUint16, gtUint16, gtBool){
|
|
1984
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1985
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b), gtUint16.unwrap(amount));
|
|
1986
|
+
return (gtUint16.wrap(new_a), gtUint16.wrap(new_b), gtBool.wrap(res));
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
function transfer(gtUint8 a, gtUint16 b, gtUint8 amount) internal returns (gtUint16, gtUint16, gtBool){
|
|
1990
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1991
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint16.unwrap(b), gtUint8.unwrap(amount));
|
|
1992
|
+
return (gtUint16.wrap(new_a), gtUint16.wrap(new_b), gtBool.wrap(res));
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
function transfer(gtUint16 a, gtUint8 b, gtUint8 amount) internal returns (gtUint16, gtUint16, gtBool){
|
|
1996
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
1997
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint8.unwrap(b), gtUint8.unwrap(amount));
|
|
1998
|
+
return (gtUint16.wrap(new_a), gtUint16.wrap(new_b), gtBool.wrap(res));
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
function transfer(gtUint16 a, gtUint16 b, gtUint8 amount) internal returns (gtUint16, gtUint16, gtBool){
|
|
2002
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2003
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint16.unwrap(b), gtUint8.unwrap(amount));
|
|
2004
|
+
return (gtUint16.wrap(new_a), gtUint16.wrap(new_b), gtBool.wrap(res));
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
|
|
2008
|
+
// =========== 8-32 bit operations ==============
|
|
2009
|
+
|
|
2010
|
+
function add(gtUint8 a, gtUint32 b) internal returns (gtUint32) {
|
|
2011
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2012
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
function add(gtUint32 a, gtUint8 b) internal returns (gtUint32) {
|
|
2016
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2017
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2020
|
+
function sub(gtUint8 a, gtUint32 b) internal returns (gtUint32) {
|
|
2021
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2022
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
function sub(gtUint32 a, gtUint8 b) internal returns (gtUint32) {
|
|
2026
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2027
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
function mul(gtUint8 a, gtUint32 b) internal returns (gtUint64) {
|
|
2031
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2032
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
function mul(gtUint32 a, gtUint8 b) internal returns (gtUint64) {
|
|
2036
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2037
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
function div(gtUint8 a, gtUint32 b) internal returns (gtUint32) {
|
|
2041
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2042
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
function div(gtUint32 a, gtUint8 b) internal returns (gtUint32) {
|
|
2046
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2047
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
function rem(gtUint8 a, gtUint32 b) internal returns (gtUint32) {
|
|
2051
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2052
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
function rem(gtUint32 a, gtUint8 b) internal returns (gtUint32) {
|
|
2056
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2057
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
function and(gtUint8 a, gtUint32 b) internal returns (gtUint32) {
|
|
2061
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2062
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
function and(gtUint32 a, gtUint8 b) internal returns (gtUint32) {
|
|
2066
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2067
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
function or(gtUint8 a, gtUint32 b) internal returns (gtUint32) {
|
|
2071
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2072
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
function or(gtUint32 a, gtUint8 b) internal returns (gtUint32) {
|
|
2076
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2077
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
function xor(gtUint8 a, gtUint32 b) internal returns (gtUint32) {
|
|
2081
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2082
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
function xor(gtUint32 a, gtUint8 b) internal returns (gtUint32) {
|
|
2086
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2087
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
function shl(gtUint8 a, gtUint32 b) internal returns (gtUint32) {
|
|
2091
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2092
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
function shl(gtUint32 a, gtUint8 b) internal returns (gtUint32) {
|
|
2096
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2097
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
function shr(gtUint8 a, gtUint32 b) internal returns (gtUint32) {
|
|
2101
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2102
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
function shr(gtUint32 a, gtUint8 b) internal returns (gtUint32) {
|
|
2106
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2107
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
function eq(gtUint8 a, gtUint32 b) internal returns (gtBool) {
|
|
2111
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2112
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
function eq(gtUint32 a, gtUint8 b) internal returns (gtBool) {
|
|
2116
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2117
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
function ne(gtUint8 a, gtUint32 b) internal returns (gtBool) {
|
|
2121
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2122
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
function ne(gtUint32 a, gtUint8 b) internal returns (gtBool) {
|
|
2126
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2127
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
function ge(gtUint8 a, gtUint32 b) internal returns (gtBool) {
|
|
2131
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2132
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
function ge(gtUint32 a, gtUint8 b) internal returns (gtBool) {
|
|
2136
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2137
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
function gt(gtUint8 a, gtUint32 b) internal returns (gtBool) {
|
|
2141
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2142
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
function gt(gtUint32 a, gtUint8 b) internal returns (gtBool) {
|
|
2146
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2147
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
function le(gtUint8 a, gtUint32 b) internal returns (gtBool) {
|
|
2151
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2152
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
function le(gtUint32 a, gtUint8 b) internal returns (gtBool) {
|
|
2156
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2157
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
function lt(gtUint8 a, gtUint32 b) internal returns (gtBool) {
|
|
2161
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2162
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
function lt(gtUint32 a, gtUint8 b) internal returns (gtBool) {
|
|
2166
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2167
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
function min(gtUint8 a, gtUint32 b) internal returns (gtUint32) {
|
|
2171
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2172
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
function min(gtUint32 a, gtUint8 b) internal returns (gtUint32) {
|
|
2176
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2177
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
function max(gtUint8 a, gtUint32 b) internal returns (gtUint32) {
|
|
2181
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2182
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
function max(gtUint32 a, gtUint8 b) internal returns (gtUint32) {
|
|
2186
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2187
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
function mux(gtBool bit, gtUint8 a, gtUint32 b) internal returns (gtUint32){
|
|
2191
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2192
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint8.unwrap(a), gtUint32.unwrap(b)));
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
function mux(gtBool bit, gtUint32 a, gtUint8 b) internal returns (gtUint32){
|
|
2196
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2197
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint32.unwrap(a), gtUint8.unwrap(b)));
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
function transfer(gtUint8 a, gtUint32 b, gtUint32 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2201
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2202
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b), gtUint32.unwrap(amount));
|
|
2203
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
function transfer(gtUint32 a, gtUint8 b, gtUint32 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2207
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2208
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b), gtUint32.unwrap(amount));
|
|
2209
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2212
|
+
function transfer(gtUint8 a, gtUint32 b, gtUint8 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2213
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2214
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b), gtUint8.unwrap(amount));
|
|
2215
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
function transfer(gtUint32 a, gtUint8 b, gtUint8 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2219
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2220
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b), gtUint8.unwrap(amount));
|
|
2221
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
function transfer(gtUint8 a, gtUint32 b, gtUint16 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2225
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2226
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint32.unwrap(b), gtUint16.unwrap(amount));
|
|
2227
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
function transfer(gtUint32 a, gtUint8 b, gtUint16 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2231
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2232
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint8.unwrap(b), gtUint16.unwrap(amount));
|
|
2233
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
function transfer(gtUint32 a, gtUint32 b, gtUint8 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2237
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2238
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b), gtUint8.unwrap(amount));
|
|
2239
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
|
|
2243
|
+
// =========== 16 - 32 bit operations ==============
|
|
2244
|
+
|
|
2245
|
+
function add(gtUint16 a, gtUint32 b) internal returns (gtUint32) {
|
|
2246
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2247
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
function add(gtUint32 a, gtUint16 b) internal returns (gtUint32) {
|
|
2251
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2252
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
function sub(gtUint16 a, gtUint32 b) internal returns (gtUint32) {
|
|
2256
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2257
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
function sub(gtUint32 a, gtUint16 b) internal returns (gtUint32) {
|
|
2261
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2262
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
function mul(gtUint16 a, gtUint32 b) internal returns (gtUint64) {
|
|
2266
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2267
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
function mul(gtUint32 a, gtUint16 b) internal returns (gtUint64) {
|
|
2271
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2272
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
function div(gtUint16 a, gtUint32 b) internal returns (gtUint32) {
|
|
2276
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2277
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
function div(gtUint32 a, gtUint16 b) internal returns (gtUint32) {
|
|
2281
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2282
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
function rem(gtUint16 a, gtUint32 b) internal returns (gtUint32) {
|
|
2286
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2287
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
function rem(gtUint32 a, gtUint16 b) internal returns (gtUint32) {
|
|
2291
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2292
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
function and(gtUint16 a, gtUint32 b) internal returns (gtUint32) {
|
|
2296
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2297
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
function and(gtUint32 a, gtUint16 b) internal returns (gtUint32) {
|
|
2301
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2302
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
function or(gtUint16 a, gtUint32 b) internal returns (gtUint32) {
|
|
2306
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2307
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
function or(gtUint32 a, gtUint16 b) internal returns (gtUint32) {
|
|
2311
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2312
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
function xor(gtUint16 a, gtUint32 b) internal returns (gtUint32) {
|
|
2316
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2317
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
function xor(gtUint32 a, gtUint16 b) internal returns (gtUint32) {
|
|
2321
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2322
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
function shl(gtUint16 a, gtUint32 b) internal returns (gtUint32) {
|
|
2326
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2327
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
function shl(gtUint32 a, gtUint16 b) internal returns (gtUint32) {
|
|
2331
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2332
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
function shr(gtUint16 a, gtUint32 b) internal returns (gtUint32) {
|
|
2336
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2337
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
function shr(gtUint32 a, gtUint16 b) internal returns (gtUint32) {
|
|
2341
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2342
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
function eq(gtUint16 a, gtUint32 b) internal returns (gtBool) {
|
|
2346
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2347
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
function eq(gtUint32 a, gtUint16 b) internal returns (gtBool) {
|
|
2351
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2352
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
function ne(gtUint16 a, gtUint32 b) internal returns (gtBool) {
|
|
2356
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2357
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
function ne(gtUint32 a, gtUint16 b) internal returns (gtBool) {
|
|
2361
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2362
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
function ge(gtUint16 a, gtUint32 b) internal returns (gtBool) {
|
|
2366
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2367
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
function ge(gtUint32 a, gtUint16 b) internal returns (gtBool) {
|
|
2371
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2372
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
function gt(gtUint16 a, gtUint32 b) internal returns (gtBool) {
|
|
2376
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2377
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
function gt(gtUint32 a, gtUint16 b) internal returns (gtBool) {
|
|
2381
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2382
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2383
|
+
}
|
|
2384
|
+
|
|
2385
|
+
function le(gtUint16 a, gtUint32 b) internal returns (gtBool) {
|
|
2386
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2387
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
function le(gtUint32 a, gtUint16 b) internal returns (gtBool) {
|
|
2391
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2392
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
function lt(gtUint16 a, gtUint32 b) internal returns (gtBool) {
|
|
2396
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2397
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
function lt(gtUint32 a, gtUint16 b) internal returns (gtBool) {
|
|
2401
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2402
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
function min(gtUint16 a, gtUint32 b) internal returns (gtUint32) {
|
|
2406
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2407
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
function min(gtUint32 a, gtUint16 b) internal returns (gtUint32) {
|
|
2411
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2412
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2415
|
+
function max(gtUint16 a, gtUint32 b) internal returns (gtUint32) {
|
|
2416
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2417
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
function max(gtUint32 a, gtUint16 b) internal returns (gtUint32) {
|
|
2421
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2422
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2425
|
+
function mux(gtBool bit, gtUint16 a, gtUint32 b) internal returns (gtUint32){
|
|
2426
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2427
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint16.unwrap(a), gtUint32.unwrap(b)));
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
function mux(gtBool bit, gtUint32 a, gtUint16 b) internal returns (gtUint32){
|
|
2431
|
+
return gtUint32.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2432
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint32.unwrap(a), gtUint16.unwrap(b)));
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
function transfer(gtUint16 a, gtUint32 b, gtUint32 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2436
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2437
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b), gtUint32.unwrap(amount));
|
|
2438
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
function transfer(gtUint32 a, gtUint16 b, gtUint32 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2442
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2443
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b), gtUint32.unwrap(amount));
|
|
2444
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
function transfer(gtUint16 a, gtUint32 b, gtUint8 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2448
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2449
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b), gtUint8.unwrap(amount));
|
|
2450
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
function transfer(gtUint32 a, gtUint16 b, gtUint8 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2454
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2455
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b), gtUint8.unwrap(amount));
|
|
2456
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
function transfer(gtUint16 a, gtUint32 b, gtUint16 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2460
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2461
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint32.unwrap(b), gtUint16.unwrap(amount));
|
|
2462
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
function transfer(gtUint32 a, gtUint16 b, gtUint16 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2466
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2467
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint16.unwrap(b), gtUint16.unwrap(amount));
|
|
2468
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
function transfer(gtUint32 a, gtUint32 b, gtUint16 amount) internal returns (gtUint32, gtUint32, gtBool){
|
|
2472
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2473
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint32.unwrap(b), gtUint16.unwrap(amount));
|
|
2474
|
+
return (gtUint32.wrap(new_a), gtUint32.wrap(new_b), gtBool.wrap(res));
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
|
|
2478
|
+
// =========== 8 - 64 bit operations ==============
|
|
2479
|
+
|
|
2480
|
+
function add(gtUint8 a, gtUint64 b) internal returns (gtUint64) {
|
|
2481
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2482
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2485
|
+
function add(gtUint64 a, gtUint8 b) internal returns (gtUint64) {
|
|
2486
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2487
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
function sub(gtUint8 a, gtUint64 b) internal returns (gtUint64) {
|
|
2491
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2492
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
function sub(gtUint64 a, gtUint8 b) internal returns (gtUint64) {
|
|
2496
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2497
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
function mul(gtUint8 a, gtUint64 b) internal returns (gtUint64) {
|
|
2501
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2502
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
function mul(gtUint64 a, gtUint8 b) internal returns (gtUint64) {
|
|
2506
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2507
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
function div(gtUint8 a, gtUint64 b) internal returns (gtUint64) {
|
|
2511
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2512
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
function div(gtUint64 a, gtUint8 b) internal returns (gtUint64) {
|
|
2516
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2517
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
function rem(gtUint8 a, gtUint64 b) internal returns (gtUint64) {
|
|
2521
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2522
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
function rem(gtUint64 a, gtUint8 b) internal returns (gtUint64) {
|
|
2526
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2527
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
function and(gtUint8 a, gtUint64 b) internal returns (gtUint64) {
|
|
2531
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2532
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
function and(gtUint64 a, gtUint8 b) internal returns (gtUint64) {
|
|
2536
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2537
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
function or(gtUint8 a, gtUint64 b) internal returns (gtUint64) {
|
|
2541
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2542
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
function or(gtUint64 a, gtUint8 b) internal returns (gtUint64) {
|
|
2546
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2547
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
function xor(gtUint8 a, gtUint64 b) internal returns (gtUint64) {
|
|
2551
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2552
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
function xor(gtUint64 a, gtUint8 b) internal returns (gtUint64) {
|
|
2556
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2557
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2560
|
+
function shl(gtUint8 a, gtUint64 b) internal returns (gtUint64) {
|
|
2561
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2562
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
function shl(gtUint64 a, gtUint8 b) internal returns (gtUint64) {
|
|
2566
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2567
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
function shr(gtUint8 a, gtUint64 b) internal returns (gtUint64) {
|
|
2571
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2572
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
function shr(gtUint64 a, gtUint8 b) internal returns (gtUint64) {
|
|
2576
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2577
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
function eq(gtUint8 a, gtUint64 b) internal returns (gtBool) {
|
|
2581
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2582
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
function eq(gtUint64 a, gtUint8 b) internal returns (gtBool) {
|
|
2586
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2587
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
function ne(gtUint8 a, gtUint64 b) internal returns (gtBool) {
|
|
2591
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2592
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2595
|
+
function ne(gtUint64 a, gtUint8 b) internal returns (gtBool) {
|
|
2596
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2597
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
function ge(gtUint8 a, gtUint64 b) internal returns (gtBool) {
|
|
2601
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2602
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
function ge(gtUint64 a, gtUint8 b) internal returns (gtBool) {
|
|
2606
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2607
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2610
|
+
function gt(gtUint8 a, gtUint64 b) internal returns (gtBool) {
|
|
2611
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2612
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
function gt(gtUint64 a, gtUint8 b) internal returns (gtBool) {
|
|
2616
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2617
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
function le(gtUint8 a, gtUint64 b) internal returns (gtBool) {
|
|
2621
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2622
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2623
|
+
}
|
|
2624
|
+
|
|
2625
|
+
function le(gtUint64 a, gtUint8 b) internal returns (gtBool) {
|
|
2626
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2627
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
function lt(gtUint8 a, gtUint64 b) internal returns (gtBool) {
|
|
2631
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2632
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2635
|
+
function lt(gtUint64 a, gtUint8 b) internal returns (gtBool) {
|
|
2636
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2637
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
function min(gtUint8 a, gtUint64 b) internal returns (gtUint64) {
|
|
2641
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2642
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
function min(gtUint64 a, gtUint8 b) internal returns (gtUint64) {
|
|
2646
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2647
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
function max(gtUint8 a, gtUint64 b) internal returns (gtUint64) {
|
|
2651
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2652
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
function max(gtUint64 a, gtUint8 b) internal returns (gtUint64) {
|
|
2656
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2657
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2660
|
+
function mux(gtBool bit, gtUint8 a, gtUint64 b) internal returns (gtUint64){
|
|
2661
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2662
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint8.unwrap(a), gtUint64.unwrap(b)));
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
function mux(gtBool bit, gtUint64 a, gtUint8 b) internal returns (gtUint64){
|
|
2666
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2667
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint64.unwrap(a), gtUint8.unwrap(b)));
|
|
2668
|
+
}
|
|
2669
|
+
|
|
2670
|
+
function transfer(gtUint8 a, gtUint64 b, gtUint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2671
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2672
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b), gtUint64.unwrap(amount));
|
|
2673
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2676
|
+
function transfer(gtUint64 a, gtUint8 b, gtUint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2677
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2678
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b), gtUint64.unwrap(amount));
|
|
2679
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
function transfer(gtUint8 a, gtUint64 b, gtUint8 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2683
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2684
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b), gtUint8.unwrap(amount));
|
|
2685
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
function transfer(gtUint64 a, gtUint8 b, gtUint8 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2689
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2690
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b), gtUint8.unwrap(amount));
|
|
2691
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
function transfer(gtUint8 a, gtUint64 b, gtUint16 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2695
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2696
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b), gtUint16.unwrap(amount));
|
|
2697
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2700
|
+
function transfer(gtUint64 a, gtUint8 b, gtUint16 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2701
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2702
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b), gtUint16.unwrap(amount));
|
|
2703
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
function transfer(gtUint8 a, gtUint64 b, gtUint32 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2707
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2708
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint8.unwrap(a), gtUint64.unwrap(b), gtUint32.unwrap(amount));
|
|
2709
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2710
|
+
}
|
|
2711
|
+
|
|
2712
|
+
function transfer(gtUint64 a, gtUint8 b, gtUint32 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2713
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2714
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint8.unwrap(b), gtUint32.unwrap(amount));
|
|
2715
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
function transfer(gtUint64 a, gtUint64 b, gtUint8 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2719
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2720
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b), gtUint8.unwrap(amount));
|
|
2721
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2724
|
+
// =========== 16 - 64 bit operations ==============
|
|
2725
|
+
|
|
2726
|
+
function add(gtUint16 a, gtUint64 b) internal returns (gtUint64) {
|
|
2727
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2728
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
function add(gtUint64 a, gtUint16 b) internal returns (gtUint64) {
|
|
2732
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2733
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
function sub(gtUint16 a, gtUint64 b) internal returns (gtUint64) {
|
|
2737
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2738
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
function sub(gtUint64 a, gtUint16 b) internal returns (gtUint64) {
|
|
2742
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2743
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
function mul(gtUint16 a, gtUint64 b) internal returns (gtUint64) {
|
|
2747
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2748
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2751
|
+
function mul(gtUint64 a, gtUint16 b) internal returns (gtUint64) {
|
|
2752
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2753
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2756
|
+
function div(gtUint16 a, gtUint64 b) internal returns (gtUint64) {
|
|
2757
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2758
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
function div(gtUint64 a, gtUint16 b) internal returns (gtUint64) {
|
|
2762
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2763
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
function rem(gtUint16 a, gtUint64 b) internal returns (gtUint64) {
|
|
2767
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2768
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
function rem(gtUint64 a, gtUint16 b) internal returns (gtUint64) {
|
|
2772
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2773
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
function and(gtUint16 a, gtUint64 b) internal returns (gtUint64) {
|
|
2777
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2778
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
function and(gtUint64 a, gtUint16 b) internal returns (gtUint64) {
|
|
2782
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2783
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
function or(gtUint16 a, gtUint64 b) internal returns (gtUint64) {
|
|
2787
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2788
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2789
|
+
}
|
|
2790
|
+
|
|
2791
|
+
function or(gtUint64 a, gtUint16 b) internal returns (gtUint64) {
|
|
2792
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2793
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
function xor(gtUint16 a, gtUint64 b) internal returns (gtUint64) {
|
|
2797
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2798
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
function xor(gtUint64 a, gtUint16 b) internal returns (gtUint64) {
|
|
2802
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2803
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
function shl(gtUint16 a, gtUint64 b) internal returns (gtUint64) {
|
|
2807
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2808
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
function shl(gtUint64 a, gtUint16 b) internal returns (gtUint64) {
|
|
2812
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2813
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
function shr(gtUint16 a, gtUint64 b) internal returns (gtUint64) {
|
|
2817
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2818
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2819
|
+
}
|
|
2820
|
+
|
|
2821
|
+
function shr(gtUint64 a, gtUint16 b) internal returns (gtUint64) {
|
|
2822
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2823
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
function eq(gtUint16 a, gtUint64 b) internal returns (gtBool) {
|
|
2827
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2828
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
function eq(gtUint64 a, gtUint16 b) internal returns (gtBool) {
|
|
2832
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2833
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
function ne(gtUint16 a, gtUint64 b) internal returns (gtBool) {
|
|
2837
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2838
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
function ne(gtUint64 a, gtUint16 b) internal returns (gtBool) {
|
|
2842
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2843
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
function ge(gtUint16 a, gtUint64 b) internal returns (gtBool) {
|
|
2847
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2848
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
function ge(gtUint64 a, gtUint16 b) internal returns (gtBool) {
|
|
2852
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2853
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
function gt(gtUint16 a, gtUint64 b) internal returns (gtBool) {
|
|
2857
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2858
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
function gt(gtUint64 a, gtUint16 b) internal returns (gtBool) {
|
|
2862
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2863
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2866
|
+
function le(gtUint16 a, gtUint64 b) internal returns (gtBool) {
|
|
2867
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2868
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
function le(gtUint64 a, gtUint16 b) internal returns (gtBool) {
|
|
2872
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2873
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
function lt(gtUint16 a, gtUint64 b) internal returns (gtBool) {
|
|
2877
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2878
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
function lt(gtUint64 a, gtUint16 b) internal returns (gtBool) {
|
|
2882
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2883
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2886
|
+
function min(gtUint16 a, gtUint64 b) internal returns (gtUint64) {
|
|
2887
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2888
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
function min(gtUint64 a, gtUint16 b) internal returns (gtUint64) {
|
|
2892
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2893
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
function max(gtUint16 a, gtUint64 b) internal returns (gtUint64) {
|
|
2897
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2898
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
function max(gtUint64 a, gtUint16 b) internal returns (gtUint64) {
|
|
2902
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2903
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
function mux(gtBool bit, gtUint16 a, gtUint64 b) internal returns (gtUint64){
|
|
2907
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2908
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint16.unwrap(a), gtUint64.unwrap(b)));
|
|
2909
|
+
}
|
|
2910
|
+
|
|
2911
|
+
function mux(gtBool bit, gtUint64 a, gtUint16 b) internal returns (gtUint64){
|
|
2912
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2913
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint64.unwrap(a), gtUint16.unwrap(b)));
|
|
2914
|
+
}
|
|
2915
|
+
|
|
2916
|
+
function transfer(gtUint16 a, gtUint64 b, gtUint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2917
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2918
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b), gtUint64.unwrap(amount));
|
|
2919
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
function transfer(gtUint64 a, gtUint16 b, gtUint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2923
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2924
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b), gtUint64.unwrap(amount));
|
|
2925
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
function transfer(gtUint16 a, gtUint64 b, gtUint8 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2929
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2930
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b), gtUint8.unwrap(amount));
|
|
2931
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
function transfer(gtUint64 a, gtUint16 b, gtUint8 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2935
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2936
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b), gtUint8.unwrap(amount));
|
|
2937
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
function transfer(gtUint16 a, gtUint64 b, gtUint16 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2941
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2942
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b), gtUint16.unwrap(amount));
|
|
2943
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2946
|
+
function transfer(gtUint64 a, gtUint16 b, gtUint16 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2947
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2948
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b), gtUint16.unwrap(amount));
|
|
2949
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2952
|
+
function transfer(gtUint16 a, gtUint64 b, gtUint32 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2953
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2954
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint16.unwrap(a), gtUint64.unwrap(b), gtUint32.unwrap(amount));
|
|
2955
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
function transfer(gtUint64 a, gtUint16 b, gtUint32 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2959
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2960
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint16.unwrap(b), gtUint32.unwrap(amount));
|
|
2961
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2962
|
+
}
|
|
2963
|
+
|
|
2964
|
+
function transfer(gtUint64 a, gtUint64 b, gtUint16 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
2965
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
2966
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b), gtUint16.unwrap(amount));
|
|
2967
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
2968
|
+
}
|
|
2969
|
+
|
|
2970
|
+
// =========== 32 - 64 bit operations ==============
|
|
2971
|
+
|
|
2972
|
+
function add(gtUint32 a, gtUint64 b) internal returns (gtUint64) {
|
|
2973
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2974
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2977
|
+
function add(gtUint64 a, gtUint32 b) internal returns (gtUint64) {
|
|
2978
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2979
|
+
Add(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
2980
|
+
}
|
|
2981
|
+
|
|
2982
|
+
function sub(gtUint32 a, gtUint64 b) internal returns (gtUint64) {
|
|
2983
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2984
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
function sub(gtUint64 a, gtUint32 b) internal returns (gtUint64) {
|
|
2988
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2989
|
+
Sub(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
function mul(gtUint32 a, gtUint64 b) internal returns (gtUint64) {
|
|
2993
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2994
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
2995
|
+
}
|
|
2996
|
+
|
|
2997
|
+
function mul(gtUint64 a, gtUint32 b) internal returns (gtUint64) {
|
|
2998
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
2999
|
+
Mul(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3000
|
+
}
|
|
3001
|
+
|
|
3002
|
+
function div(gtUint32 a, gtUint64 b) internal returns (gtUint64) {
|
|
3003
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3004
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3005
|
+
}
|
|
3006
|
+
|
|
3007
|
+
function div(gtUint64 a, gtUint32 b) internal returns (gtUint64) {
|
|
3008
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3009
|
+
Div(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3010
|
+
}
|
|
3011
|
+
|
|
3012
|
+
function rem(gtUint32 a, gtUint64 b) internal returns (gtUint64) {
|
|
3013
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3014
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3017
|
+
function rem(gtUint64 a, gtUint32 b) internal returns (gtUint64) {
|
|
3018
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3019
|
+
Rem(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
function and(gtUint32 a, gtUint64 b) internal returns (gtUint64) {
|
|
3023
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3024
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
function and(gtUint64 a, gtUint32 b) internal returns (gtUint64) {
|
|
3028
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3029
|
+
And(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
function or(gtUint32 a, gtUint64 b) internal returns (gtUint64) {
|
|
3033
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3034
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3037
|
+
function or(gtUint64 a, gtUint32 b) internal returns (gtUint64) {
|
|
3038
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3039
|
+
Or(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3042
|
+
function xor(gtUint32 a, gtUint64 b) internal returns (gtUint64) {
|
|
3043
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3044
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
function xor(gtUint64 a, gtUint32 b) internal returns (gtUint64) {
|
|
3048
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3049
|
+
Xor(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
function shl(gtUint32 a, gtUint64 b) internal returns (gtUint64) {
|
|
3053
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3054
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3055
|
+
}
|
|
3056
|
+
|
|
3057
|
+
function shl(gtUint64 a, gtUint32 b) internal returns (gtUint64) {
|
|
3058
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3059
|
+
Shl(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
function shr(gtUint32 a, gtUint64 b) internal returns (gtUint64) {
|
|
3063
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3064
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3065
|
+
}
|
|
3066
|
+
|
|
3067
|
+
function shr(gtUint64 a, gtUint32 b) internal returns (gtUint64) {
|
|
3068
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3069
|
+
Shr(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
function eq(gtUint32 a, gtUint64 b) internal returns (gtBool) {
|
|
3073
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3074
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
function eq(gtUint64 a, gtUint32 b) internal returns (gtBool) {
|
|
3078
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3079
|
+
Eq(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3082
|
+
function ne(gtUint32 a, gtUint64 b) internal returns (gtBool) {
|
|
3083
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3084
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3087
|
+
function ne(gtUint64 a, gtUint32 b) internal returns (gtBool) {
|
|
3088
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3089
|
+
Ne(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
function ge(gtUint32 a, gtUint64 b) internal returns (gtBool) {
|
|
3093
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3094
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3095
|
+
}
|
|
3096
|
+
|
|
3097
|
+
function ge(gtUint64 a, gtUint32 b) internal returns (gtBool) {
|
|
3098
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3099
|
+
Ge(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
function gt(gtUint32 a, gtUint64 b) internal returns (gtBool) {
|
|
3103
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3104
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3105
|
+
}
|
|
3106
|
+
|
|
3107
|
+
function gt(gtUint64 a, gtUint32 b) internal returns (gtBool) {
|
|
3108
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3109
|
+
Gt(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
function le(gtUint32 a, gtUint64 b) internal returns (gtBool) {
|
|
3113
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3114
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3115
|
+
}
|
|
3116
|
+
|
|
3117
|
+
function le(gtUint64 a, gtUint32 b) internal returns (gtBool) {
|
|
3118
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3119
|
+
Le(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3120
|
+
}
|
|
3121
|
+
|
|
3122
|
+
function lt(gtUint32 a, gtUint64 b) internal returns (gtBool) {
|
|
3123
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3124
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
function lt(gtUint64 a, gtUint32 b) internal returns (gtBool) {
|
|
3128
|
+
return gtBool.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3129
|
+
Lt(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3130
|
+
}
|
|
3131
|
+
|
|
3132
|
+
function min(gtUint32 a, gtUint64 b) internal returns (gtUint64) {
|
|
3133
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3134
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
function min(gtUint64 a, gtUint32 b) internal returns (gtUint64) {
|
|
3138
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3139
|
+
Min(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3142
|
+
function max(gtUint32 a, gtUint64 b) internal returns (gtUint64) {
|
|
3143
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3144
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3145
|
+
}
|
|
3146
|
+
|
|
3147
|
+
function max(gtUint64 a, gtUint32 b) internal returns (gtUint64) {
|
|
3148
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3149
|
+
Max(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
function mux(gtBool bit, gtUint32 a, gtUint64 b) internal returns (gtUint64){
|
|
3153
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3154
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint32.unwrap(a), gtUint64.unwrap(b)));
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
function mux(gtBool bit, gtUint64 a, gtUint32 b) internal returns (gtUint64){
|
|
3158
|
+
return gtUint64.wrap(ExtendedOperations(MPC_PRECOMPILE).
|
|
3159
|
+
Mux(combineEnumsToBytes3(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtBool.unwrap(bit), gtUint64.unwrap(a), gtUint32.unwrap(b)));
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
function transfer(gtUint32 a, gtUint64 b, gtUint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
3163
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
3164
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b), gtUint64.unwrap(amount));
|
|
3165
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
function transfer(gtUint64 a, gtUint32 b, gtUint64 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
3169
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
3170
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b), gtUint64.unwrap(amount));
|
|
3171
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
function transfer(gtUint32 a, gtUint64 b, gtUint8 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
3175
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
3176
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b), gtUint8.unwrap(amount));
|
|
3177
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
3178
|
+
}
|
|
3179
|
+
|
|
3180
|
+
function transfer(gtUint64 a, gtUint32 b, gtUint8 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
3181
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
3182
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT8_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b), gtUint8.unwrap(amount));
|
|
3183
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
function transfer(gtUint32 a, gtUint64 b, gtUint16 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
3187
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
3188
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b), gtUint16.unwrap(amount));
|
|
3189
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
function transfer(gtUint64 a, gtUint32 b, gtUint16 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
3193
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
3194
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT16_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b), gtUint16.unwrap(amount));
|
|
3195
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
3196
|
+
}
|
|
3197
|
+
|
|
3198
|
+
function transfer(gtUint32 a, gtUint64 b, gtUint32 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
3199
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
3200
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint32.unwrap(a), gtUint64.unwrap(b), gtUint32.unwrap(amount));
|
|
3201
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3204
|
+
function transfer(gtUint64 a, gtUint32 b, gtUint32 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
3205
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
3206
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint32.unwrap(b), gtUint32.unwrap(amount));
|
|
3207
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
3208
|
+
}
|
|
3209
|
+
|
|
3210
|
+
function transfer(gtUint64 a, gtUint64 b, gtUint32 amount) internal returns (gtUint64, gtUint64, gtBool){
|
|
3211
|
+
(uint256 new_a, uint256 new_b, uint256 res) = ExtendedOperations(MPC_PRECOMPILE).
|
|
3212
|
+
Transfer(combineEnumsToBytes4(MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT64_T, MPC_TYPE.SUINT32_T, ARGS.BOTH_SECRET), gtUint64.unwrap(a), gtUint64.unwrap(b), gtUint32.unwrap(amount));
|
|
3213
|
+
return (gtUint64.wrap(new_a), gtUint64.wrap(new_b), gtBool.wrap(res));
|
|
3214
|
+
}
|
|
3215
|
+
}
|