Download scripts/deploy-art.js from Snapkitty/forge-token: direct link, hf CLI and curl.
- Browser
- Download file 2.08 kB
-
https://huggingface.co/Snapkitty/forge-token/resolve/main/scripts/deploy-art.js
- Command line
-
hf download hf://Snapkitty/forge-token/scripts/deploy-art.js
-
curl -L -o deploy-art.js https://huggingface.co/Snapkitty/forge-token/resolve/main/scripts/deploy-art.js
2.08 kB
| 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) }) | |