forked from MyZubster-Ecosystem/myzubster
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-myz.js
More file actions
50 lines (39 loc) · 1.42 KB
/
Copy pathdeploy-myz.js
File metadata and controls
50 lines (39 loc) · 1.42 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
const hre = require("hardhat");
const fs = require("fs");
async function main() {
console.log("🚀 Deploying MYZToken on Base Sepolia...");
// Deploy del contratto
const MYZToken = await hre.ethers.getContractFactory("MYZToken");
const myzToken = await MYZToken.deploy();
await myzToken.waitForDeployment();
const address = await myzToken.getAddress();
console.log(`✅ MYZToken deployed to: ${address}`);
// Verifica il total supply
const totalSupply = await myzToken.totalSupply();
console.log(`📊 Total Supply: ${ethers.formatEther(totalSupply)} MYZ`);
console.log(`💱 1 MYZ = 1€ (fisso)`);
console.log(`💰 Value: ${ethers.formatEther(totalSupply)}€`);
// Salva l'indirizzo
const data = {
address: address,
chain: hre.network.name,
totalSupply: ethers.formatEther(totalSupply),
price: "1 MYZ = 1€",
deployedAt: new Date().toISOString()
};
// Crea la directory se non esiste
if (!fs.existsSync("./deployments")) {
fs.mkdirSync("./deployments");
}
fs.writeFileSync(
`./deployments/${hre.network.name}-MYZToken.json`,
JSON.stringify(data, null, 2)
);
console.log(`📝 Deployment info saved to deployments/${hre.network.name}-MYZToken.json`);
// Verifica il contratto su Basescan
console.log(`🔍 Verify on Basescan: https://sepolia.basescan.org/address/${address}`);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});