Readable by Design
Keep each facet focused, self-contained, and understandable from top to bottom.
Open in docsA framework for modular, maintainable smart contracts.
Compose gives teams a structured foundation for building, extending, and maintaining modular smart contract systems.
Keep each facet focused, self-contained, and understandable from top to bottom.
Open in docsBuild modular systems around the ERC-2535 Diamond architecture and its shared storage model.
Open in docsAssemble systems from focused facets and modules instead of coupling functionality through inheritance.
Open in docsUse deliberate Solidity constraints and conventions designed for the realities of smart contract development.
Open in docsScaffold a diamond project with the Compose CLI, then develop with the Foundry or Hardhat workflow you already use.
Open in docsAdd custom facets that work with Compose modules and shared diamond storage as your system develops.
Open in docsBoth facets and modules access the same storage in your diamond. Your custom facets can extend Compose functionality without inheritance.
// Role-gated mint policy on shared ERC-20 storage
import { ERC20MintMod } from "compose/ERC20MintMod.sol";
import { AccessControlDataMod } from "compose/AccessControlDataMod.sol";
import { NonReentrancyMod } from "compose/NonReentrancyMod.sol";
contract StablecoinMintFacet {
function mint(
address recipient,
uint256 amount
) external {
// Only the MINTER_ROLE can mint
AccessControlDataMod.requireRole(
keccak256("MINTER_ROLE"),
msg.sender
);
// Reentrancy guard on shared storage
NonReentrancyMod.enter();
ERC20MintMod.mint(recipient, amount);
NonReentrancyMod.exit();
}
}
Start with a working project, add reusable Solidity building blocks, and keep your custom logic easy to understand.