The fastest way to build upgradeable smart contracts.
Scaffold and convert EIP-2535 Diamond Standard projects in seconds.
Built in Rust. Zero runtime dependencies.
The Diamond Standard (EIP-2535) gives you truly upgradeable contracts — but the boilerplate is brutal. diamondscaffold eliminates it:
diamonds init— scaffold a full Diamond project with one commanddiamonds convert— feed in any.solfile, get a Diamond project back- Foundry & Hardhat — first-class support for both, including JS and TS
- Three templates — Default, ERC20, ERC721 — production-ready out of the box
- Single binary — no Node.js runtime, no Python, no Docker. Just run it.
Choose your preferred method:
| npm |
npm install -g diamondscaffold |
| Cargo |
cargo install diamondscaffold |
| Binary |
Download from GitHub Releases — macOS, Linux, Windows |
Verify:
diamonds --versiondiamonds initInteractive prompts guide you through:
◆ Project name → my-diamond
◆ Template → Default / ERC20 / ERC721
◆ Framework → Foundry / Hardhat
◆ Language (Hardhat) → JavaScript / TypeScript
◆ Install dependencies → yes / no
◆ Initialize git → yes / no
Or skip the prompts:
diamonds init my-tokendiamonds convert MyContract.solTakes any Solidity contract and generates a complete Diamond project:
| Generated File | What it does |
|---|---|
LibAppStorage.sol |
Storage library extracted from your state variables |
{Name}Facet.sol |
Your logic rewritten as an external facet |
I{Name}Facet.sol |
Interface for the facet |
DiamondInit.sol |
Initializer derived from your constructor |
deployDiamond.t.sol |
Deployment test with selector generation |
| Project config | foundry.toml, .gitmodules, README, CI workflow |
Options:
diamonds convert MyContract.sol --output my-diamond # custom directory
diamonds convert MyContract.sol --framework hardhat # Hardhat instead of Foundry| Template | What you get |
|---|---|
| Default | Clean Diamond — DiamondCut, DiamondLoupe, Ownership facets, deploy test |
| ERC20 | Full ERC20 token facet with mint/burn/transfer, interfaces, and tests |
| ERC721 | Full ERC721 NFT facet with mint/transfer/approve, interfaces, and tests |
All templates include:
Diamond.solwith custom error handlingLibDiamond.solwith proper error bubblingDiamondInit.solwith metadata initialization- Complete test suites
- Deploy scripts
- CI workflow (Foundry templates)
forge build # compile contracts
forge test # run test suite
forge script Deploy --broadcast # deploynpx hardhat compile # compile contracts
npx hardhat test # run test suite
npx hardhat run scripts/deploy.js # deploydiamonds/
├── v2/ # Rust CLI source
│ ├── src/
│ │ ├── main.rs # Entry point + clap subcommands
│ │ ├── banner.rs # CLI banner
│ │ ├── prompt.rs # Interactive prompts
│ │ ├── scaffold.rs # Template engine
│ │ └── convert/ # Solidity → Diamond converter
│ │ ├── mod.rs # Orchestrator
│ │ ├── parser.rs # Solidity AST parser
│ │ └── codegen.rs # Code generator
│ └── templates/ # 9 embedded project templates
├── npm/ # npm distribution (6 packages)
├── scripts/ # Release automation
├── .github/workflows/ # CI/CD pipeline
└── v1/ # Legacy Node.js CLI (archived)
| Resource | URL |
|---|---|
| npm | npmjs.com/package/diamondscaffold |
| Crates.io | crates.io/crates/diamondscaffold |
| EIP-2535 | eips.ethereum.org/EIPS/eip-2535 |
| Releases | github.com/collinsadi/diamonds/releases |
Contributions welcome — see CONTRIBUTING.md.
Using an AI assistant? Review AI_POLICY.md first.
MIT — see LICENSE.md.
