-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.js
71 lines (64 loc) · 2.08 KB
/
deploy.js
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
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 } = getEnvironmentVariables();
const {
deployerAddressCore,
privateKeyCore,
deployerAddressGateway,
privateKeyGateway,
privateKeyRelayer,
} = await deriveWalletsAndDetails(mnemonic);
await computeCoreAddresses(deployerAddressCore, deployerAddressGateway);
await deployCoreContract(
privateKeyCore,
networkUrl,
"lib",
"ACL.sol",
"contracts/lib",
".env.exec",
["FHEVM_COPROCESSOR_ADDRESS"],
);
const tfhe_executor_contract_address = await deployCoreContract(
privateKeyCore,
networkUrl,
"lib",
"TFHEExecutor.sol",
"",
"",
);
await deployCoreContract(
privateKeyCore,
networkUrl,
"lib",
"KMSVerifier.sol",
"",
"",
);
const gateway_contract_address = await deployCoreContract(
privateKeyGateway,
networkUrl,
"gateway",
"GatewayContract.sol",
"contracts/lib",
".env.kmsverifier",
[deployerAddressGateway, "KMS_VERIFIER_CONTRACT_ADDRESS"],
);
setTimeout(() => {
}, 3000);
await setupRelayer(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('deployment_config.json', JSON.stringify(deploymentData, null, 2));
console.log('Deployment configuration saved to deployment_config.json');
}
await main();