Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 1.84 KB

hardhat-simple-project.md

File metadata and controls

57 lines (42 loc) · 1.84 KB

Deploy A Simple Contract Using Hardhat

Before you start

Please make sure you have deployed the local network of Godwoken before trying this document.

.github/workflows/hardhat-simple-project.yml is a GitHub Actions workflow that completes all tasks associated with this document.

Prepare a simple hardhat project

$ git clone --depth=1 ssh://[email protected]/NomicFoundation/hardhat
$ mv hardhat/packages/hardhat-core/sample-projects/basic/ .
$ cd basic/
$ ls
LICENSE.md  README.md  cache  contracts  hardhat.config.js  scripts  test

Install requirements

# Enter `basic/` directory
# $ cd basic/
$ npm install --save-dev hardhat @nomiclabs/hardhat-waffle

Adapt hardhat.config.js to our local network of Godwoken

Add the below network configuration into basic/hardhat.config.js:

module.exports = {

  networks: {
    gw_devnet_v1: {
      url: `http://127.0.0.1:8024`,
      accounts: [`0x9d5bc55413c14cf4ce360a6051eacdc0e580100a0d3f7f2f48f63623f6b05361`],
    }
  },

  ...
}

Run hardhat on our local network of Godwoken by --network gw_devnet_v1

# Enter `basic/` directory
# $ cd basic/
$ npx hardhat accounts --network gw_devnet_v1
$ npx hardhat compile
$ npx hardhat test --network gw_devnet_v1
$ npx hardhat run --network gw_devnet_v1 scripts/sample-script.js