@coti-io/coti-contracts 0.1.0 → 1.0.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.
Files changed (71) hide show
  1. package/contracts/access/DataPrivacyFramework/extensions/DataPrivacyFrameworkMpc.sol +3 -115
  2. package/contracts/mocks/README.md +1 -1
  3. package/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol +105 -280
  4. package/contracts/mocks/utils/mpc/BitwiseTestsContract.sol +83 -187
  5. package/contracts/mocks/utils/mpc/{Comparison1Tests.Contract.sol → Comparison1TestsContract.sol} +67 -115
  6. package/contracts/mocks/utils/mpc/Comparison2TestsContract.sol +68 -116
  7. package/contracts/mocks/utils/mpc/MinMaxTestsContract.sol +69 -164
  8. package/contracts/mocks/utils/mpc/Miscellaneous1TestsContract.sol +70 -52
  9. package/contracts/mocks/utils/mpc/MiscellaneousTestsContract.sol +270 -0
  10. package/contracts/mocks/utils/mpc/OffboardToUserKeyTestContract.sol +102 -0
  11. package/contracts/mocks/utils/mpc/README.md +12 -12
  12. package/contracts/mocks/utils/mpc/TransferScalarTestsContract.sol +54 -211
  13. package/contracts/mocks/utils/mpc/TransferTestsContract.sol +162 -640
  14. package/contracts/onboard/AccountOnboard.sol +3 -3
  15. package/contracts/utils/mpc/MpcCore.sol +2835 -988
  16. package/contracts/utils/mpc/MpcInterface.sol +6 -4
  17. package/hardhat.config.ts +8 -5
  18. package/package.json +2 -2
  19. package/test/utils/accounts.ts +1 -1
  20. package/test/utils/mpc/Precompile.test.ts +26 -37
  21. package/typechain-types/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol/ArithmeticTestsContract.ts +374 -0
  22. package/typechain-types/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol/PrecompilesArythmeticTestsContract.ts +374 -0
  23. package/typechain-types/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol/index.ts +5 -0
  24. package/typechain-types/contracts/mocks/utils/mpc/ArithmeticTestsContract.ts +30 -10
  25. package/typechain-types/contracts/mocks/utils/mpc/BitwiseTestsContract.ts +39 -5
  26. package/typechain-types/contracts/mocks/utils/mpc/Comparison1TestsContract.ts +374 -0
  27. package/typechain-types/contracts/mocks/utils/mpc/Comparison2TestsContract.ts +39 -5
  28. package/typechain-types/contracts/mocks/utils/mpc/MinMaxTestsContract.ts +25 -5
  29. package/typechain-types/contracts/mocks/utils/mpc/Miscellaneous1TestsContract.ts +62 -0
  30. package/typechain-types/contracts/mocks/utils/mpc/MiscellaneousTestsContract.ts +396 -0
  31. package/typechain-types/contracts/mocks/utils/mpc/OffboardToUserKeyTestContract.ts +221 -0
  32. package/typechain-types/contracts/mocks/utils/mpc/OffboardToUserKeyTestsContract.sol/OffboardToUserKeyTestContract.ts +11 -8
  33. package/typechain-types/contracts/mocks/utils/mpc/TransferScalarTestsContract.ts +15 -15
  34. package/typechain-types/contracts/mocks/utils/mpc/TransferTestsContract.ts +15 -15
  35. package/typechain-types/contracts/mocks/utils/mpc/index.ts +3 -6
  36. package/typechain-types/contracts/onboard/AccountOnboard.ts +9 -4
  37. package/typechain-types/contracts/utils/mpc/MpcCore.ts +84 -0
  38. package/typechain-types/contracts/utils/mpc/MpcInterface.sol/ExtendedOperations.ts +81 -40
  39. package/typechain-types/contracts/utils/mpc/index.ts +1 -0
  40. package/typechain-types/factories/contracts/mocks/access/DataPrivacyFramework/DataPrivacyFrameworkMock__factory.ts +1 -1
  41. package/typechain-types/factories/contracts/mocks/token/PrivateERC20/PrivateERC20Mock__factory.ts +1 -1
  42. package/typechain-types/factories/contracts/mocks/token/PrivateERC721/PrivateERC721URIStorageMock__factory.ts +1 -1
  43. package/typechain-types/factories/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol/ArithmeticTestsContract__factory.ts +387 -0
  44. package/typechain-types/factories/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol/PrecompilesArythmeticTestsContract__factory.ts +388 -0
  45. package/typechain-types/factories/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol/index.ts +5 -0
  46. package/typechain-types/factories/contracts/mocks/utils/mpc/ArithmeticTestsContract__factory.ts +20 -7
  47. package/typechain-types/factories/contracts/mocks/utils/mpc/BitwiseTestsContract__factory.ts +28 -2
  48. package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison1Tests.Contract.sol/Comparison1TestsContract__factory.ts +1 -1
  49. package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison1TestsContract__factory.ts +387 -0
  50. package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison2TestsContract__factory.ts +28 -2
  51. package/typechain-types/factories/contracts/mocks/utils/mpc/MinMaxTestsContract__factory.ts +15 -2
  52. package/typechain-types/factories/contracts/mocks/utils/mpc/Miscellaneous1TestsContract__factory.ts +66 -1
  53. package/typechain-types/factories/contracts/mocks/utils/mpc/Miscellaneous2TestsContract__factory.ts +1 -1
  54. package/typechain-types/factories/contracts/mocks/utils/mpc/MiscellaneousTestsContract__factory.ts +424 -0
  55. package/typechain-types/factories/contracts/mocks/utils/mpc/OffboardToUserKeyTestContract__factory.ts +289 -0
  56. package/typechain-types/factories/contracts/mocks/utils/mpc/OffboardToUserKeyTestsContract.sol/OffboardToUserKeyTestContract__factory.ts +19 -3
  57. package/typechain-types/factories/contracts/mocks/utils/mpc/ShiftTestsContract__factory.ts +1 -1
  58. package/typechain-types/factories/contracts/mocks/utils/mpc/StringTestsContract__factory.ts +1 -1
  59. package/typechain-types/factories/contracts/mocks/utils/mpc/TransferScalarTestsContract__factory.ts +4 -4
  60. package/typechain-types/factories/contracts/mocks/utils/mpc/TransferTestsContract__factory.ts +4 -4
  61. package/typechain-types/factories/contracts/mocks/utils/mpc/index.ts +3 -4
  62. package/typechain-types/factories/contracts/mocks/wallet/PrivateERC20Wallet/PrivateERC20WalletMock__factory.ts +1 -1
  63. package/typechain-types/factories/contracts/onboard/AccountOnboard__factory.ts +8 -2
  64. package/typechain-types/factories/contracts/utils/mpc/MpcCore__factory.ts +77 -0
  65. package/typechain-types/factories/contracts/utils/mpc/MpcInterface.sol/ExtendedOperations__factory.ts +124 -61
  66. package/typechain-types/factories/contracts/utils/mpc/index.ts +1 -0
  67. package/typechain-types/hardhat.d.ts +26 -26
  68. package/typechain-types/index.ts +8 -8
  69. package/contracts/mocks/utils/mpc/Miscellaneous2TestsContract.sol +0 -448
  70. package/contracts/mocks/utils/mpc/OffboardToUserKeyTestsContract.sol +0 -81
  71. package/contracts/mocks/utils/mpc/ShiftTestsContract.sol +0 -311
@@ -12,15 +12,16 @@ interface ExtendedOperations {
12
12
  function RandBoundedBits(bytes1 metaData, uint8 numBits) external returns (uint256 result);
13
13
 
14
14
  function Add(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 result);
15
+ function CheckedAdd(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 overflowBit, uint256 result);
15
16
  function Sub(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 result);
17
+ function CheckedSub(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 overflowBit, uint256 result);
16
18
  function Mul(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 result);
19
+ function CheckedMul(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 overflowBit, uint256 result);
17
20
  function Div(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 result);
18
21
  function Rem(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 result);
19
22
  function And(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 result);
20
23
  function Or(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 result);
21
24
  function Xor(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 result);
22
- function Shl(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 result);
23
- function Shr(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 result);
24
25
  function Eq(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 result);
25
26
  function Ne(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 result);
26
27
  function Ge(bytes3 metaData, uint256 lhs, uint256 rhs) external returns (uint256 result);
@@ -33,9 +34,10 @@ interface ExtendedOperations {
33
34
  function Mux(bytes3 metaData, uint256 bit, uint256 a,uint256 b) external returns (uint256 result);
34
35
  function Not(bytes1 metaData, uint256 a) external returns (uint256 result);
35
36
  function Transfer(bytes4 metaData, uint256 a, uint256 b, uint256 amount) external returns (uint256 new_a, uint256 new_b, uint256 res);
36
- function TransferWithAllowance(bytes4 metaData, uint256 a, uint256 b, uint256 amount, uint256 allowance) external returns (uint256 new_a, uint256 new_b, uint256 res, uint256 new_allowance);
37
+ function TransferWithAllowance(bytes5 metaData, uint256 a, uint256 b, uint256 amount, uint256 allowance) external returns (uint256 new_a, uint256 new_b, uint256 res, uint256 new_allowance);
37
38
  function ValidateCiphertext(bytes1 metaData, uint256 ciphertext, bytes calldata signature) external returns (uint256 result);
38
- function GetUserKey(bytes calldata signedEK) external view returns (bytes memory encryptedKey);
39
+ function GetUserKey(bytes calldata signedEK) external returns (bytes memory encryptedKey);
40
+ function DeleteUserKey(bytes calldata signature) external returns (bool);
39
41
  }
40
42
 
41
43
  address constant MPC_PRECOMPILE = address(0x0000000000000000000000000000000000000064);
package/hardhat.config.ts CHANGED
@@ -5,14 +5,17 @@ import dotenv from "dotenv"
5
5
  dotenv.config()
6
6
 
7
7
  const config: HardhatUserConfig = {
8
- defaultNetwork: "devnet",
8
+ defaultNetwork: "testnet",
9
9
  solidity: "0.8.20",
10
10
  networks: {
11
- devnet: {
12
- url: "https://devnet.coti.io/rpc",
13
- chainId: 13068200,
11
+ testnet: {
12
+ url: "https://testnet.coti.io/rpc",
13
+ chainId: 7082400,
14
14
  },
15
- }
15
+ },
16
+ mocha: {
17
+ timeout: 100000000
18
+ },
16
19
  }
17
20
 
18
21
  export default config;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@coti-io/coti-contracts",
3
- "version": "0.1.0",
3
+ "version": "1.0.0",
4
4
  "description": "",
5
5
  "devDependencies": {
6
6
  "@nomicfoundation/hardhat-toolbox": "^5.0.0",
7
7
  "hardhat": "^2.22.8"
8
8
  },
9
9
  "dependencies": {
10
- "@coti-io/coti-ethers": "^0.1.1-b",
10
+ "@coti-io/coti-ethers": "^1.0.1-b",
11
11
  "@openzeppelin/contracts": "^5.0.2",
12
12
  "dotenv": "^16.4.5"
13
13
  }
@@ -4,7 +4,7 @@ import { CotiNetwork, getDefaultProvider, parseEther, Wallet } from "@coti-io/co
4
4
  let pks = process.env.SIGNING_KEYS ? process.env.SIGNING_KEYS.split(",") : []
5
5
 
6
6
  export async function setupAccounts() {
7
- const provider = getDefaultProvider(CotiNetwork.Devnet);
7
+ const provider = getDefaultProvider(CotiNetwork.Testnet);
8
8
 
9
9
  if (pks.length == 0) {
10
10
  const key1 = Wallet.createRandom(provider)
@@ -15,13 +15,13 @@ function buildTest(
15
15
  it(`${contractName}.${func}(${params}) should return ${expectedResults}`, async function () {
16
16
  const [owner] = await setupAccounts()
17
17
 
18
- const factory = await hre.ethers.getContractFactory(contractName, owner)
18
+ const factory = await hre.ethers.getContractFactory(contractName, owner as any)
19
19
  const contract = await factory.deploy({ gasLimit })
20
20
  await contract.waitForDeployment()
21
21
 
22
22
  await (await contract.getFunction(func)(...params, { gasLimit })).wait()
23
23
  const result = await contract.getFunction(resFunc)()
24
- if (resFunc === "getRandom") {
24
+ if (resFunc === "getRandom" || resFunc === "getRandomBounded") {
25
25
  expect(result).to.not.equal(expectedResults[0])
26
26
  last_random_value = result
27
27
  } else if (expectedResults.length === 1) {
@@ -36,7 +36,7 @@ function buildTestWithUser(contractName: string, func: string, resFunc: string,
36
36
  it(`${contractName}.${func}(${params}, <address>) should return the correct user decrypted value`, async function () {
37
37
  const [owner] = await setupAccounts()
38
38
 
39
- const factory = await hre.ethers.getContractFactory(contractName, owner)
39
+ const factory = await hre.ethers.getContractFactory(contractName, owner as any)
40
40
  const contract = await factory.deploy({ gasLimit })
41
41
  await contract.waitForDeployment()
42
42
 
@@ -56,46 +56,35 @@ const bool_a = true
56
56
  const bool_b = false
57
57
  const [a, b] = params
58
58
  describe("Precompile", function () {
59
- buildTest("ArithmeticTestsContract", "addTest", "getResult", params, a + b)
60
- buildTest("ArithmeticTestsContract", "subTest", "getResult", params, a - b)
61
- buildTest("ArithmeticTestsContract", "mulTest", "getResult16", params, a * b)
62
-
63
- buildTest("Miscellaneous2TestsContract", "divTest", "getResult", params, a / b)
64
- buildTest("Miscellaneous2TestsContract", "remTest", "getResult", params, a % b)
65
-
66
- buildTest("BitwiseTestsContract", "andTest", "getResult", params, a & b)
67
- buildTest("BitwiseTestsContract", "orTest", "getResult", params, a | b)
68
- buildTest("BitwiseTestsContract", "xorTest", "getResult", params, a ^ b)
69
-
70
- buildTest(
71
- "ShiftTestsContract",
72
- "shlTest",
73
- "getAllShiftResults",
74
- [a, shift],
75
- ...[2, 4, 8, 16].map((x) => BigInt(a << shift) & BigInt(`0x${"f".repeat(x)}`))
76
- )
77
- buildTest("ShiftTestsContract", "shrTest", "getResult", params, a >> b)
78
-
79
- buildTest("MinMaxTestsContract", "minTest", "getResult", params, Math.min(a, b))
80
- buildTest("MinMaxTestsContract", "maxTest", "getResult", params, Math.max(a, b))
81
- buildTest("Comparison2TestsContract", "eqTest", "getResult", params, a == b)
82
- buildTest("Comparison2TestsContract", "neTest", "getResult", params, a != b)
83
- buildTest("Comparison2TestsContract", "geTest", "getResult", params, a >= b)
84
- buildTest("Comparison1TestsContract", "gtTest", "getResult", params, a > b)
85
- buildTest("Comparison1TestsContract", "leTest", "getResult", params, a <= b)
86
- buildTest("Comparison1TestsContract", "ltTest", "getResult", params, a < b)
87
- buildTest("Miscellaneous2TestsContract", "muxTest", "getResult", [bit, a, b], bit === false ? a : b)
59
+ buildTest("ArithmeticTestsContract", "addTest", "getAddResult", params, a + b)
60
+ buildTest("ArithmeticTestsContract", "subTest", "getSubResult", params, a - b)
61
+ buildTest("ArithmeticTestsContract", "mulTest", "getMulResult", params, a * b)
62
+
63
+ buildTest("MiscellaneousTestsContract", "divTest", "getDivResult", params, a / b)
64
+ buildTest("MiscellaneousTestsContract", "remTest", "getRemResult", params, a % b)
65
+
66
+ buildTest("BitwiseTestsContract", "andTest", "getAndResult", params, a & b)
67
+ buildTest("BitwiseTestsContract", "orTest", "getOrResult", params, a | b)
68
+ buildTest("BitwiseTestsContract", "xorTest", "getXorResult", params, a ^ b)
69
+
70
+ buildTest("MinMaxTestsContract", "minTest", "getMinResult", params, Math.min(a, b))
71
+ buildTest("MinMaxTestsContract", "maxTest", "getMaxResult", params, Math.max(a, b))
72
+ buildTest("Comparison2TestsContract", "eqTest", "getEqResult", params, a == b)
73
+ buildTest("Comparison2TestsContract", "neTest", "getNeResult", params, a != b)
74
+ buildTest("Comparison2TestsContract", "geTest", "getGeResult", params, a >= b)
75
+ buildTest("Comparison1TestsContract", "gtTest", "getGtResult", params, a > b)
76
+ buildTest("Comparison1TestsContract", "leTest", "getLeResult", params, a <= b)
77
+ buildTest("Comparison1TestsContract", "ltTest", "getLtResult", params, a < b)
78
+ buildTest("MiscellaneousTestsContract", "muxTest", "getMuxResult", [bit, a, b], bit === false ? a : b)
88
79
 
89
80
  buildTest("TransferTestsContract", "transferTest", "getResults", [a, b, b], a - b, b + b, true)
90
81
  buildTest("TransferScalarTestsContract", "transferScalarTest", "getResults", [a, b, b], a - b, b + b, true)
91
-
92
- buildTest("Miscellaneous2TestsContract", "offboardOnboardTest", "getResult", [a, a, a, a], a)
93
- buildTest("Miscellaneous2TestsContract", "notTest", "getBoolResult", [!!a], !a)
82
+ buildTest("OffboardToUserKeyTestContract", "offboardOnboardTest", "getOnboardOffboardResult", [a, a, a, a], a)
83
+ buildTest("MiscellaneousTestsContract", "notTest", "getBoolResult", [!!a], !a)
94
84
 
95
85
  buildTestWithUser("OffboardToUserKeyTestContract", "offboardToUserTest", "getCTs", a)
96
-
97
86
  buildTest("Miscellaneous1TestsContract", "randomTest", "getRandom", [], last_random_value)
98
- buildTest("Miscellaneous1TestsContract", "randomBoundedTest", "getRandom", [numBits], last_random_value)
87
+ buildTest("Miscellaneous1TestsContract", "randomBoundedTest", "getRandomBounded", [numBits], last_random_value)
99
88
  buildTest(
100
89
  "Miscellaneous1TestsContract",
101
90
  "booleanTest",
@@ -0,0 +1,374 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ import type {
5
+ BaseContract,
6
+ BigNumberish,
7
+ BytesLike,
8
+ FunctionFragment,
9
+ Result,
10
+ Interface,
11
+ ContractRunner,
12
+ ContractMethod,
13
+ Listener,
14
+ } from "ethers";
15
+ import type {
16
+ TypedContractEvent,
17
+ TypedDeferredTopicFilter,
18
+ TypedEventLog,
19
+ TypedListener,
20
+ TypedContractMethod,
21
+ } from "../../../../../common";
22
+
23
+ export declare namespace ArithmeticTestsContract {
24
+ export type Check16Struct = {
25
+ res16_16: BigNumberish;
26
+ res8_16: BigNumberish;
27
+ res16_8: BigNumberish;
28
+ };
29
+
30
+ export type Check16StructOutput = [
31
+ res16_16: bigint,
32
+ res8_16: bigint,
33
+ res16_8: bigint
34
+ ] & { res16_16: bigint; res8_16: bigint; res16_8: bigint };
35
+
36
+ export type Check32Struct = {
37
+ res32_32: BigNumberish;
38
+ res8_32: BigNumberish;
39
+ res32_8: BigNumberish;
40
+ res16_32: BigNumberish;
41
+ res32_16: BigNumberish;
42
+ };
43
+
44
+ export type Check32StructOutput = [
45
+ res32_32: bigint,
46
+ res8_32: bigint,
47
+ res32_8: bigint,
48
+ res16_32: bigint,
49
+ res32_16: bigint
50
+ ] & {
51
+ res32_32: bigint;
52
+ res8_32: bigint;
53
+ res32_8: bigint;
54
+ res16_32: bigint;
55
+ res32_16: bigint;
56
+ };
57
+
58
+ export type Check64Struct = {
59
+ res64_64: BigNumberish;
60
+ res8_64: BigNumberish;
61
+ res64_8: BigNumberish;
62
+ res16_64: BigNumberish;
63
+ res64_16: BigNumberish;
64
+ res32_64: BigNumberish;
65
+ res64_32: BigNumberish;
66
+ };
67
+
68
+ export type Check64StructOutput = [
69
+ res64_64: bigint,
70
+ res8_64: bigint,
71
+ res64_8: bigint,
72
+ res16_64: bigint,
73
+ res64_16: bigint,
74
+ res32_64: bigint,
75
+ res64_32: bigint
76
+ ] & {
77
+ res64_64: bigint;
78
+ res8_64: bigint;
79
+ res64_8: bigint;
80
+ res16_64: bigint;
81
+ res64_16: bigint;
82
+ res32_64: bigint;
83
+ res64_32: bigint;
84
+ };
85
+
86
+ export type AllGTCastingValuesStruct = {
87
+ a8_s: BigNumberish;
88
+ b8_s: BigNumberish;
89
+ a16_s: BigNumberish;
90
+ b16_s: BigNumberish;
91
+ a32_s: BigNumberish;
92
+ b32_s: BigNumberish;
93
+ a64_s: BigNumberish;
94
+ b64_s: BigNumberish;
95
+ };
96
+
97
+ export type AllGTCastingValuesStructOutput = [
98
+ a8_s: bigint,
99
+ b8_s: bigint,
100
+ a16_s: bigint,
101
+ b16_s: bigint,
102
+ a32_s: bigint,
103
+ b32_s: bigint,
104
+ a64_s: bigint,
105
+ b64_s: bigint
106
+ ] & {
107
+ a8_s: bigint;
108
+ b8_s: bigint;
109
+ a16_s: bigint;
110
+ b16_s: bigint;
111
+ a32_s: bigint;
112
+ b32_s: bigint;
113
+ a64_s: bigint;
114
+ b64_s: bigint;
115
+ };
116
+ }
117
+
118
+ export interface ArithmeticTestsContractInterface extends Interface {
119
+ getFunction(
120
+ nameOrSignature:
121
+ | "addTest"
122
+ | "decryptAndCompareResults16"
123
+ | "decryptAndCompareResults32"
124
+ | "decryptAndCompareResults64"
125
+ | "getAddResult"
126
+ | "getMulResult"
127
+ | "getSubResult"
128
+ | "mulTest"
129
+ | "setPublicValues"
130
+ | "subTest"
131
+ ): FunctionFragment;
132
+
133
+ encodeFunctionData(
134
+ functionFragment: "addTest",
135
+ values: [BigNumberish, BigNumberish]
136
+ ): string;
137
+ encodeFunctionData(
138
+ functionFragment: "decryptAndCompareResults16",
139
+ values: [ArithmeticTestsContract.Check16Struct]
140
+ ): string;
141
+ encodeFunctionData(
142
+ functionFragment: "decryptAndCompareResults32",
143
+ values: [ArithmeticTestsContract.Check32Struct]
144
+ ): string;
145
+ encodeFunctionData(
146
+ functionFragment: "decryptAndCompareResults64",
147
+ values: [ArithmeticTestsContract.Check64Struct]
148
+ ): string;
149
+ encodeFunctionData(
150
+ functionFragment: "getAddResult",
151
+ values?: undefined
152
+ ): string;
153
+ encodeFunctionData(
154
+ functionFragment: "getMulResult",
155
+ values?: undefined
156
+ ): string;
157
+ encodeFunctionData(
158
+ functionFragment: "getSubResult",
159
+ values?: undefined
160
+ ): string;
161
+ encodeFunctionData(
162
+ functionFragment: "mulTest",
163
+ values: [BigNumberish, BigNumberish]
164
+ ): string;
165
+ encodeFunctionData(
166
+ functionFragment: "setPublicValues",
167
+ values: [
168
+ ArithmeticTestsContract.AllGTCastingValuesStruct,
169
+ BigNumberish,
170
+ BigNumberish
171
+ ]
172
+ ): string;
173
+ encodeFunctionData(
174
+ functionFragment: "subTest",
175
+ values: [BigNumberish, BigNumberish]
176
+ ): string;
177
+
178
+ decodeFunctionResult(functionFragment: "addTest", data: BytesLike): Result;
179
+ decodeFunctionResult(
180
+ functionFragment: "decryptAndCompareResults16",
181
+ data: BytesLike
182
+ ): Result;
183
+ decodeFunctionResult(
184
+ functionFragment: "decryptAndCompareResults32",
185
+ data: BytesLike
186
+ ): Result;
187
+ decodeFunctionResult(
188
+ functionFragment: "decryptAndCompareResults64",
189
+ data: BytesLike
190
+ ): Result;
191
+ decodeFunctionResult(
192
+ functionFragment: "getAddResult",
193
+ data: BytesLike
194
+ ): Result;
195
+ decodeFunctionResult(
196
+ functionFragment: "getMulResult",
197
+ data: BytesLike
198
+ ): Result;
199
+ decodeFunctionResult(
200
+ functionFragment: "getSubResult",
201
+ data: BytesLike
202
+ ): Result;
203
+ decodeFunctionResult(functionFragment: "mulTest", data: BytesLike): Result;
204
+ decodeFunctionResult(
205
+ functionFragment: "setPublicValues",
206
+ data: BytesLike
207
+ ): Result;
208
+ decodeFunctionResult(functionFragment: "subTest", data: BytesLike): Result;
209
+ }
210
+
211
+ export interface ArithmeticTestsContract extends BaseContract {
212
+ connect(runner?: ContractRunner | null): ArithmeticTestsContract;
213
+ waitForDeployment(): Promise<this>;
214
+
215
+ interface: ArithmeticTestsContractInterface;
216
+
217
+ queryFilter<TCEvent extends TypedContractEvent>(
218
+ event: TCEvent,
219
+ fromBlockOrBlockhash?: string | number | undefined,
220
+ toBlock?: string | number | undefined
221
+ ): Promise<Array<TypedEventLog<TCEvent>>>;
222
+ queryFilter<TCEvent extends TypedContractEvent>(
223
+ filter: TypedDeferredTopicFilter<TCEvent>,
224
+ fromBlockOrBlockhash?: string | number | undefined,
225
+ toBlock?: string | number | undefined
226
+ ): Promise<Array<TypedEventLog<TCEvent>>>;
227
+
228
+ on<TCEvent extends TypedContractEvent>(
229
+ event: TCEvent,
230
+ listener: TypedListener<TCEvent>
231
+ ): Promise<this>;
232
+ on<TCEvent extends TypedContractEvent>(
233
+ filter: TypedDeferredTopicFilter<TCEvent>,
234
+ listener: TypedListener<TCEvent>
235
+ ): Promise<this>;
236
+
237
+ once<TCEvent extends TypedContractEvent>(
238
+ event: TCEvent,
239
+ listener: TypedListener<TCEvent>
240
+ ): Promise<this>;
241
+ once<TCEvent extends TypedContractEvent>(
242
+ filter: TypedDeferredTopicFilter<TCEvent>,
243
+ listener: TypedListener<TCEvent>
244
+ ): Promise<this>;
245
+
246
+ listeners<TCEvent extends TypedContractEvent>(
247
+ event: TCEvent
248
+ ): Promise<Array<TypedListener<TCEvent>>>;
249
+ listeners(eventName?: string): Promise<Array<Listener>>;
250
+ removeAllListeners<TCEvent extends TypedContractEvent>(
251
+ event?: TCEvent
252
+ ): Promise<this>;
253
+
254
+ addTest: TypedContractMethod<
255
+ [a: BigNumberish, b: BigNumberish],
256
+ [bigint],
257
+ "nonpayable"
258
+ >;
259
+
260
+ decryptAndCompareResults16: TypedContractMethod<
261
+ [check16: ArithmeticTestsContract.Check16Struct],
262
+ [bigint],
263
+ "nonpayable"
264
+ >;
265
+
266
+ decryptAndCompareResults32: TypedContractMethod<
267
+ [check32: ArithmeticTestsContract.Check32Struct],
268
+ [bigint],
269
+ "nonpayable"
270
+ >;
271
+
272
+ decryptAndCompareResults64: TypedContractMethod<
273
+ [check64: ArithmeticTestsContract.Check64Struct],
274
+ [bigint],
275
+ "nonpayable"
276
+ >;
277
+
278
+ getAddResult: TypedContractMethod<[], [bigint], "view">;
279
+
280
+ getMulResult: TypedContractMethod<[], [bigint], "view">;
281
+
282
+ getSubResult: TypedContractMethod<[], [bigint], "view">;
283
+
284
+ mulTest: TypedContractMethod<
285
+ [a: BigNumberish, b: BigNumberish],
286
+ [bigint],
287
+ "nonpayable"
288
+ >;
289
+
290
+ setPublicValues: TypedContractMethod<
291
+ [
292
+ castingValues: ArithmeticTestsContract.AllGTCastingValuesStruct,
293
+ a: BigNumberish,
294
+ b: BigNumberish
295
+ ],
296
+ [void],
297
+ "nonpayable"
298
+ >;
299
+
300
+ subTest: TypedContractMethod<
301
+ [a: BigNumberish, b: BigNumberish],
302
+ [bigint],
303
+ "nonpayable"
304
+ >;
305
+
306
+ getFunction<T extends ContractMethod = ContractMethod>(
307
+ key: string | FunctionFragment
308
+ ): T;
309
+
310
+ getFunction(
311
+ nameOrSignature: "addTest"
312
+ ): TypedContractMethod<
313
+ [a: BigNumberish, b: BigNumberish],
314
+ [bigint],
315
+ "nonpayable"
316
+ >;
317
+ getFunction(
318
+ nameOrSignature: "decryptAndCompareResults16"
319
+ ): TypedContractMethod<
320
+ [check16: ArithmeticTestsContract.Check16Struct],
321
+ [bigint],
322
+ "nonpayable"
323
+ >;
324
+ getFunction(
325
+ nameOrSignature: "decryptAndCompareResults32"
326
+ ): TypedContractMethod<
327
+ [check32: ArithmeticTestsContract.Check32Struct],
328
+ [bigint],
329
+ "nonpayable"
330
+ >;
331
+ getFunction(
332
+ nameOrSignature: "decryptAndCompareResults64"
333
+ ): TypedContractMethod<
334
+ [check64: ArithmeticTestsContract.Check64Struct],
335
+ [bigint],
336
+ "nonpayable"
337
+ >;
338
+ getFunction(
339
+ nameOrSignature: "getAddResult"
340
+ ): TypedContractMethod<[], [bigint], "view">;
341
+ getFunction(
342
+ nameOrSignature: "getMulResult"
343
+ ): TypedContractMethod<[], [bigint], "view">;
344
+ getFunction(
345
+ nameOrSignature: "getSubResult"
346
+ ): TypedContractMethod<[], [bigint], "view">;
347
+ getFunction(
348
+ nameOrSignature: "mulTest"
349
+ ): TypedContractMethod<
350
+ [a: BigNumberish, b: BigNumberish],
351
+ [bigint],
352
+ "nonpayable"
353
+ >;
354
+ getFunction(
355
+ nameOrSignature: "setPublicValues"
356
+ ): TypedContractMethod<
357
+ [
358
+ castingValues: ArithmeticTestsContract.AllGTCastingValuesStruct,
359
+ a: BigNumberish,
360
+ b: BigNumberish
361
+ ],
362
+ [void],
363
+ "nonpayable"
364
+ >;
365
+ getFunction(
366
+ nameOrSignature: "subTest"
367
+ ): TypedContractMethod<
368
+ [a: BigNumberish, b: BigNumberish],
369
+ [bigint],
370
+ "nonpayable"
371
+ >;
372
+
373
+ filters: {};
374
+ }