Socket
Socket
Sign inDemoInstall

@kodex-data/flat-zeppelin

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kodex-data/flat-zeppelin

A hardhat plugin to minify your complex solidity projects, reducing bundle size and optimizing module structure.


Version published
Weekly downloads
2
increased by100%
Maintainers
3
Weekly downloads
 
Created
Source

@kodex-data/flat-zeppelin

@kodex-data/flat-zeppelin is a hardhat plugin that allows you to minify your complex solidity projects, reducing bundle size and optimizing module structure. It is especially useful for projects that rely on large libraries like OpenZeppelin.

Installation

You can install the plugin using Yarn or npm:

yarn add @kodex-data/flat-zeppelin 
# or
npm install @kodex-data/flat-zeppelin 

Configuration

To use the plugin, add the following line at the top of your hardhat.config.ts file:

import '@kodex-data/flat-zeppelin'

Then, add the following configuration object to your hardhat.config.ts file:

export default <HardhatUserConfig>{
  flatZeppelin: {
    /** License added to the cleaned content */
    license: 'MIT',
    /** if provided, flatted solidity file will be saved to given path */
    outputFile: 'flatted.sol',
    /** Temporary directory for storing intermediate files */
    tempDir: './.flat-zeppelin',
    /** Directory to saved flatted typechain types */
    targetDir: './typechain-types',
    /** Whether to keep the temporary directory after running */
    keepTemp: false,
    /** Version to add to the flattened solidity content */
    version: '0.8.4',
    /** Whether to enable debug mode */
    debug: false
  },
  // ...
}

Usage

To flat compile your contracts, run the following command:

npx hardhat flat-build

optimized output:

typechain-types
├── ERC165.ts
├── ERC20.ts
├── ERC20Permit.ts
├── ERC20PermitToken.ts
├── ERC721.ts
├── IERC20.ts
├── IERC20Metadata.ts
├── IERC20Permit.ts
├── IERC721.ts
├── IERC721Enumerable.ts
├── IERC721Metadata.ts
├── IERC721Receiver.ts
├── IGovernor.ts
├── IVotes.ts
├── Multicall2.ts
├── Ownable.ts
├── PhxCollectible.ts
├── Treasury.ts
├── Votes.ts
├── common.ts
├── factories
│   ├── ERC165__factory.ts
│   ├── ERC20PermitToken__factory.ts
│   ├── ERC20Permit__factory.ts
│   ├── ERC20__factory.ts
│   ├── ERC721__factory.ts
│   ├── IERC20Permit__factory.ts
│   ├── IERC20__factory.ts
│   └── index.ts
├── hardhat.d.ts
└── index.ts

normal typechain output:

typechain-types
├── @openzeppelin
│   └── contracts
│       └── token
│           ├── ERC20
│           │   ├── ERC20.ts
│           │   ├── IERC20.ts
│           │   └── extensions
│           │       └── draft-ERC20Permit.sol
│           │           └── ERC20Permit.ts
│           └── ERC721
│               ├── ERC721.ts
│               └── IERC721.ts
├── ERC20.ts
├── ERC20Permit.ts
├── ERC20PermitToken.ts
├── ERC721.ts
├── IERC20.ts
├── IERC721.ts
├── common.ts
├── contracts
│   ├── ERC20PermitToken.ts
├── factories
│   ├── @openzeppelin
│   │   └── contracts
│   │       └── token
│   │           ├── ERC20
│   │           │   ├── ERC20__factory.ts
│   │           │   ├── IERC20__factory.ts
│   │           │   └── extensions
│   │           │       └── draft-ERC20Permit.sol
│   │           │           └── ERC20Permit__factory.ts
│   │           └── ERC721
│   │               ├── ERC721__factory.ts
│   │               └── IERC721__factory.ts
│   ├── ERC20PermitToken__factory.ts
│   ├── ERC20Permit__factory.ts
│   ├── ERC20__factory.ts
│   ├── ERC721__factory.ts
│   ├── IERC20__factory.ts
│   ├── IERC721__factory.ts
│   └── contracts
│       └── ERC20PermitToken__factory.ts
└── index.ts

Keywords

FAQs

Package last updated on 20 Mar 2023

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