A collection of commonly seen contracts, re-written to prioritize simplicity and readability.
All contracts are located in the src
directory.
interfaces
└─ IERC20 — "Interface of the ERC-20 standard"
snippets
└─ ConstantSumPair — "Minimal x + y = k AMM"
tokens
└─ ERC20 — "Minimal ERC-20 implementation"
utils
├─ FixedPointMathLib — "Library to manage fixed-point arithmetic"
├─ SafeTransferLib — "Library for safe ETH and ERC20 transfers"
└─ VoteHistoryLib — "Library to store and retrieve vote history based on block number"
To install with Foundry:
forge install MiloTruck/solidity-snippets
This codebase was written for demonstration purposes.
It has not been audited and should not be used in production.
This repository is inspired by or directly modified from many sources, primarily: