multi-sol-verifier

1.0.1 • Public • Published

Multi-Sol-Verifier

Multi-sol-verifier is an NPM package to verify the Solidity smart contracts on Etherscan & Bscscan. It works as a CLI tool and can be used inside the js file too. This project is highly derived from npm package sol-verifier.

Install

As a dependency, to use inside a file:

npm install --save multi-sol-verifier

As a development dependency, to use it as <project_root>/node_modules/.bin/sol-verifier:

npm install --save-dev multi-sol-verifier

As a global npm module, to use sol-verifier as an executable:

npm install -g multi-sol-verifier

How to use

By requiring in file

A request object will be passed to verify contract. See below: (Make sure keys of request object will be always same)

    const verifier = require('multi-sol-verifier');
    var data = {
        key: 'etherscan-api-key',                       // Etherscan API key (required)
        path : '/path/to/contract/contractName.sol',    // Contract file path(required)
        contractAddress:  '0x123456789.......',         // Contract address (required)
        network  : 'mainnet/ropsten/rinkeby/kovan',     // Ethereum network used (required)
        contractName: 'contractName'                    // Contract name, only if contract file has more than one contracts
        cvalues   : [constructor, values, in, array],   // constructor values in array, only if contract has constructor
        evmVersion: 'istanbul',                         // See valid options: https://solidity.readthedocs.io/en/latest/using-the-compiler.html#target-options (optional, default compiler-default)
        runs: 200,                                      // Optimizer Runs (optional, default 200)
        licenseType: 1,                                 // Valid codes 1-12, see https://etherscan.io/contract-license-types (optional, default 1=No License)
        optimizationFlag: false                         // Set `true` to enable optimization (default false)
    };

    await verifier.verifyContract(data);

Parameters not applicable can be ignored.

Points to remember

  • Add specific version with ^ in your contract pragma. Version should be same as the compiler version used while contract deployment.
  • This doesn't provide support for libraries.
  • Works for solidity version > 0.4.11.
  • The Etherscan API that this module uses is in BETA state.
  • Maximum time for processing verification request is 30 seconds. If request timed out, check final result on Etherscan itself.

Powered by Etherscan.io APIs

Package Sidebar

Install

npm i multi-sol-verifier

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

21.3 kB

Total Files

14

Last publish

Collaborators

  • cryptomackenzie