File size: 2,083 Bytes
9bf0b92 | 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 | const { ethers, network, run } = require("hardhat")
const fs = require("fs")
const path = require("path")
async function main() {
const architect = process.env.ARCHITECT_ADDRESS
const minter = process.env.TREASURY_ADDRESS
if (!architect || !minter) throw new Error("Set ARCHITECT_ADDRESS and TREASURY_ADDRESS in .env")
const [deployer] = await ethers.getSigners()
console.log("[FORGEART] Deployer: ", deployer.address)
console.log("[FORGEART] Architect: ", architect)
console.log("[FORGEART] Minter: ", minter)
console.log("[FORGEART] Network: ", network.name)
const FORGEART = await ethers.getContractFactory("FORGEART")
const art = await FORGEART.deploy(architect, minter)
await art.waitForDeployment()
const address = await art.getAddress()
const tx = art.deploymentTransaction()
const receipt = await tx.wait()
console.log("[FORGEART] Contract: ", address)
console.log("[FORGEART] TX: ", tx.hash)
console.log("[FORGEART] Block: ", receipt.blockNumber)
console.log("[FORGEART] Max supply:", "2,100 tokens")
const dir = path.join(__dirname, "../deployments")
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true })
const existing = JSON.parse(
fs.readFileSync(path.join(dir, `${network.name}.json`), "utf8").replace(/\n/g, "").trim()
)
existing.forgeArtAddress = address
existing.forgeArtTxHash = tx.hash
existing.forgeArtBlock = receipt.blockNumber
fs.writeFileSync(path.join(dir, `${network.name}.json`), JSON.stringify(existing, null, 2))
console.log("[FORGEART] Deployment record updated")
if (network.name !== "hardhat" && network.name !== "localhost") {
console.log("[FORGEART] Waiting 30s for Basescan...")
await new Promise(r => setTimeout(r, 30000))
try {
await run("verify:verify", { address, constructorArguments: [architect, minter] })
console.log("[FORGEART] Verified on Basescan")
} catch (e) {
console.warn("[FORGEART] Verify skipped:", e.message.slice(0, 80))
}
}
}
main().catch(e => { console.error(e); process.exit(1) })
|