Hardhat #1: Deploying Smart Contracts

Bloqarl
Coinmonks

--

If you can’t read this article because of the firewall, go here to read it for free!

This was my first time alone in the wild trying to deploy and test a Smart contract. It’s been tough but because I had many things to learn. I’m going to share this in a series of articles

So, my intention is to have these articles as a reference for anyone starting with Hardhat, to know what you might find while researching about testing Smart Contracts but to understand what you actually need.

Let’s see how to deploy our contract with Hardhat

In this case, I have written an ERC20 Smart Contract and I need to deploy it and write some tests with Hardhat in order to double check that it works as expected. (The testing part will be in a separate article)

Ways to deploy with Hardhat I knew

  1. We can deploy a Smart Contract on our scripts/deploy.js file with:
async function main() {
const HelloWorld = await ethers.getContractFactory("HelloWorld");

// Start deployment, returning a promise that resolves to a contract object
const hello_world = await HelloWorld.deploy("Hello World!");
console.log("Contract deployed to address:", hello_world.address);
}

main()
.then(() => process.exit(0))
.catch(error =>…

--

--

No responses yet