@cofhe/mock-contracts 0.1.1 → 0.2.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/CHANGELOG.md +16 -0
- package/contracts/ABITest.sol +99 -0
- package/contracts/MockACL.sol +1 -1
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1476 -1471
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1476 -1471
- package/dist/index.mjs.map +1 -1
- package/foundry.toml +3 -0
- package/package.json +3 -3
- package/src/MockACL.ts +374 -371
- package/src/MockQueryDecrypter.ts +232 -229
- package/src/MockTaskManager.ts +720 -717
- package/src/MockZkVerifier.ts +176 -173
- package/src/TestBed.ts +200 -197
- package/src/types.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @cofhe/mock-contracts Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8fda09a: Removes `Promise<boolean>` return type from `client.connect(...)`, instead throws an error if the connection fails.
|
|
8
|
+
- e0caeca: Adds `environment: 'node' | 'web' | 'hardhat' | 'react'` option to config. Exposed via `client.config.enviroment`. Automatically populated appropriately within the various `createCofhesdkConfig` functions.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- e121108: Fix ACL permission invalid issue. MockACL needs real deployment since etching doesn't call the constructor, so the EIP712 is uninitialized. Also adds additional utility functions to hardhat-plugin:
|
|
13
|
+
|
|
14
|
+
- `hre.cofhesdk.connectWithHardhatSigner(client, signer)` - Connect to client with hardhat ethers signer.
|
|
15
|
+
- `hre.cofhesdk.createBatteriesIncludedCofhesdkClient()` - Creates a batteries included client with signer connected.
|
|
16
|
+
- `hre.cofhesdk.mocks.getMockTaskManager()` - Gets deployed Mock Taskmanager
|
|
17
|
+
- `hre.cofhesdk.mocks.getMockACL()` - Gets deployed Mock ACL
|
|
18
|
+
|
|
3
19
|
## 0.1.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// SPDX-License-Identifier: UNLICENSED
|
|
2
|
+
pragma solidity ^0.8.13;
|
|
3
|
+
|
|
4
|
+
import '@fhenixprotocol/cofhe-contracts/FHE.sol';
|
|
5
|
+
|
|
6
|
+
contract ABITest {
|
|
7
|
+
euint32 public eNumber;
|
|
8
|
+
uint256 public numberHash;
|
|
9
|
+
|
|
10
|
+
euint8 public eUint8;
|
|
11
|
+
euint16 public eUint16;
|
|
12
|
+
euint32 public eUint32;
|
|
13
|
+
euint64 public eUint64;
|
|
14
|
+
euint128 public eUint128;
|
|
15
|
+
ebool public eBool;
|
|
16
|
+
eaddress public eAddress;
|
|
17
|
+
|
|
18
|
+
constructor() {
|
|
19
|
+
eUint8 = FHE.asEuint8(1);
|
|
20
|
+
eUint16 = FHE.asEuint16(1);
|
|
21
|
+
eUint32 = FHE.asEuint32(1);
|
|
22
|
+
eUint64 = FHE.asEuint64(1);
|
|
23
|
+
eUint128 = FHE.asEuint128(1);
|
|
24
|
+
eBool = FHE.asEbool(true);
|
|
25
|
+
eAddress = FHE.asEaddress(address(0));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
struct ContainsEncryptedInput {
|
|
29
|
+
uint256 value;
|
|
30
|
+
InEuint32 encryptedInput;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
struct ContainsEncryptedResult {
|
|
34
|
+
uint256 value;
|
|
35
|
+
euint32 encryptedResult;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// INPUTS
|
|
39
|
+
|
|
40
|
+
function fnNoEncryptedInputs(uint8 value) public {}
|
|
41
|
+
|
|
42
|
+
function fnEncryptedInput(InEuint32 memory inNumber) public {}
|
|
43
|
+
|
|
44
|
+
function fnBlendedInputsIncludingEncryptedInput(uint256 value, InEuint32 memory inNumber) public {}
|
|
45
|
+
|
|
46
|
+
function fnAllEncryptedInputs(
|
|
47
|
+
InEuint8 memory inEuint8,
|
|
48
|
+
InEuint16 memory inEuint16,
|
|
49
|
+
InEuint32 memory inEuint32,
|
|
50
|
+
InEuint64 memory inEuint64,
|
|
51
|
+
InEuint128 memory inEuint128,
|
|
52
|
+
InEbool memory inEbool,
|
|
53
|
+
InEaddress memory inEaddress
|
|
54
|
+
) public {}
|
|
55
|
+
|
|
56
|
+
function fnStructContainsEncryptedInput(ContainsEncryptedInput memory containsEncryptedInput) public {}
|
|
57
|
+
|
|
58
|
+
function fnArrayContainsEncryptedInput(InEuint32[] memory inEuint32Array) public {}
|
|
59
|
+
|
|
60
|
+
function fnTupleContainsEncryptedInput(InEuint32[2] memory inEuint32Array) public {}
|
|
61
|
+
|
|
62
|
+
// OUTPUTS
|
|
63
|
+
|
|
64
|
+
function fnReturnNoEncrypted() public pure returns (uint256) {
|
|
65
|
+
return 1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function fnReturnEncrypted() public view returns (euint32) {
|
|
69
|
+
return eUint32;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function fnReturnBlendedIncludingEncrypted() public view returns (uint256, euint32) {
|
|
73
|
+
return (1, eUint32);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function fnReturnEncryptedArray() public view returns (euint32[] memory) {
|
|
77
|
+
euint32[] memory encryptedArray = new euint32[](1);
|
|
78
|
+
encryptedArray[0] = eUint32;
|
|
79
|
+
return encryptedArray;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function fnReturnEncryptedStruct() public view returns (ContainsEncryptedResult memory) {
|
|
83
|
+
ContainsEncryptedResult memory encryptedResult = ContainsEncryptedResult({ value: 1, encryptedResult: eUint32 });
|
|
84
|
+
return encryptedResult;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function fnReturnAllEncrypted() public view returns (euint8, euint16, euint32, euint64, euint128, ebool, eaddress) {
|
|
88
|
+
return (eUint8, eUint16, eUint32, eUint64, eUint128, eBool, eAddress);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// EVENTS
|
|
92
|
+
|
|
93
|
+
event EventNoEncryptedInputs(uint8 value);
|
|
94
|
+
event EncryptedValue(euint32 value);
|
|
95
|
+
event BlendedValue(uint256 value, euint32 encryptedValue);
|
|
96
|
+
event EncryptedArray(euint32[] value);
|
|
97
|
+
event EncryptedStruct(ContainsEncryptedResult value);
|
|
98
|
+
event AllEncrypted(euint8, euint16, euint32, euint64, euint128, ebool, eaddress);
|
|
99
|
+
}
|
package/contracts/MockACL.sol
CHANGED
|
@@ -66,7 +66,7 @@ contract MockACL is MockPermissioned {
|
|
|
66
66
|
keccak256(abi.encode(uint256(keccak256('cofhe.storage.ACL')) - 1)) & ~bytes32(uint256(0xff));
|
|
67
67
|
|
|
68
68
|
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
69
|
-
constructor() {}
|
|
69
|
+
constructor() MockPermissioned() {}
|
|
70
70
|
|
|
71
71
|
function exists() public pure returns (bool) {
|
|
72
72
|
return true;
|
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ type MocksArtifact = {
|
|
|
3
3
|
fixedAddress: string;
|
|
4
4
|
abi: any;
|
|
5
5
|
deployedBytecode: string;
|
|
6
|
+
bytecode: string;
|
|
6
7
|
};
|
|
7
8
|
|
|
8
9
|
declare const MockTaskManagerArtifact: {
|
|
@@ -65,6 +66,7 @@ declare const MockTaskManagerArtifact: {
|
|
|
65
66
|
anonymous?: undefined;
|
|
66
67
|
})[];
|
|
67
68
|
deployedBytecode: string;
|
|
69
|
+
bytecode: string;
|
|
68
70
|
};
|
|
69
71
|
|
|
70
72
|
declare const MockACLArtifact: {
|
|
@@ -127,6 +129,7 @@ declare const MockACLArtifact: {
|
|
|
127
129
|
anonymous?: undefined;
|
|
128
130
|
})[];
|
|
129
131
|
deployedBytecode: string;
|
|
132
|
+
bytecode: string;
|
|
130
133
|
};
|
|
131
134
|
|
|
132
135
|
declare const MockZkVerifierArtifact: {
|
|
@@ -173,6 +176,7 @@ declare const MockZkVerifierArtifact: {
|
|
|
173
176
|
stateMutability?: undefined;
|
|
174
177
|
})[];
|
|
175
178
|
deployedBytecode: string;
|
|
179
|
+
bytecode: string;
|
|
176
180
|
};
|
|
177
181
|
|
|
178
182
|
declare const MockQueryDecrypterArtifact: {
|
|
@@ -210,6 +214,7 @@ declare const MockQueryDecrypterArtifact: {
|
|
|
210
214
|
stateMutability?: undefined;
|
|
211
215
|
})[];
|
|
212
216
|
deployedBytecode: string;
|
|
217
|
+
bytecode: string;
|
|
213
218
|
};
|
|
214
219
|
|
|
215
220
|
declare const TestBedArtifact: {
|
|
@@ -256,6 +261,7 @@ declare const TestBedArtifact: {
|
|
|
256
261
|
stateMutability?: undefined;
|
|
257
262
|
})[];
|
|
258
263
|
deployedBytecode: string;
|
|
264
|
+
bytecode: string;
|
|
259
265
|
};
|
|
260
266
|
|
|
261
267
|
export { MockACLArtifact, MockQueryDecrypterArtifact, MockTaskManagerArtifact, MockZkVerifierArtifact, type MocksArtifact, TestBedArtifact };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ type MocksArtifact = {
|
|
|
3
3
|
fixedAddress: string;
|
|
4
4
|
abi: any;
|
|
5
5
|
deployedBytecode: string;
|
|
6
|
+
bytecode: string;
|
|
6
7
|
};
|
|
7
8
|
|
|
8
9
|
declare const MockTaskManagerArtifact: {
|
|
@@ -65,6 +66,7 @@ declare const MockTaskManagerArtifact: {
|
|
|
65
66
|
anonymous?: undefined;
|
|
66
67
|
})[];
|
|
67
68
|
deployedBytecode: string;
|
|
69
|
+
bytecode: string;
|
|
68
70
|
};
|
|
69
71
|
|
|
70
72
|
declare const MockACLArtifact: {
|
|
@@ -127,6 +129,7 @@ declare const MockACLArtifact: {
|
|
|
127
129
|
anonymous?: undefined;
|
|
128
130
|
})[];
|
|
129
131
|
deployedBytecode: string;
|
|
132
|
+
bytecode: string;
|
|
130
133
|
};
|
|
131
134
|
|
|
132
135
|
declare const MockZkVerifierArtifact: {
|
|
@@ -173,6 +176,7 @@ declare const MockZkVerifierArtifact: {
|
|
|
173
176
|
stateMutability?: undefined;
|
|
174
177
|
})[];
|
|
175
178
|
deployedBytecode: string;
|
|
179
|
+
bytecode: string;
|
|
176
180
|
};
|
|
177
181
|
|
|
178
182
|
declare const MockQueryDecrypterArtifact: {
|
|
@@ -210,6 +214,7 @@ declare const MockQueryDecrypterArtifact: {
|
|
|
210
214
|
stateMutability?: undefined;
|
|
211
215
|
})[];
|
|
212
216
|
deployedBytecode: string;
|
|
217
|
+
bytecode: string;
|
|
213
218
|
};
|
|
214
219
|
|
|
215
220
|
declare const TestBedArtifact: {
|
|
@@ -256,6 +261,7 @@ declare const TestBedArtifact: {
|
|
|
256
261
|
stateMutability?: undefined;
|
|
257
262
|
})[];
|
|
258
263
|
deployedBytecode: string;
|
|
264
|
+
bytecode: string;
|
|
259
265
|
};
|
|
260
266
|
|
|
261
267
|
export { MockACLArtifact, MockQueryDecrypterArtifact, MockTaskManagerArtifact, MockZkVerifierArtifact, type MocksArtifact, TestBedArtifact };
|