Documentation Index
Fetch the complete documentation index at: https://docs.fuse.io/llms.txt
Use this file to discover all available pages before exploring further.
Using Hardhat
Hardhat is a development environment for Ethereum software. It consists of different components for editing, compiling, debugging and deploying your smart contracts and dApps, all of which work together to create a complete development environment. This Guide will walk you through the steps on how to deploy an ERC-20 token contract to the Fuse blockchain using Hardhat.Prerequisites
- Solidity programming knowledge
- JavaScript knowledge
package.json file is added to the project dir, and we can then install Hardhat by running:
Note:
**Do you want to install this sample project’s dependencies with npm (hardhat @nomicfoundation/hardhat-toolbox)? (Y/n) › y **
@nomicfoundation/hardhat-toolbox plugin bundles all the commonly used packages and Hardhat plugins to start developing with Hardhat.
hardhat.config.js file, Contracts and Scripts directories. Open the Contract folder, delete the default Lock.sol file and add a new file Token.sol. Update the contents of Token.sol with the following code:
hardhat.config.js
The next step is to deploy the contracts to the Fuse Blockchain. In Hardhat, deployments are defined through Ignition Modules. These modules are abstractions to describe a deployment; that is, JavaScript functions that specify what you want to deploy.
Open ignition inside the project root’s directory, then, enter the directory named modules. Create a deploy.js and paste the following code:
Deploy Contract
Open thehardhat.config.js file and update the information on Fuse Network
0xPRIVATE_KEY is used to sign the Transaction from your EOA without the need to request permission. You must ensure the EOA that owns the Private Key is funded with some Fuse Tokens to pay for Gas when deploying the Smart Contract.
Open a new terminal and deploy the smart contract to the Fuse network
How to verify contracts
To verify contracts with hardhat the hardhat-etherscan is used. This sounds counterintuitive and wrong, but thehardhat-etherscan plugin verifies contracts in the blockscout explorer.
Add the following property to hardhat.config.js