Skip to content

Commit

Permalink
setup repo
Browse files Browse the repository at this point in the history
  • Loading branch information
teddav committed Feb 14, 2022
0 parents commit b7acc9c
Show file tree
Hide file tree
Showing 96 changed files with 26,024 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
comment: off
github_checks:
annotations: false
coverage:
status:
patch:
default:
target: 97%
project:
default:
threshold: 1%
78 changes: 78 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'standard',
'plugin:promise/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
plugins: ['mocha-no-only', 'promise', 'prettier', '@typescript-eslint'],
env: {
browser: true,
node: true,
mocha: true,
jest: true,
},
globals: {
artifacts: false,
contract: false,
assert: false,
web3: false,
usePlugin: false,
extendEnvironment: false,
},
rules: {
// Strict mode
strict: ['error', 'global'],
'prettier/prettier': 'error',
// Code style
'array-bracket-spacing': ['off'],
camelcase: ['error', { properties: 'always', ignoreImports: true }],
'comma-dangle': ['error', 'always-multiline'],
'comma-spacing': ['error', { before: false, after: true }],
'dot-notation': ['error', { allowKeywords: true, allowPattern: '' }],
'eol-last': ['error', 'always'],
eqeqeq: ['error', 'smart'],
'generator-star-spacing': ['error', 'before'],
'linebreak-style': ['error', 'unix'],
'max-len': ['error', 150, 2, { ignoreComments: true }],
'no-debugger': 'off',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
'no-redeclare': ['error', { builtinGlobals: true }],
'no-trailing-spaces': ['error', { skipBlankLines: false }],
'no-undef': 'error',
'no-use-before-define': 'off',
'no-var': 'error',
'object-curly-spacing': ['error', 'always'],
'prefer-const': 'error',
quotes: ['error', 'single'],
semi: ['error', 'always'],
'space-before-function-paren': 0,
'@typescript-eslint/no-non-null-assertion': 0,

'mocha-no-only/mocha-no-only': ['error'],

'promise/always-return': 'off',
'promise/avoid-new': 'off',
},
overrides: [
{
files: ['*.js'],
rules: {
'@typescript-eslint/no-var-requires': [0],
},
},
{
files: ['./test/**/*'],
rules: {
camelcase: [0],
},
},
],
parserOptions: {
ecmaVersion: 2018,
},
};
134 changes: 134 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: CI

on:
push:
branches:
- main
workflow_dispatch:
inputs:
workflow_to_run:
type: choice
description: Which workflow to run?
required: true
options:
- all
- all_brownie
- brownie-curve
- brownie-protocol
- unit_tests

defaults:
run:
shell: bash

jobs:
run-linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: actions/cache@v2
with:
path: node_modules
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: yarn-
- name: Install dependencies
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
yarn install --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Run solhint
run: yarn lint:sol
- name: Run eslint
run: yarn lint:js:fix
- name: Discord notification
if: failure()
uses: Ilshidur/action-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: '⛔️ Error in project {{EVENT_PAYLOAD.repository.full_name}}. See here: https://github.com/AngleProtocol/angle-solidity/actions'

unit-tests:
if: ${{ github.ref == 'refs/heads/main' || github.event.inputs.workflow_to_run == 'all' || github.event.inputs.workflow_to_run == 'unit_tests' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: actions/cache@v2
with:
path: node_modules
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: yarn-
- name: Install dependencies
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
yarn install --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# This is required separately from yarn test because it generates the typechain definitions
- name: Compile
run: yarn compile
- name: Run unit tests
run: yarn test
env:
ENABLE_GAS_REPORT: true
CI: true
- name: Print gas report
run: cat gas-report.txt
- name: Discord notification
if: failure()
uses: Ilshidur/action-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: '⛔️ Error in project {{EVENT_PAYLOAD.repository.full_name}}. See here: https://github.com/AngleProtocol/angle-solidity/actions'

brownie-tests-curve:
if: ${{ github.ref == 'refs/heads/main' || github.event.inputs.workflow_to_run == 'all' || github.event.inputs.workflow_to_run == 'all_brownie' || github.event.inputs.workflow_to_run == 'brownie-curve' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: actions/setup-python@v2
with:
python-version: '3.8' # Version range or exact version of a Python version to use, using SemVer's version range syntax
- run: npm install -g ganache-cli
- run: pip install -r requirements.txt
- run: brownie test testBrownie/CurveSystem
- name: Discord notification
if: failure()
uses: Ilshidur/action-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: '⛔️ Error in project {{EVENT_PAYLOAD.repository.full_name}}. See here: https://github.com/AngleProtocol/angle-solidity/actions'
brownie-tests-protocol:
if: ${{ github.ref == 'refs/heads/main' || github.event.inputs.workflow_to_run == 'all' || github.event.inputs.workflow_to_run == 'all_brownie' || github.event.inputs.workflow_to_run == 'brownie-protocol' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: actions/setup-python@v2
with:
python-version: '3.8' # Version range or exact version of a Python version to use, using SemVer's version range syntax
- run: npm install -g ganache-cli
- run: pip install -r requirements.txt
- run: brownie test testBrownie/ProtocolTests
- name: Discord notification
if: failure()
uses: Ilshidur/action-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: '⛔️ Error in project {{EVENT_PAYLOAD.repository.full_name}}. See here: https://github.com/AngleProtocol/angle-solidity/actions'
27 changes: 27 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Security analysis

on: [workflow_dispatch]

defaults:
run:
shell: bash

jobs:
slither:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- run: pip3 install slither-analyzer
- run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
yarn install
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: slither .
# slither . --filter-paths contracts/mock
55 changes: 55 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
## Defaults
__pycache__
.idea
.DS_Store
.deps
.vscode
.docs
.env
node_modules
tenderly.yaml
settings.json
.mocharc.json
venv

# Build output
cache
build
export
**/artifacts
.openzeppelin
docgen/docs
docgen/SUMMARY.md
solidity-flattenedContracts
./crytic-export
typechain


# Test output
coverage
coverage.json

# Running output
gas-report.txt
gasReporterOutput.json
addresses.json
blockchain_db
ganache*
yarn-error.log

# deployments
deployments/*
!deployments/kovan
!deployments/rinkeby
!deployments/mainnet
!deployments/polygon

# bin
bin

# temporary delete
test/perpetualManager/perpetualManagerChangeBase.test.js
typechain/cacheIndex.ts

# used for storing temporary vyper artifacts
vyper_temp_dir
20 changes: 20 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"arrowParens": "avoid",
"jsxSingleQuote": true,
"singleQuote": true,
"printWidth": 120,
"semi": true,
"trailingComma": "all",
"useTabs": false,
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 120,
"singleQuote": false,
"bracketSpacing": true,
"explicitTypes": "always"
}
}
]
}
46 changes: 46 additions & 0 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
module.exports = {
norpc: true,
testCommand: 'yarn test',
compileCommand: 'yarn compile:hardhat',
skipFiles: [
'mock',
'external',
'interfaces',
'sigp',
'bondingCurve/BondingCurveEvents.sol',
'collateralSettler/CollateralSettlerVeANGLEEvents.sol',
'dao/Governor.sol',
'dao/GovernorStorage.sol',
'dao/GovernorEvents.sol',
'dao/TimelockEvents.sol',
'dao/Temporary.sol',
'poolManager/PoolManagerEvents.sol',
'poolManager/PoolManagerStorageV1.sol',
'poolManager/PoolManagerStorageV2.sol',
'poolManager/PoolManagerStorageV3.sol',
'feeManager/FeeManagerEvents.sol',
'feeManager/FeeManagerStorage.sol',
'oracle/OracleChainlinkMulti.sol',
'stableMaster/StableMasterEvents.sol',
'stableMaster/StableMasterStorage.sol',
'staking/RewardsDistributorEvents.sol',
'staking/StakingRewardsEvents.sol',
'staking/StrategyWETH.sol',
'strategies/BaseStrategyEvents.sol',
'utils/OracleMath.sol',
'utils/PoolAddress.sol',
'perpetualManager/PerpetualManagerEvents.sol',
'perpetualManager/PerpetualManagerStorage.sol',
'genericLender/GenericDyDx.sol',
'genericLender/GenericCompoundRinkeby.sol',
'genericLender/GenericCompoundRinkebyETH.sol',
'webscrap',
],
providerOptions: {
default_balance_ether: '10000000000000000000000000',
},
mocha: {
fgrep: '[skip-on-coverage]',
invert: true,
},
};
15 changes: 15 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "warning",
"ordering": "off",
"mark-callable-contracts": "off",
"no-empty-blocks": "off",
"not-rely-on-time": "off",
"compiler-version": "off",
"private-vars-leading-underscore": "error",
"reason-string": "off",
"func-visibility": ["error", { "ignoreConstructors": true }]
}
}
3 changes: 3 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mock/
external/
contracts/dao/Temporary.sol
Loading

0 comments on commit b7acc9c

Please sign in to comment.