Setting up and launching an DRC20 Token Smart Contract on the Deelance Testnet using Hardhat.
Using Hardhat
What is Hardhat ?
Hardhat is a popular development framework and tool suite designed for building, testing, and deploying smart contracts and decentralized applications (DApps) on blockchain platforms. Like Truffle, Hardhat streamlines the development process and provides a range of features to aid developers in working with blockchain technologies.
Configuring the Development Workspace
Before we dive in, ensure you have the following essentials installed: Requirements:
To initially familiarize yourself with the available features and the current status, execute npx hardhat within your project directory. This will produce the following output in the terminal:
$ npx hardhat
Hardhat version 2.17.1
Usage: hardhat [GLOBAL OPTIONS] <TASK> [TASK OPTIONS]
GLOBAL OPTIONS:
--config A Hardhat config file.
--emoji Use emoji in messages.
--flamegraph Generate a flamegraph of your Hardhat tasks
--help Shows this message, or a task's help if its name is provided
--max-memory The maximum amount of memory that Hardhat can use.
--network The network to connect to.
--show-stack-traces Show stack traces (always enabled on CI servers).
--tsconfig A TypeScript config file.
--typecheck Enable TypeScript type-checking of your scripts/tests
--verbose Enables Hardhat verbose logging
--version Shows hardhat's version.
AVAILABLE TASKS:
check Check whatever you need
clean Clears the cache and deletes all artifacts
compile Compiles the entire project, building all artifacts
console Opens a hardhat console
coverage Generates a code coverage report for tests
flatten Flattens and prints contracts and their dependencies. If no file is passed, all the contracts in the project will be flattened.
gas-reporter:merge
help Prints this message
node Starts a JSON-RPC server on top of Hardhat Network
run Runs a user-defined script after compiling the project
test Runs mocha tests
typechain Generate Typechain typings for compiled contracts
verify Verifies a contract on Etherscan
To get help for a specific task run: npx hardhat help [task]
The things you can do are shown in a list. Some are already there, and some come when you add extra tools/packages. Learn More.
After initialization, your Hardhat project's folder structure will look like this.
Ensure you have the @openzeppelin/contracts package since our Solidity code relies on it. To get it, execute: npm i @openzeppelin/contracts in terminal.
Now, in your terminal, run the command npx hardhat compile , This will compile the contracts located in the "contracts/" folder.
Once the contract compiles without errors, generate a deploy.js file within the scripts/ directory and insert the following code: