Skip to content

The Earth is flat but Solidity source code is not. This fixes that.

License

Notifications You must be signed in to change notification settings

cleanunicorn/flaterra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flaterra

License: MIT CircleCI Codacy Badge PyPI Code style: black Maintainability Rating

Inspired by "earth" in Portuguese, terra and the flatness of the Earth.

Flaterra parses the provided Solidity source file and adds any other imported files. This is useful if you want to upload your source code to a block explorer for verification, use it with Remix or to run analysis on it, for example with MythX or Mythril.

A way to make Solidity source code flat like the earth.

Flat Earth

Install

Install it with pip from PyPI.

$ pip install --user flaterra

Usage

Specify the main contract you want flatten with --contract=.

$ flaterra --contract=ERC20.sol
INFO:root:Reading file .//ERC20.sol
INFO:root:Reading file .//./IERC20.sol
INFO:root:Reading file .//../../math/SafeMath.sol
INFO:root:Writing flattened file ERC20_flat.sol

It assumes the contract is in the current folder. If the contract is in another folder specify it with --folder=contracts/.

Details

It is able to read import formats like

import "./contract.sol";
import './another_contract.sol';
import {Contract1, Contract2} from "contracts.sol";

Pragmas are added only from the main Solidity file. These formats are supported.

pragma solidity 0.5.0;
pragma experimental ABIEncoderV2;

About

The Earth is flat but Solidity source code is not. This fixes that.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published