โก๏ธ 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
.soloutput.
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.
๐ฆ 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
.solclutter 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)
- ๐งช
solcoutput 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f2587a551c691f1b94999590b0233cb693b843fec02b9209cf8a755730b6d49
|
|
| MD5 |
f664cfaa21cbda359cb059ad9e86bf39
|
|
| BLAKE2b-256 |
c0e556918ec2326b1079fcbda7aa556e619aa4857e0ba5fbd9adc9dc5acb100c
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49200ce47b53be9958890bb87175f139126dd4507c170785b2d73c6d6e109784
|
|
| MD5 |
ffeb742d45fafa45a8d3738b2c3aad42
|
|
| BLAKE2b-256 |
19a594accdde9d61e7fd3e7770f01fc8975c01ed16abd375555eaee591b21409
|