-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.js
More file actions
36 lines (30 loc) · 1.3 KB
/
deploy.js
File metadata and controls
36 lines (30 loc) · 1.3 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
require("dotenv").config();
async function main() {
console.log("Deploying contracts...");
// Get the signer from MetaMask
const [deployer] = await ethers.getSigners();
console.log("Deploying contracts with account:", deployer.address);
// Deploy EventChainEventManagerContract
const EventChainEventManagerContract = await ethers.getContractFactory("EventChainEventManagerContract");
const eventManager = await EventChainEventManagerContract.deploy();
await eventManager.deployed();
console.log("EventChainEventManagerContract deployed to:", eventManager.address);
// Deploy EventChainContract
const EventChainContract = await ethers.getContractFactory("EventChainContract");
const eventChain = await EventChainContract.deploy(eventManager.address);
await eventChain.deployed();
console.log("EventChainContract deployed to:", eventChain.address);
// Save the addresses to a file
const fs = require("fs");
const contracts = {
EventChainEventManagerContract: eventManager.address,
EventChainContract: eventChain.address
};
fs.writeFileSync("./deployed-contracts.json", JSON.stringify(contracts, null, 2));
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});