import { ethers , hardhatArguments } from "hardhat" ; import fs from "fs" ; async function main ( ) { if ( ! hardhatArguments . network ) { throw new Error ( "Unknown network" ) ; } const Card = await ethers . getContractFactory ( "Card" ) ; console . log ( "Deploying Card..." ) ; const baseUri = `https://${ hardhatArguments . network == "mainnet" ? "" : "test-" }api.immutable.com/asset/` ; const card = await Card . deploy ( baseUri ) ; console . log ( `Transaction created: https://${ hardhatArguments . network == "mainnet" ? "" : hardhatArguments . network + "." }etherscan.io/tx/${ card . deployTransaction . hash }` ) ; await card . deployed ( ) ; console . log ( "Card deployed to:" , card . address ) ; fs . writeFileSync ( `${ hardhatArguments . network }-address.txt` , card . address ) ; } main ( ) . then ( ( ) => process . exit ( 0 ) ) . catch ( ( error ) => { console . error ( error ) ; process . exit ( 1 ) ; } ) ;