Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/poanetwork/solidity-flattener
Utility to combine Solidity project to a flat file
https://github.com/poanetwork/solidity-flattener
contracts solidity
Last synced: about 2 months ago
JSON representation
Utility to combine Solidity project to a flat file
- Host: GitHub
- URL: https://github.com/poanetwork/solidity-flattener
- Owner: poanetwork
- License: apache-2.0
- Created: 2017-07-26T16:09:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-16T11:51:34.000Z (7 months ago)
- Last Synced: 2024-11-06T05:18:21.499Z (about 2 months ago)
- Topics: contracts, solidity
- Language: JavaScript
- Homepage:
- Size: 208 KB
- Stars: 326
- Watchers: 11
- Forks: 105
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-web3-tools-and-dapps - Solidity Flattener - This utility helps you merge a Solidity project into a single file. (dApps directory / Solidity Developer Tools)
README
# Solidity smart-contract flattened source file generation
[![Build Status](https://travis-ci.org/poanetwork/solidity-flattener.svg?branch=master)](https://travis-ci.org/poanetwork/solidity-flattener)
[![Known Vulnerabilities](https://snyk.io/test/github/poanetwork/solidity-flattener/badge.svg)](https://snyk.io/test/github/poanetwork/solidity-flattener)
[![Coverage Status](https://coveralls.io/repos/github/poanetwork/solidity-flattener/badge.svg?branch=master)](https://coveralls.io/github/poanetwork/solidity-flattener?branch=master)## Utility to combine all imports to one flatten .sol file
### Installation from npm
`npm i @poanet/solidity-flattener`
### Usage
`./node_modules/.bin/poa-solidity-flattener ./contracts/example.sol`
It will save flattened source of Solidity smart-contract into `./out` directory
### Installation from source
```
git clone https://github.com/poanetwork/solidity-flattener
cd solidity-flattener
npm install
```You can start script either
```
npm start "path_to_not_flat_contract_definition_file.sol"
```or without paramaters (path to input file will be extracted from `./config.json`)
```
npm start
```Expected result:
```
Success! Flat file ORIGINAL_FILE_NAME_flat.sol is generated to ./out directory
````./flatContract.sol` - flat .sol file is created in output directory (`./out/` by default)
**Note:** *utility doesn't support aliases at import statements*
## Config
path `./config.json`
```
{
"inputFilePath": "./demo/src/Oracles.sol",
"outputDir": "./out"
}
```