Skip to content

Commit

Permalink
Setup repo (#1)
Browse files Browse the repository at this point in the history
* add basic setup files

* add vscode

* add lint and prettier

* add pr template

* add some gitignores

* add pkg.json to contracts

* add lerna

* add some packages/contract structure

* set up foundry.toml & changeset

* add hh

* Add initial contracts

* forge install: forge-std

* forge install: ds-test

* setup foundry further, add CI

* foundry CI

* foundry CI v2

* Add yarn to CI

* rm contracts/tests

* add changesets CI

* add .idea to gitignore

* add forge submodule

* passing CI

* rename CI

* add integr tests folder

* add more workflows

Co-authored-by: Trajan0x <[email protected]>
  • Loading branch information
aureliusbtc and trajan0x authored May 24, 2022
1 parent 0f04bc1 commit 282e6a4
Show file tree
Hide file tree
Showing 60 changed files with 11,861 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

# defaults
[*]
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

[*.go]
indent_size = 4
indent_style = tab
187 changes: 187 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
module.exports = {
root: true,
env: {
browser: true,
es6: true,
},
ignorePatterns: ['dist', 'coverage', 'packages/contracts/hardhat'],
extends: ['plugin:prettier/recommended'],
parser: 'babel-eslint',
parserOptions: {
es6: true,
ecmaVersion: 6,
sourceType: 'module',
},
plugins: [
'eslint-plugin-import',
'eslint-plugin-unicorn',
'eslint-plugin-jsdoc',
'eslint-plugin-prefer-arrow',
'eslint-plugin-react',
'@typescript-eslint',
],
overrides: [
{
files: ['**/*.ts'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
allowAutomaticSingleRunInference: true,
},
rules: {
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/member-delimiter-style': [
'off',
{
multiline: {
delimiter: 'none',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
'@typescript-eslint/member-ordering': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-shadow': [
'error',
{
hoist: 'all',
},
],
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/quotes': 'off',
'@typescript-eslint/semi': ['off', null],
'@typescript-eslint/triple-slash-reference': [
'error',
{
path: 'always',
types: 'prefer-import',
lib: 'always',
},
],
'@typescript-eslint/type-annotation-spacing': 'off',
'@typescript-eslint/unified-signatures': 'error',
'@typescript-eslint/no-unused-vars': 'error',
},
},
],
rules: {
'prettier/prettier': 'warn',
'arrow-parens': ['off', 'always'],
'brace-style': ['off', 'off'],
'comma-dangle': 'off',
complexity: 'off',
'constructor-super': 'error',
curly: 'error',
'dot-notation': 'off',
'eol-last': 'off',
eqeqeq: ['error', 'smart'],
'guard-for-in': 'error',
'id-blacklist': 'off',
'id-match': 'off',
'import/no-extraneous-dependencies': ['error'],
'import/no-internal-modules': 'off',
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal'],
'newlines-between': 'always',
},
],
indent: 'off',
'jsdoc/check-alignment': 'error',
'jsdoc/check-indentation': 'error',
'jsdoc/newline-after-description': 'error',
'linebreak-style': 'off',
'max-classes-per-file': 'off',
'max-len': 'off',
'new-parens': 'off',
'newline-per-chained-call': 'off',
'no-bitwise': 'off',
'no-caller': 'error',
'no-cond-assign': 'error',
'no-console': 'off',
'no-debugger': 'error',
'no-duplicate-case': 'error',
'no-duplicate-imports': 'error',
'no-empty': 'error',
'no-eval': 'error',
'no-extra-bind': 'error',
'no-extra-semi': 'off',
'no-fallthrough': 'off',
'no-invalid-this': 'off',
'no-irregular-whitespace': 'off',
'no-multiple-empty-lines': 'off',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-redeclare': 'error',
'no-return-await': 'error',
'no-sequences': 'error',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-throw-literal': 'error',
'no-trailing-spaces': 'off',
'no-undef-init': 'error',
'no-underscore-dangle': 'off',
'no-unsafe-finally': 'error',
'no-unused-expressions': 'off',
'no-unused-labels': 'error',
'no-use-before-define': 'off',
'no-var': 'error',
'object-shorthand': 'error',
'one-var': ['error', 'never'],
'padded-blocks': [
'off',
{
blocks: 'never',
},
{
allowSingleLineBlocks: true,
},
],
'prefer-arrow/prefer-arrow-functions': 'error',
'prefer-const': 'error',
'prefer-object-spread': 'error',
'quote-props': 'off',
quotes: 'off',
radix: 'error',
'react/jsx-curly-spacing': 'off',
'react/jsx-equals-spacing': 'off',
'react/jsx-tag-spacing': [
'off',
{
afterOpening: 'allow',
closingSlash: 'allow',
},
],
'react/jsx-wrap-multilines': 'off',
semi: 'off',
'space-before-blocks': 'error',
'space-before-function-paren': 'off',
'space-in-parens': ['off', 'never'],
'unicorn/prefer-ternary': 'off',
'use-isnan': 'error',
'valid-typeof': 'off',
},
}
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!--
Please fill in each sections of this template, and delete any sections that are not relevant.
-->

**Description**
A clear and concise description of the features you're adding in this pull request.

**Additional context**
Add any other context about the problem you're solving.

**Metadata**
- Fixes #[Link to Issue]
3 changes: 3 additions & 0 deletions .github/label-requires-reviews.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- label: 2-reviewers
reviews: 2
15 changes: 15 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
2-reviewers:
- 'packages/contracts/**/*'

M-ci:
- any: ['.github/**/*', '.circleci/**/*']

M-integration:
- any: ['integration-tests/**/*']

M-contracts:
- any: ['packages/contracts/**/*']

C-Protocol-Critical:
- 'packages/contracts/**/*.sol'
17 changes: 17 additions & 0 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Changeset integrity checker
on:
- pull_request_target

jobs:
changesets-integrity-checker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Dependencies
uses: yarn

- name: Changeset Status
run: npx changeset status
17 changes: 17 additions & 0 deletions .github/workflows/close-stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
with:
stale-pr-message: 'This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
exempt-pr-labels: exempt-stale
days-before-issue-stale: 999
days-before-pr-stale: 14
days-before-close: 5
repo-token: ${{ secrets.GITHUB_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/foundry-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on: [push]

name: Foundry Tests

jobs:
check:
name: Packages/contracts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Installing dependencies
working-directory: ./packages/contracts
run: yarn install

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

- name: Run tests
working-directory: ./packages/contracts
run: forge test -vvv

- name: Run snapshot
working-directory: ./packages/contracts
run: forge snapshot >> $GITHUB_STEP_SUMMARY
16 changes: 16 additions & 0 deletions .github/workflows/label-requires-reviews.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Label Reviews
on:
pull_request_review:

jobs:
require-reviewers:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
ref: develop

- name: Require-reviewers
uses: travelperk/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
pr-labeler:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@main
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml
30 changes: 29 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,32 @@
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
vendor/

.DS_Store
node_modules
temp
coverage.json
*.tsbuildinfo

yarn-error.log

dist
out
artifacts
cache

*.sw*

.env
.env*
!env.example
*.log

.devnet

coverage.out

.idea/

.gas-snapshot
Loading

0 comments on commit 282e6a4

Please sign in to comment.