← Protocols
Solmate
01Description

Modern, opinionated, gas-optimized building blocks for smart contract development by transmissions11. Predecessor to Solady; still widely used as the basis of many production protocols.

02Best for
  • 01ERC20/721/4626 base contracts
  • 02auth (Owned/Auth) primitives
  • 03fixed-point math (FixedPointMathLib)
  • 04WETH and SafeTransferLib
  • 05minimal, audited primitives
03Install
  • forge install transmissions11/solmate
  • pnpm add @rari-capital/solmate
05Prompt snippet
Use Solmate as a small, focused set of opinionated primitives — `ERC20`, `ERC721`, `ERC4626`, `Owned`, `FixedPointMathLib`, `SafeTransferLib`. Import in Foundry via `import { ERC20 } from "solmate/tokens/ERC20.sol"` after `forge install transmissions11/solmate`. For new projects, evaluate Solady first since it supersedes Solmate; pick Solmate when you need the exact storage/event layout of established protocols (Yearn V3, Sablier, Morpho legacy, etc.). Pin to `@v7` or `@v6` rather than `main`.
06Gotchas
  • Solmate is no longer actively maintained — Solady has effectively succeeded it. Use only with a pinned tag and your own audits.
  • ERC20 omits explicit zero-address checks and uses unchecked math in places — gas savings come at the cost of fewer guardrails versus OpenZeppelin.
  • `SafeTransferLib` does not check that the recipient is a contract — calling it on an EOA-typed token address returns success even if no token logic ran.
  • Multiple incompatible versions exist in the wild (v6, v7, dapphub fork). Version-mismatched remappings silently compile against the wrong ABI — always pin via `forge install transmissions11/solmate@v7`.
07Alternatives