Skip to content

Commit

Permalink
Merge pull request #1 from 0xPolygon/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
gretzke authored Dec 8, 2023
2 parents 5301431 + 332407d commit 535607e
Show file tree
Hide file tree
Showing 46 changed files with 1,264 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PRIVATE_KEY=
INFURA_KEY=
ETHERSCAN_API_KEY=
POLYGONSCAN_API_KEY=
POLYGONSCAN_ZKEVM_API_KEY=
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This group is setup to ensure a security review is always required for PRs
/src/ @0xPolygon/internal-security
/script/**/*.sol @0xPolygon/internal-security
/deployments/ @0xPolygon/internal-security
48 changes: 48 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Pull Request

## Description

Please include a summary of the change and which feature was implemented or which issue was fixed. Also, include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

### How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

# Checklist:

Before deployment

- [ ] 100% test and branch coverage
- [ ] check slither for severe issues
- [ ] fuzz and invariant tests (when applicable)
- [ ] formal verification (when applicable)
- [ ] deployment or upgrade scripts ready
- [ ] version management agreed upon and implemented
- [ ] internal team review
- [ ] **Security Team review**

After deployment

- [ ] transfer ownership after deployments (when applicable)
- [ ] complete upgrade (when applicable)
- [ ] generate deployment/upgrade log files
- [ ] update [static](https://github.com/maticnetwork/static/tree/master/network) with new contract address and/or version

---

### Considerations

- I have followed the [contributing guidelines](../CONTRIBUTING.md).
- My code follows the style guidelines of this project and I have run `forge fmt` and prettier to ensure the code style is valid
- I have performed a self-review of my own code
- I have commented my code, particularly in hard-to-understand areas
- I have made corresponding changes to the documentation
- My changes generate no new warnings
- I have added tests that prove my fix is effective or that my feature works
- New and existing unit tests pass locally with my changes

### Additional context

Add any other context about the pull request here.
24 changes: 24 additions & 0 deletions .github/workflows/pr-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Source branch check
on:
pull_request:
branches: [main]
types:
- opened
- reopened
- synchronize
- edited
jobs:
check-main:
if: github.base_ref == 'main'
runs-on: ubuntu-latest
steps:
- name: Log
run: |
echo "Base ref: ${{ github.base_ref }}"
echo "Head ref: ${{ github.head_ref }}"
- name: Check branches
run: |
if [ ${{ github.head_ref }} != "staging" ]; then
echo "Merge requests to main branch are only allowed from staging branch."
exit 1
fi
21 changes: 21 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# checks that pre-commit hooks pass before allowing to merge a PR

name: pre-commit
on:
pull_request:
branches: [main, master, staging, dev, feat/**, fix/**]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files
36 changes: 36 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: test

on:
pull_request:
branches: [main, master, staging, dev, feat/**, fix/**]

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv
id: test
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/target
/out
/cache
/coverage
lcov.info
.DS_Store
.env
.vscode

broadcast/*/31337
deployments/**/31337.*

script/util/storage_check_cache
script/util/storage_check_report
18 changes: 18 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/openzeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/solady"]
path = lib/solady
url = https://github.com/vectorized/solady
[submodule "lib/deployment-log-generator"]
path = lib/deployment-log-generator
url = https://github.com/0xPolygon/deployment-log-generator
[submodule "lib/contract-deployer-template"]
path = lib/contract-deployer-template
url = https://github.com/0xPolygon/contract-deployer-template
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: mixed-line-ending
args: ["--fix=lf"]
description: Forces to replace line ending by the UNIX 'lf' character.
exclude: "^docs/autogen"
- repo: local
hooks:
- id: format
name: Format solidity code
description: Format solidity code with `forge fmt`
language: system
entry: forge fmt
exclude: "^lib/"
pass_filenames: true
- id: doc
name: Generate documentation
description: Generate docs with `forge doc`
language: system
# generates docs and unstages files if only the commit hash changed within the file, this way only when the documentation is updated, the documentation needs to be regenerated and only the changed files are pushed
entry: "script/util/doc_gen.sh"
pass_filenames: false
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.3"
hooks:
- id: prettier
name: Format non solidity files with prettier
exclude: "^docs/autogen"
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
foundry.toml
out
lib/
cache/
docs/autogenerated
*.sol
deployments/
26 changes: 26 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": true,
"trailingComma": "all",
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false
}
},
{
"files": "*.json",
"options": {
"tabWidth": 4
}
}
]
}
Loading

0 comments on commit 535607e

Please sign in to comment.