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:
npm instructions
npm install --save-dev hardhat
yarn instructions
yarn add --dev hardhat
2) Create a project
Run npx hardhat in your project folder and follow the instructions to create (more info here).
Your basic Hardhat config file (hardhat.config.js or hardhat.config.ts) will be setup to support Conla Testnet.
You have to specify the explorer details under a customChains object. It includes:
chainID - 11118
apiURL - https://explorer.conla.com/api
browserURL - https://explorer.conla.com/
Deploy and Verify
For deployment we will use Hardhat Ignition - built-in Hardhat deployment system.
Deploy
Verify
The plugin requires you to include constructor arguments with the verify task and ensures that they correspond to expected ABI signature. However, Conla Explorer ignores those arguments, so you may specify any values that correspond to the ABI.
Example.
Note the verify task may not be listed in the available tasks lists at npx hardhat --help but should work as expected.
If not, check you have the minimum required version of the nomiclabs-hardhat-etherscan plugin (v3.0.0+) installed
Automatically verified contracts
Sometimes the contract may be automatically verified via Ethereum Bytecode Database service. In that case you may see the following response:
In that case, you may try to enforce using --force flag*.
It prevents Hardhat to check if the contract is already verified, and force it to send verification request anyway. Notice, that it is helpful only if the contract was automatically verified partially. That way, a new verification sources would be saved. If the contract was fully verified already, that just returns an error.
The flag is available starting from @nomicfoundation/[email protected]
Confirm Verification on Conla Explorer
Go to Conla Explorer and paste the contract address into the search bar.
Scroll down to see verified status. A green checkmark ✅ means the contract is verified.
If your screen size is limited, you may need to click the 3 dots to view and click through to the contract.
Scroll down to see and interact with the contract code.
D:\hard_hat>npx hardhat verify --network conla-testnet 0x15447991b46862f6cF9a5dB358a923f768a9Fadb 1234
Successfully submitted source code for contract
contracts/Lock.sol:Lock at 0x15447991b46862f6cF9a5dB358a923f768a9Fadb
for verification on the block explorer. Waiting for verification result...
Successfully verified contract Lock on the block explorer.
https://explorer.conla.com/address/0x15447991b46862f6cF9a5dB358a923f768a9Fadb#code
The contract 0x15447991b46862f6cF9a5dB358a923f768a9Fadb has already been verified on Etherscan.
https://explorer.conla.com/address/0x15447991b46862f6cF9a5dB358a923f768a9Fadb#code