Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hardhat-gas-reporter

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hardhat-gas-reporter

Gas Analytics plugin for Hardhat

  • 2.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
143K
increased by52.45%
Maintainers
1
Weekly downloads
 
Created

What is hardhat-gas-reporter?

The hardhat-gas-reporter package is a plugin for Hardhat that generates gas usage reports for smart contract tests. It helps developers understand the gas costs associated with their smart contract functions, which is crucial for optimizing and managing deployment costs.

What are hardhat-gas-reporter's main functionalities?

Gas Usage Reporting

This feature enables gas usage reporting for your Hardhat project. By including the hardhat-gas-reporter plugin in your Hardhat configuration file and setting the appropriate options, you can generate detailed gas usage reports for your smart contract tests.

const { task } = require('hardhat/config');
require('hardhat-gas-reporter');

module.exports = {
  solidity: '0.8.4',
  gasReporter: {
    enabled: true,
    currency: 'USD',
    gasPrice: 21
  }
};

Custom Gas Price and Currency

This feature allows you to customize the gas price and currency for the gas usage reports. By setting the 'currency' and 'gasPrice' options in the configuration, you can tailor the reports to reflect the costs in your preferred currency and gas price.

const { task } = require('hardhat/config');
require('hardhat-gas-reporter');

module.exports = {
  solidity: '0.8.4',
  gasReporter: {
    enabled: true,
    currency: 'EUR',
    gasPrice: 100
  }
};

Code Coverage Integration

This feature integrates gas usage reporting with code coverage tools like solidity-coverage. By including both plugins in your Hardhat configuration, you can generate comprehensive reports that include both gas usage and code coverage metrics.

const { task } = require('hardhat/config');
require('hardhat-gas-reporter');
require('solidity-coverage');

module.exports = {
  solidity: '0.8.4',
  gasReporter: {
    enabled: true,
    currency: 'USD',
    gasPrice: 21
  },
  mocha: {
    timeout: 20000
  }
};

Other packages similar to hardhat-gas-reporter

Keywords

FAQs

Package last updated on 25 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc