Hardhat
is a full-featured development environment for contract compilation, deployment and verification. The Hardhat Etherscan plugin supports contract verification on Hika Network.
Get Started
1) Install Hardhat
If you are starting from scratch, create an npm project by going to an empty folder, running npm init
, and following the instructions. Recommend npm 7 or higher.
Once your project is ready:
create folder
npm instructions
yarn instructions
create the sample project
We will explore the basics of creating a Hardhat project with a sample contract, tests of that contract, and a script to deploy it.
To create the sample project, run npx hardhat
in your project folder:
2) Install plugin
install openzeppelin
Run npx hardhat
in your project folder and follow the instructions to create
And add the following statement to your hardhat.config.js
:
Or, if you are using TypeScript, add this to your hardhat.config.ts
:
Install nomicfoundation/hardhat-toolbox
Config File
Here we add an RPC url without an API key, however some value is still required. You can use any arbitrary string
For example, if Sokol were not in the default list, this is how it would be added to the config file. Note the network name in customChains
must match the network name in the apiKey
object. and create file name hardhat.config.js
3) Deploy and Verify
Create platten .sol
Deploy
Code scripts/deploy.js
Run Script
Verify
You can include constructor arguments with the verify task.
Result
Nothing to compile Successfully submitted source code for contract contracts/Lock.sol:Lock at 0x755893F5B9De81CeA3dee69b8880e184cA2cDcEe for verification on the block explorer. Waiting for verification result...
Successfully verified contract Lock on Hika Scan URL. https://scan-testnet.hika.network/address/0x755893F5B9De81CeA3dee69b8880e184cA2cDcEe#code
Good to know: Note the verify task will not be listed in the available tasks lists at npx hardhat --config
but should work as expected.
If not, check you have the minimum required version of the nomiclabs-hardhat-etherscan plugin (v3.0.0+) installed
Confirm Verification on Hika Network
Go to your Microtron Scan instance and paste the contract address into the search bar. If verified, the code tab will display a green checkmark.
Last updated