@cofhe/mock-contracts 0.1.0 → 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 ADDED
@@ -0,0 +1,39 @@
1
+ # @cofhe/mock-contracts Changelog
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
+
19
+ ## 0.1.1
20
+
21
+ ### Patch Changes
22
+
23
+ - a1d1323: Add repository info to package.json of public packages to fix npm publish provenance issue.
24
+ - d232d11: Ensure publish includes correct src and dist files
25
+ - b6521fb: Update publish workflow to create versioning PR upon merge with changeset.
26
+
27
+ ## 0.1.0
28
+
29
+ ### Minor Changes
30
+
31
+ - 8d41cf2: Combine existing packages into more reasonable defaults. New package layout is @cofhe/sdk (includes all the core logic for configuring and creating a @cofhe/sdk client, encrypting values, and decrypting handles), mock-contracts, hardhat-plugin, and react.
32
+ - a83facb: Prepare for initial release. Rename scope from `@cofhesdk` to `@cofhe` and rename `cofhesdk` package to `@cofhe/sdk`. Create `publish.yml` to publish `beta` packages on merged PR, and `latest` on changeset PR.
33
+ - 58e93a8: Migrate cofhe-mock-contracts and cofhe-hardhat-plugin into @cofhe/sdk.
34
+
35
+ This changelog is maintained by Changesets and will be populated on each release.
36
+
37
+ - Do not edit this file by hand.
38
+ - Upcoming changes can be previewed with `pnpm changeset status --verbose`.
39
+ - Entries are generated when the Changesets "Version Packages" PR is created/merged.
@@ -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
+ }
@@ -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 };