Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Hardhat deploy sample js code

async function main() {
  const [deployer] = await ethers.getSigners()

  console.log('Deploying contracts with the account:', deployer.address)

  console.log('Account balance:', (await deployer.getBalance()).toString())

  const Token = await ethers.getContractFactory('MyNFT')
  const token = await Token.deploy()

  console.log('Token address:', token.address)
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error)
    process.exit(1)
  })
 
PREVIOUS NEXT
Tagged: #Hardhat #deploy #sample #js #code
ADD COMMENT
Topic
Name
4+6 =