Skip to main content

Composable Smart Contracts

The word "composable" means able to be combined with other parts to form a whole.

In Compose, facets are designed to be composable — they're built to interoperate seamlessly with other facets inside the same diamond.

Composable design makes it possible to mix, match, and reuse smart contract logic across many projects — without modifying or redeploying source code. It turns smart contracts into reusable building blocks.

Key Insight

Onchain facets are the building blocks of Compose.

Examples of composition:

  1. ERC20Facet, ERC20PermitFacet and ERC20BridgableFacetcan be combined in a single diamond to create a fully featured ERC-20 token.
  2. Facets ERC721Facet, ERC721MetadataFacet, ERC721RoyaltyFacet can be composed to build an ERC-721 NFT contract.

Why This Matters

Traditional smart contract libraries extend functionality through inheritance at the source-code level, for example:

contract ERC20Permit is ERC20 { ... }

This approach tightly couples code and forces every variant to be redeployed as a new contract.

Compose changes that.

Instead of inheritance, it uses onchain composition — combining existing deployed facets inside a diamond.

This reduces duplication, improves upgradeability, and makes smart contract systems more flexible and maintainable.