-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.js
More file actions
30 lines (24 loc) · 1.12 KB
/
deploy.js
File metadata and controls
30 lines (24 loc) · 1.12 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
const { ethers, artifacts, network } = require("hardhat");
const { Interface } = require("ethers"); // לצורך יצירת interface מודרני מה-ABI
async function main() {
// 1) בנה Factory (עדכן את שם החוזה אם הוא לא Lottery)
const Factory = await ethers.getContractFactory("Lottery");
// 2) פריסה (אם יש פרמטרים ל-constructor שים אותם כאן)
const contract = await Factory.deploy(/* constructor args */);
await contract.waitForDeployment();
// 3) כתובת החוזה
const address = await contract.getAddress();
// 4) הפקת ה-interface מתוך ה-ABI של ה-artifact
const artifact = await artifacts.readArtifact("Lottery"); // עדכן שם חוזה אם צריך
const ifaceJson = new Interface(artifact.abi).formatJson();
// 5) הדפסה נקייה למסך
console.log("=== Deployment Summary ===");
console.log("Network:", network.name);
console.log("Contract Name:", artifact.contractName);
console.log("Address:", address);
console.log("Interface:", ifaceJson);
}
main().catch((err) => {
console.error(err);
process.exit(1);
});