From 9396c154d293732d9e09f9d74bc2d3b175209d5f Mon Sep 17 00:00:00 2001 From: MiloTruck Date: Wed, 4 Sep 2024 06:44:12 +0800 Subject: [PATCH] Modify README --- README.md | 75 +++++++------------ src/{amm => snippets}/ConstantSumPair.sol | 0 .../interfaces/ICallbacks.sol | 0 3 files changed, 26 insertions(+), 49 deletions(-) rename src/{amm => snippets}/ConstantSumPair.sol (100%) rename src/{amm => snippets}/interfaces/ICallbacks.sol (100%) diff --git a/README.md b/README.md index 9265b45..3991d02 100644 --- a/README.md +++ b/README.md @@ -1,66 +1,43 @@ -## Foundry +# Solidity Snippets -**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** +A collection of commonly seen contracts, re-written to prioritize simplicity and readability. -Foundry consists of: +## Contracts -- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). -- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. -- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. -- **Chisel**: Fast, utilitarian, and verbose solidity REPL. +All contracts are located in the `src` directory. -## Documentation +```ml +interfaces +├─ IERC20 — "Interface of the ERC-20 standard" -https://book.getfoundry.sh/ +snippets +├─ ConstantSumPair - "A minimal x + y = k AMM" -## Usage +tokens +├─ ERC20 — "Minimal ERC20 implementation" -### Build - -```shell -$ forge build +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" ``` -### Test - -```shell -$ forge test -``` +## Installation -### Format +To install with [**Foundry**](https://github.com/gakonst/foundry): -```shell -$ forge fmt +```sh +forge install MiloTruck/solidity-snippets ``` -### Gas Snapshots +## Safety -```shell -$ forge snapshot -``` +This codebase was written for demonstration purposes. It has not been audited and should not be used in production. -### Anvil +## Acknowledgements -```shell -$ anvil -``` - -### Deploy +This repository is inspired by or directly modified from many sources, primarily: -```shell -$ forge script script/Counter.s.sol:CounterScript --rpc-url --private-key -``` - -### Cast - -```shell -$ cast -``` - -### Help - -```shell -$ forge --help -$ anvil --help -$ cast --help -``` +- [OpenZeppelin](https://github.com/OpenZeppelin/openzeppelin-contracts) +- [Solmate](https://github.com/transmissions11/solmate) +- [Solady](https://github.com/Vectorized/solady) \ No newline at end of file diff --git a/src/amm/ConstantSumPair.sol b/src/snippets/ConstantSumPair.sol similarity index 100% rename from src/amm/ConstantSumPair.sol rename to src/snippets/ConstantSumPair.sol diff --git a/src/amm/interfaces/ICallbacks.sol b/src/snippets/interfaces/ICallbacks.sol similarity index 100% rename from src/amm/interfaces/ICallbacks.sol rename to src/snippets/interfaces/ICallbacks.sol