-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.js
More file actions
75 lines (68 loc) · 2.2 KB
/
deploy.js
File metadata and controls
75 lines (68 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { writeFileSync } from "fs";
import { deployCoreContract } from "./utils/deploy-core-address.js";
import { getEnvironmentVariables } from "./utils/env.js";
import { setupRelayer } from "./utils/gateway-relayer.js";
import { computeCoreAddresses } from "./utils/precompute-core-address.js";
import { deriveWalletsAndDetails } from "./utils/wallet.js";
async function main() {
const { networkUrl, mnemonic, privateKey, output } = getEnvironmentVariables();
const {
deployerAddressCore,
privateKeyCore,
deployerAddressGateway,
privateKeyGateway,
privateKeyRelayer,
} = await deriveWalletsAndDetails(networkUrl, privateKey, mnemonic);
await computeCoreAddresses(output, deployerAddressCore, deployerAddressGateway);
await deployCoreContract(
privateKeyCore,
networkUrl,
output,
"lib",
"ACL.sol",
"contracts/lib",
".env.exec",
["FHEVM_COPROCESSOR_ADDRESS"],
);
const tfhe_executor_contract_address = await deployCoreContract(
privateKeyCore,
networkUrl,
output,
"lib",
"TFHEExecutor.sol",
"",
"",
);
await deployCoreContract(
privateKeyCore,
networkUrl,
output,
"lib",
"KMSVerifier.sol",
"",
"",
);
const gateway_contract_address = await deployCoreContract(
privateKeyGateway,
networkUrl,
output,
"gateway",
"GatewayContract.sol",
"contracts/lib",
".env.kmsverifier",
[deployerAddressGateway, "KMS_VERIFIER_CONTRACT_ADDRESS"],
);
setTimeout(() => {
}, 3000);
await setupRelayer(output, privateKeyGateway, networkUrl, privateKeyRelayer);
console.log("Gateway Contract Address: ", gateway_contract_address);
console.log("Relayer Address: ", privateKeyRelayer);
const deploymentData = {
tfhe_executor_contract_address,
gateway_contract_address,
relayer_private_key: privateKeyRelayer
}
writeFileSync(`${output}/fhe_config.json`, JSON.stringify(deploymentData, null, 2));
console.log('Deployment configuration saved to deployment_config.json');
}
await main();