Skip to main content

โšก๏ธ SolderX โ€“ Melt Imports. Solder Solidity. Flatten Everything ๐Ÿ”ฅ

Project description

โšก๏ธ SolderX โ€“ Fuse, Flatten & Forge Solidity Contracts ๐Ÿ”ฅ

The Smart Contract Flattener tool- that melts imports, solders your contracts & forges a single fused .sol output.

SolderX is a developer-first, all-in-one Solidity flattener that handles files, folders, and verified contracts from various Explorersโ€” all on-the-fly. It features robust import resolutions, advanced remapping support, SPDX unification, topological sorting, import deduplication & cyclic dependency detection.

๐Ÿ” SolderX is built for researchers, auditors, solidity developers who need to flatten Solidity smart contracts for Etherscan (re)verification, security audits, or integrations with tools like Slither, Mythril, Foundry and Remix IDE.
It ensures your flattened solidity output is clean and analysis-ready.


License: MIT PyPI version GitHub commits since latest release GitHub Release Date Downloads


๐Ÿ“ฆ Installation

pip install solderx

SolderX is now available on PyPI โ€” install it in seconds and start soldering Solidity contracts effortlessly.

โœ… Requirements: Python 3.8+


๐Ÿ’ญ Why use SolderX ? :

SolderX takes care of everything:

  • โœ… Flatten a single file, entire project folder, or verified solidity contracts from explorers (like Etherscan)
  • โœ… Supports remappings, relative imports, and handles complex cyclic dependencies
  • โœ… Fully in-memory parsing โ€” no .sol clutter or manual cleanup from explorer downloads

One powerful CLI + Python tool โ€” clean, audit-ready output in seconds.

Most flatteners break on remappings, folder imports, or explorer parsings โ€” SolderX doesn't.


๐Ÿš€ Features Overview

๐Ÿ”ง Feature ๐Ÿง  Description โœ… Status
๐Ÿ”ฉ Flatten Everything Flatten from single files, full folders, or on-chain verified contracts โœ…
๐Ÿง  Smart Import Resolver Handles nested imports, multiline/same-line cases, and deduplicates cleanly โœ…
๐Ÿ“ฆ Scan from Explorers Supports Etherscan, Polygonscan, BscScan, Arbiscan, Base, Optimism, Avalanche โœ…
๐Ÿ“„ In-Memory Flattening No temp or unflattened junk files saved โ€” All flattening done in-memory โœ…
๐Ÿช„ Remapping Support Supports & resolves robust remappings (basic, deep, longest-match) โœ… (file)
๐Ÿงญ Relative Imports in Remappings Resolves ./ and ../ paths even within remapped libraries โœ… (file)
๐Ÿ”Ž Import Parsing Engine Extracts imports safely โ€” ignores inside comments and strings โœ…
๐Ÿงฑ Cyclic Import Detection Flags and breaks infinite loops in import trees โœ…
๐Ÿ“ Folder-Aware Flattening Detects and blocks out-of-scope imports across folder boundaries โœ…
๐Ÿ”— Chain + Address Validation Catches malformed contract addresses and unsupported chains โœ…
๐Ÿ“„ SPDX Header Merging Deduplicates and merges license headers cleanly โœ…
๐Ÿงฑ Import Deduplication Ensures each dependency is flattened only once โœ…
๐Ÿงฐ Python API Support Expose all core functions (file, folder, scan) via clean Python API โœ…
๐Ÿ’ป Themed CLI Interface Minimal, expressive CLI with emoji-based output and colored logs โœ…
โšก Fast & Lightweight Built with Python, no heavy dependencies โœ…
๐Ÿ”Ž Static Analysis Ready Output works with all static analyzers โœ…
๐Ÿ”ง Pluggable Design Designed to extend โ€” GitHub flattening, config aliasing, IDE plugins ๐Ÿ”ง Planned

๐ŸฅŠ How SolderX Compares :

โš ๏ธ Note: This comparison is a working draft. Feature support for third-party tools may be evolving, and accuracy is based on current public documentation and observed behavior. Final evaluation pending deeper testing.
Feature SolderX Hardhat / Foundry / Remix poa/solidity-flattener solidity-flattener truffle-flattener sol-merger slither-flatten
๐Ÿงฉ Standalone file flattening โœ… โœ… โœ… โœ… โœ… โœ… โœ…
๐Ÿ“ Folder/project flattening โœ… โŒ โŒ โš ๏ธ Limited โš ๏ธ Partial โœ… โŒ
๐ŸŒ Etherscan flattening (verified source) โœ… โŒ โŒ โŒ โŒ โŒ โœ…
โšก On-the-fly (no temp files saved) โœ… โŒ โŒ โŒ โŒ โŒ โŒ
๐Ÿ”„ Smart remapping resolution (@...) โœ… Deep โš ๏ธ Hardcoded โŒ โŒ โŒ โœ… Basic โŒ
๐Ÿ“š Relative imports in remapped libs โœ… โŒ โŒ โŒ โŒ โŒ โŒ
๐Ÿงช Multiline & nested import handling โœ… โš ๏ธ Partial โŒ โŒ โŒ โŒ โŒ
โ™ป๏ธ Cyclic import detection & handling โœ… โŒ โŒ โŒ โŒ โŒ โŒ
๐Ÿงน SPDX / license metadata cleanup โœ… โŒ โŒ โŒ โŒ โŒ โŒ
๐Ÿงฌ Deduplicated output โœ… โŒ โŒ โŒ โŒ โš ๏ธ Partial โŒ
๐Ÿง  Comment-aware import extraction โœ… โŒ โŒ โŒ โŒ โŒ โŒ
๐Ÿ Python API support โœ… โŒ โŒ โŒ โŒ โŒ โœ…
๐Ÿ’ป CLI with themed logs โœ… โš ๏ธ Basic โŒ โŒ โœ… Basic โŒ โš ๏ธ Minimal
๐Ÿ” Slither-compatible output โœ… โœ… โš ๏ธ Maybe โš ๏ธ Maybe โš ๏ธ Maybe โš ๏ธ Maybe โœ…
๐Ÿšซ Chain/address validation (Etherscan) โœ… โŒ โŒ โŒ โŒ โŒ โŒ
๐Ÿ”ง Future-ready: GitHub flattening, aliases โœ… Planned โŒ โŒ โŒ โŒ โŒ โš ๏ธ Limited
๐Ÿง  Maintained actively โœ… โœ… โŒ โŒ โŒ โš ๏ธ Rare โœ…

โšก๏ธ SolderX is the only tool that combines all flattening modes into a single interface โ€” file, folder, or Etherscan โ€” and handles real-world Solidity quirks out of the box.


๐Ÿ“ฆ Installation

pip install solderx

๐Ÿง‘โ€๐Ÿ’ป CLI Usage

# Simple file
solderx MyContract.sol

# Simple file with output path
solderx MyContract.sol --output MyContract_Flat.sol

# With remappings
solderx path/to/Contract.sol -r remappings.json
# Project folder with inline remapping
solderx src/ --remappings "@a=lib/a,@b=node_modules/b"

# With a remappings json
solderx project/contracts --remappings remappings.json

# With remappings and output filepath
solderx path/to/project/ -r remappings.json -o flattened/soldered_project.sol
# fetch from etherscan 
solderx 0xAbC...123 -chain eth --api-key YOUR_API_KEY

# also fetch from etherscan 
solderx eth:0xAbC...123 --api-key YOUR_API_KEY

๐Ÿ Python API Usage

from solderx import solder_file, solder_folder, solder_scan

# ๐Ÿ”น 1. Flatten a single file
flattened_code = solder_file("path/to/Contract.sol")

# With remappings
flattened_code = solder_file("path/to/Contract.sol", remappings={"@oz": "lib/openzeppelin-contracts"})


# ๐Ÿ”น 2. Flatten an entire folder
flattened_code = solderx("contracts/")

# With remappings
flattened_code = solder_file("path/to/Contract.sol", remappings={"@oz": "lib/openzeppelin-contracts"})


# ๐Ÿ”น 3. Flatten from verified explorer source

# Flatten from Etherscan
flattened_code = solderx("0x123..789", chain = 'eth')

flattened_code = solderx("eth:0x123..789")


# ๐Ÿ”น save file (default = False)
_ = solder_file("path/to/Contract.sol", save_file=True)

# save file in specified path
_ = solder_file("path/to/Contract.sol", output_path='./Contract_Flat.sol')

๐Ÿ”ฎ Roadmap & Future Additions

  • ๐Ÿ› ๏ธ Aliasing via config file (solidify.toml)
  • ๐ŸŒ Github repo flattening
  • ๐Ÿงน Strip comments (inline, block, NatSpec - toggleable)
  • ๐Ÿงช solc output validation (AST / compile test)
  • ๐Ÿ”Œ Plugin support: slither, mythril, sourcify
  • ๐Ÿ” Flatten by contract name (regex filtering)
  • ๐ŸŒˆ Color logs and interactive CLI summaries

๐Ÿง‘โ€๐Ÿ”ง Contributing

Pull requests are welcome!
If youโ€™ve found a bug, a confusing case, or have feature ideas โ€” open an issue or discussion on the repo.

Weโ€™re building this tool for Solidity developers like you.


๐Ÿงช Real Use Cases

  • ๐Ÿ” Re-verify contracts on Etherscan after audits or refactors
  • ๐Ÿ›ก๏ธ Feed single files into static analyzers like Slither, Mythril, Semgrep
  • ๐Ÿงฉ Compare bytecode outputs between flattened and deployed versions
  • ๐Ÿ“– Onboard contributors by flattening large repos for easier reading
  • ๐Ÿงฐ Pipeline-ready for CI/CD, security scans, or deployment packaging

Test Summary :

Category solder_file() solder_folder() solder_scan()
Flat imports โœ… โœ… โœ…
Nested imports โœ… โœ… โœ…
Save Flat File โœ… โœ… โœ…
Multiline imports โœ… โœ… โœ…
Multiple imports on same line โœ… โœ… โœ…
Missing import (in-scope) โœ… โœ… โœ…
Missing import (out-of-scope) N/A โœ… โœ…
Import outside folder scope detection N/A โœ… โœ…
Cyclic imports โœ… โœ… โœ…
Remapping (basic + deep + longest) โœ…โœ…โœ… ๐Ÿ”ง N/A ๐Ÿ”ง N/A
SPDX header merging โœ… โœ… โœ…
Import deduplication โœ… โœ… โœ…
Handle empty files โœ… โœ… โœ…
Relative imports in remapped libs โœ… ๐Ÿ”ง N/A ๐Ÿ”ง N/A
Relative import resolution โœ… โœ… โœ…
Flattened & multi-file JSON parsing N/A N/A โœ…
Contract name parsing N/A N/A โœ…
Chain support handling N/A N/A โœ…
Invalid address handling N/A N/A โœ…

All core behaviors are verified using Pytest.
Want more scenarios covered? Open an issue

๐Ÿ“„ License

SolderX is released under the MIT License
ยฉ 2025 โ€” Crafted with โค๏ธ for developers and researchers seeking reliable, complete tooling.

Commercial use is allowed provided that:

  • You include SolderX as a dependency (pip install solderx), OR
  • You give visible credit, e.g., โ€œFlattened using SolderXโ€ in your tool, docs, or repo.

Please donโ€™t rebrand or redistribute without attribution โ€” letโ€™s build openly and respectfully ๐Ÿค


๐Ÿ’ฌ Support & Updates

Weโ€™re just getting started โ€” expect support for more chains, deeper integrations, and smart dev-first features soon.

๐Ÿ‘‰ Track progress, report issues, or request enhancements on the GitHub repo.
Letโ€™s forge ahead with SolderX โ€” and make Solidity flattening reliable, intuitive, and developer-friendly.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solderx-0.1.1.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

solderx-0.1.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file solderx-0.1.1.tar.gz.

File metadata

  • Download URL: solderx-0.1.1.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.10

File hashes

Hashes for solderx-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1f2587a551c691f1b94999590b0233cb693b843fec02b9209cf8a755730b6d49
MD5 f664cfaa21cbda359cb059ad9e86bf39
BLAKE2b-256 c0e556918ec2326b1079fcbda7aa556e619aa4857e0ba5fbd9adc9dc5acb100c

See more details on using hashes here.

File details

Details for the file solderx-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: solderx-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.10

File hashes

Hashes for solderx-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 49200ce47b53be9958890bb87175f139126dd4507c170785b2d73c6d6e109784
MD5 ffeb742d45fafa45a8d3738b2c3aad42
BLAKE2b-256 19a594accdde9d61e7fd3e7770f01fc8975c01ed16abd375555eaee591b21409

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page