From 0435ab8b4cd7b734806b667e791ebda7b0f579b7 Mon Sep 17 00:00:00 2001 From: HardlyCodeMan Date: Fri, 30 Dec 2022 12:11:16 +0800 Subject: [PATCH] Update: Preparing repo for initial release --- .gitignore | 2 ++ CHANGELOG.md | 16 ++++++++++++ README.md | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/.gitignore b/.gitignore index 426d76d..19501c4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ *.user *.userosscache *.sln.docstates +.gitignore +.gitattributes # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..90a5d24 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +### Dec 30, 2022 +Update: Preparing repo for initial release + +### Dec 29, 2022 +Add: Openzeppelin & solmate installation support +Add: Cleanup Counter.* files created by foundry init + +### Dec 20, 2022 +Add: Prefixes for output test filenames + +### Dec 16, 2022 +Update: Rework the parsing of commandline arguments +Update: Minor fixes to some edge cases + +### Dec 14, 2022 +Add: Install npm requirements of the repo if required \ No newline at end of file diff --git a/README.md b/README.md index 2e3b0bb..645dd57 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,69 @@ # audit_helper - Foundry boilerplate test creation for solidity audits +## Description + +audit_helper is a Python3 helper script for Linux to automate some Foundry boilerplate set up in audit repositories. +Too many times have I found myself initialising Hardhat framework based audit repositories with my preferred audit framework Foundry. + +## Requirements + +Python3 +```bash +user@machine:~/ sudo apt install python3 +``` + +Foundry +```bash +user@machine:~/ curl -L https://foundry.paradigm.xyz | bash +``` + +## Installation + +```bash +mkdir ~/audit_helper +wget https://raw.githubusercontent.com/HardlyCodeMan/audit_helper/main/audit_helper.py -o ~/audit_helper/audit_helper +chmod u+x ~/audit_helper/audit_helper +echo "export PATH=$PATH;~/audit_helper/audit_helper" >> ~/.bashrc +source ~/.bashrc +``` + +## Usage Example + +```bash +user@machine:~/audit_repo$ audit_helper -c src/ -o test/ -p myTest_ -s -oz +``` + +The above bash command will: +- initialise Foundry into the repository root (with ``-s``) +- remove the initial Counter.* files created automatically by ``foundry init`` +- install the openzeppelin/openzeppelin-contracts (with ``-oz``) +- set the contract source in foundry.toml to src/ (with ``-c``) +- set the test source in foundry.toml to test/ (with ``-o``) +- create boilerplate test files +- prefix the boilerplate test filenames with myTest_ (with ``-p``) + +## Flags + +| --flag | -flag | Description | +|---|---|---| +| --help | -h | Display this menu | +| --version | -v | Print the version number | +|||| +| --contracts | -c | Location of contracts | +| --output | -o | Test output folder. (Default: test/) | +| --prefix | -p | Test file prefix (Default: "") | +| --setup | -s | Initialise Foundry project and edit foundry.toml accordingly | +| --openzeppelin | -oz | Requires -s flag. Initialize with OpenZeppelin-Contracts repository | +| --solmate | -sm | Requires -s flag. Initialize with Solate repository | + +## Links +- [Changes](./CHANGELOG.md) +- [License](./LICENSE) + +- [Foundry](https://github.com/foundry-rs/foundry) +- [OpenZeppelin](https://github.com/openzeppelin/openzeppelin-contracts/) +- [Solmate](https://github.com/transmissions11/solmate) + +## Issues and Improvements + +Feel free to create issues to raise awareness of problems or feature implementation requests. +By all means please contribute fixes and features through pull requests. \ No newline at end of file