3.0.7 • Published 9 months ago

@eaglewalker/hardhat-cronoscan v3.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

npm hardhat

hardhat-cronoscan

This is a fork of hardhat-etherscan

Hardhat plugin for integration with Cronoscan's contract verification service.

What

This plugin helps you verify the source code for your Solidity contracts on Cronoscan.

It's smart and it tries to do as much as possible to facilitate the process:

  • Just provide the deployment address and constructor arguments, and the plugin will detect locally which contract to verify.
  • If your contract uses Solidity libraries, the plugin will detect them and deal with them automatically. You don't need to do anything about them.
  • A simulation of the verification process will run locally, allowing the plugin to detect and communicate any mistakes during the process.
  • Once the simulation is successful the contract will be verified using the Etherscan API.

Installation

npm install --save-dev @eaglewalker/hardhat-cronoscan

// or

yarn add --dev @eaglewalker/hardhat-cronoscan

And add the following statement to your hardhat.config.js:

require("@eaglewalker/hardhat-cronoscan");

Or, if you are using TypeScript, add this to your hardhat.config.ts:

import "@eaglewalker/hardhat-cronoscan";

Tasks

This plugin provides the verify task, which allows you to verify contracts through Cronoscan's service.

Environment extensions

This plugin does not extend the environment.

Usage

You need to add the following Cronoscan config to your hardhat.config.js file:

module.exports = {
  networks: {
    mainnet: { ... }
  },
  etherscan: {  // this is still etherscan. to avoid complexity
    // Your API key for Cronoscan
    // Obtain one at https://cronoscan.com/
    apiKey: "YOUR_CRONOSCAN_API_KEY"
  }
};

Alternatively you can specify more than one block explorer API key, by passing an object under the apiKey property, see Multiple API keys and alternative block explorers.

Lastly, run the verify task, passing the address of the contract, the network where it's deployed, and the constructor arguments that were used to deploy it (if any):

npx hardhat verify --network mainnet DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1"

Complex arguments: Check hardhat-etherscan