-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
MiloTruck
committed
Sep 3, 2024
1 parent
a45ec56
commit 9396c15
Showing
3 changed files
with
26 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <your_rpc_url> --private-key <your_private_key> | ||
``` | ||
|
||
### Cast | ||
|
||
```shell | ||
$ cast <subcommand> | ||
``` | ||
|
||
### 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) |
File renamed without changes.
File renamed without changes.