// the find
fravoll/solidity-patterns
A compilation of patterns and best practices for the smart contract programming language Solidity
A catalog of Solidity design patterns covering behavioral, security, upgradeability, and gas optimization concerns, each with a working code example and a documentation page explaining the tradeoffs. Aimed at Solidity developers who want to understand the 'why' behind common contract patterns, not just copy-paste boilerplate. The accompanying docs site is genuinely readable.
Each pattern comes with both code and a written explanation of the underlying reasoning — you get context, not just syntax. The security patterns section (Checks-Effects-Interactions, Pull over Push) covers the mistakes that have drained actual contracts of actual money. Gas optimization patterns like tight variable packing and memory array building are specific and measurable, not hand-wavy. The proxy delegate pattern with a storage overwrite example is a good demonstration of a footgun that trips up beginners.
Frozen at Solidity 0.4.20 — that's pre-0.6 custom errors, pre-0.8 overflow protection, and before several security-relevant language changes; following these examples verbatim in a new contract is actively risky. No coverage of modern patterns: EIP-2535 diamond proxies, ERC-4337 account abstraction, or transient storage (EIP-1153). The randomness pattern still relies on block variables, which is a well-known attack surface that chainlink VRF was invented to solve — it's presented without enough warning. No tests, no Hardhat or Foundry setup, so you can't run anything without wiring it up yourself.