Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
6boris authored and github-actions[bot] committed Oct 16, 2023
0 parents commit b6d9fee
Show file tree
Hide file tree
Showing 107 changed files with 5,898 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig http://EditorConfig.org

# top-most EditorConfig file
root = true

# All files
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.sol]
indent_size = 4

[*.tree]
indent_size = 1
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export API_KEY_ALCHEMY="YOUR_API_KEY_ALCHEMY"
export API_KEY_ARBISCAN="YOUR_API_KEY_ARBISCAN"
export API_KEY_BSCSCAN="YOUR_API_KEY_BSCSCAN"
export API_KEY_ETHERSCAN="YOUR_API_KEY_ETHERSCAN"
export API_KEY_GNOSISSCAN="YOUR_API_KEY_GNOSISSCAN"
export API_KEY_INFURA="YOUR_API_KEY_INFURA"
export API_KEY_OPTIMISTIC_ETHERSCAN="YOUR_API_KEY_OPTIMISTIC_ETHERSCAN"
export API_KEY_POLYGONSCAN="YOUR_API_KEY_POLYGONSCAN"
export API_KEY_SNOWTRACE="YOUR_API_KEY_SNOWTRACE"
export MNEMONIC="YOUR_MNEMONIC"
export FOUNDRY_PROFILE="default"
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foundry/lib/** linguist-vendored
94 changes: 94 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: "CI"

env:
API_KEY_ALCHEMY: ${{ secrets.API_KEY_ALCHEMY }}
FOUNDRY_PROFILE: "ci"

on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"

jobs:
lint:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"

- name: "Lint the contracts"
run: "pnpm lint"

- name: "Add lint summary"
run: |
echo "## Lint result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
build:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Build the contracts and print their size"
run: "forge build --sizes"

- name: "Add build summary"
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
test:
needs: ["lint", "build"]
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Show the Foundry config"
run: "forge config"

- name: "Generate a fuzz seed that changes weekly to avoid burning through RPC allowance"
run: >
echo "FOUNDRY_FUZZ_SEED=$(
echo $(($EPOCHSECONDS - $EPOCHSECONDS % 604800))
)" >> $GITHUB_ENV
- name: "Run the tests"
run: "forge test"

- name: "Add test summary"
run: |
echo "## Tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# directories
node_modules

foundry/out
foundry/coverage
foundry/cache
foundry/broadcast

# files
*.env
*.log
.DS_Store
.pnp.*
lcov.info
yarn.lock


108 changes: 108 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
[submodule "foundry/lib/openzeppelin-contracts-v4"]
path = foundry/lib/openzeppelin-contracts-v4
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "foundry/lib/openzeppelin-contracts"]
path = foundry/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "foundry/lib/forge-std"]
path = foundry/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "foundry/lib/prb-test"]
path = foundry/lib/prb-test
url = https://github.com/PaulRBerg/prb-test
[submodule "foundry/lib/v2-periphery"]
path = foundry/lib/v2-periphery
url = https://github.com/Uniswap/v2-periphery
[submodule "foundry/lib/v2-core"]
path = foundry/lib/v2-core
url = https://github.com/Uniswap/v2-core
[submodule "foundry/lib/v3-periphery"]
path = foundry/lib/v3-periphery
url = https://github.com/Uniswap/v3-periphery
[submodule "foundry/lib/v3-core"]
path = foundry/lib/v3-core
url = https://github.com/Uniswap/v3-core
[submodule "foundry/lib/v4-periphery"]
path = foundry/lib/v4-periphery
url = https://github.com/Uniswap/v4-periphery
[submodule "foundry/lib/v4-core"]
path = foundry/lib/v4-core
url = https://github.com/Uniswap/v4-core
[submodule "foundry/lib/solmate"]
path = foundry/lib/solmate
url = https://github.com/transmissions11/solmate
[submodule "foundry/lib/solady"]
path = foundry/lib/solady
url = https://github.com/vectorized/solady
[submodule "foundry/lib/safe-contracts"]
path = foundry/lib/safe-contracts
url = https://github.com/safe-global/safe-contracts
[submodule "foundry/lib/openzeppelin-contracts-upgradeable"]
path = foundry/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "foundry/lib/openzeppelin-contracts-upgradeable-v4.7.1"]
path = foundry/lib/openzeppelin-contracts-upgradeable-v4.7.1
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "foundry/lib/openzeppelin-contracts-v4.7.1"]
path = foundry/lib/openzeppelin-contracts-v4.7.1
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "foundry/lib/safe-contracts-v1.3.0"]
path = foundry/lib/safe-contracts-v1.3.0
url = https://github.com/safe-global/safe-contracts
[submodule "foundry/lib/@uniswap/v2-periphery"]
path = foundry/lib/@uniswap/v2-periphery
url = https://github.com/Uniswap/v2-periphery
[submodule "foundry/lib/@uniswap/v2-core"]
path = foundry/lib/@uniswap/v2-core
url = https://github.com/Uniswap/v2-core
[submodule "foundry/lib/@uniswap/v3-core"]
path = foundry/lib/@uniswap/v3-core
url = https://github.com/Uniswap/v3-core
[submodule "foundry/lib/@uniswap/v3-periphery"]
path = foundry/lib/@uniswap/v3-periphery
url = https://github.com/Uniswap/v3-periphery
[submodule "foundry/lib/@uniswap/v4-core"]
path = foundry/lib/@uniswap/v4-core
url = https://github.com/Uniswap/v4-core
[submodule "foundry/lib/@uniswap/v4-periphery"]
path = foundry/lib/@uniswap/v4-periphery
url = https://github.com/Uniswap/v4-periphery
[submodule "foundry/lib/@gnosis.pm/safe-contracts"]
path = foundry/lib/@gnosis.pm/safe-contracts
url = https://github.com/safe-global/safe-contracts
[submodule "foundry/foundry/lib/@gnosis.pm/safe-contracts-v1.3.0"]
path = foundry/foundry/lib/@gnosis.pm/safe-contracts-v1.3.0
url = https://github.com/safe-global/safe-contracts
[submodule "foundry/lib/@gnosis.pm/safe-contracts-v1.3.0"]
path = foundry/lib/@gnosis.pm/safe-contracts-v1.3.0
url = https://github.com/safe-global/safe-contracts
[submodule "foundry/lib/@openzeppelin/contracts"]
path = foundry/lib/@openzeppelin/contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "foundry/lib/@openzeppelin/contracts-v4.7.1"]
path = foundry/lib/@openzeppelin/contracts-v4.7.1
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "foundry/lib/@openzeppelin/contracts-upgradeable"]
path = foundry/lib/@openzeppelin/contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "foundry/lib/@openzeppelin/contracts-upgradeable-v4.7.1"]
path = foundry/lib/@openzeppelin/contracts-upgradeable-v4.7.1
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "foundry/lib/@dev/forge-std"]
path = foundry/lib/@dev/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "foundry/lib/@dev/prb-test"]
path = foundry/lib/@dev/prb-test
url = https://github.com/PaulRBerg/prb-test
[submodule "foundry/lib/@dev/ds-test"]
path = foundry/lib/@dev/ds-test
url = https://github.com/dapphub/ds-test
[submodule "foundry/lib/@openzeppelin/contracts-v4.7.3"]
path = foundry/lib/@openzeppelin/contracts-v4.7.3
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "foundry/lib/@solady"]
path = foundry/lib/@solady
url = https://github.com/Vectorized/solady
[submodule "foundry/lib/@solmate"]
path = foundry/lib/@solmate
url = https://github.com/transmissions11/solmate
20 changes: 20 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# directories
broadcast
cache
coverage
lib
node_modules
out

# files
*.env
*.log
.DS_Store
.pnp.*
lcov.info
package-lock.json
pnpm-lock.yaml
yarn.lock
foundry/lib

README.md
7 changes: 7 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
bracketSpacing: true
printWidth: 120
proseWrap: "always"
singleQuote: false
tabWidth: 2
trailingComma: "all"
useTabs: false
20 changes: 20 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "solhint:recommended",
"rules": {
"code-complexity": ["warn", 10],
"compiler-version": ["error", ">=0.8.0"],
"func-name-mixedcase": "off",
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 130],
"named-parameters-mapping": "off",
"no-console": "off",
"not-rely-on-time": "off",
"one-contract-per-file": "off",
"custom-errors": "off",
"no-empty-blocks": "off",
"contract-name-camelcase": "off",
"const-name-snakecase": "off",
"no-inline-assembly": "off",
"var-name-mixedcase": "off"
}
}
1 change: 1 addition & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foundry/lib
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode", "NomicFoundation.hardhat-solidity"]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"[solidity]": {
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
},
"[toml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"npm.exclude": "/foundry/**/lib/**",
// "solidity.formatter": "prettier",
"solidity.formatter": "forge"
// "editor.defaultFormatter": "esbenp.prettier-vscode",
// "editor.formatOnSave": true
}
16 changes: 16 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
MIT License

Copyright (c) 2023 Paul Razvan Berg

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
VERSION = `git rev-parse --short HEAD`
PROGRAM=gin bar

all: all test
@echo Run all scripts ...

lint:
yarn lint

test:
forge test
Loading

0 comments on commit b6d9fee

Please sign in to comment.