Heavily gas-optimized Solidity snippets and primitives by Vectorized — successor in spirit to Solmate. Drop-in replacements for ERC20/721/1155, ECDSA, LibClone, and assembly-tight math/string utilities.
- 01gas-critical contracts
- 02minimal proxies / clones
- 03optimized ERC20/721/1155
- 04low-level signature & math libs
- 05L2 deployments where gas matters
- forge install vectorized/solady
- pnpm add solady
Use Solady whenever gas dominates correctness-equivalent OpenZeppelin code. Import via `import { ERC20 } from "solady/tokens/ERC20.sol"` (Foundry remapping `solady/=lib/solady/src/`). Prefer `LibClone.clone(impl)` over `Clones.clone` and `FixedPointMathLib`/`SafeTransferLib` over OZ equivalents on hot paths. For signatures use `SignatureCheckerLib.isValidSignatureNowCalldata(...)` to handle both EOA and ERC-1271 in one call. Always run `forge test --gas-report` to confirm savings versus your baseline.
- ⚑Solady leans on hand-written assembly and skips some OZ-style safety checks (e.g. permission errors return custom selectors, not strings) — review each contract's invariants before swapping in.
- ⚑Storage layouts intentionally differ from OpenZeppelin (custom slot constants), so you cannot upgrade a deployed OZ proxy implementation to a Solady one without a migration.
- ⚑Library is pinned to recent Solidity (0.8.20+) and uses `PUSH0` — ensure your target chain has Shanghai/EOF support or compile with `evm_version = "paris"`.
- ⚑Solady is explicitly experimental: pin a tagged release in `foundry.toml` rather than tracking `main` to avoid silent breaking changes.