Socket
Socket
Sign inDemoInstall

hardhat-contract-sizer

Package Overview
Dependencies
269
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hardhat-contract-sizer

Output Solidity contract sizes with Hardhat


Version published
Weekly downloads
39K
increased by14.31%
Maintainers
1
Install size
263 kB
Created
Weekly downloads
 

Readme

Source

Hardhat Contract Sizer

Output Solidity contract sizes with Hardhat.

Versions of this plugin prior to 2.0.0 were released as buidler-contract-sizer.

Installation

npm install --save-dev hardhat-contract-sizer
# or
yarn add --dev hardhat-contract-sizer

Usage

Load plugin in Hardhat config:

require("hardhat-contract-sizer");

Add configuration under the contractSizer key:

optiondescriptiondefault
alphaSortwhether to sort results table alphabetically (default sort is by contract size)false
runOnCompilewhether to output contract sizes automatically after compilationfalse
disambiguatePathswhether to output the full path to the compilation artifact (relative to the Hardhat root directory)false
strictwhether to throw an error if any contracts exceed the size limit (may cause compatibility issues with solidity-coverage)false
onlyArray of String matchers used to select included contracts, defaults to all contracts if length is 0[]
exceptArray of String matchers used to exclude contracts[]
outputFilefile path to write contract size reportnull
unitunit of measurement for the size of contracts, which can be expressed in 'B' (bytes), 'kB' (kilobytes) or 'KiB' (kibibytes)KiB
contractSizer: {
  alphaSort: true,
  disambiguatePaths: false,
  runOnCompile: true,
  strict: true,
  only: [':ERC20$'],
}

Run the included Hardhat task to output compiled contract sizes:

npx hardhat size-contracts
# or
yarn run hardhat size-contracts

By default, the hardhat compile task is run before sizing contracts. This behavior can be disabled with the --no-compile flag:

npx hardhat size-contracts --no-compile
# or
yarn run hardhat size-contracts --no-compile

Keywords

FAQs

Last updated on 13 Jun 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc