Skip to content

Commit

Permalink
feat: added contracts and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
heueristik committed Oct 12, 2023
1 parent 6c032e7 commit 5d75e86
Show file tree
Hide file tree
Showing 61 changed files with 11,996 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .czrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "cz-conventional-changelog"
}
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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
31 changes: 31 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# GENERAL

## The network used for testing purposes
NETWORK_NAME="mainnet" # ["mainnet", "goerli", "polygon", "polygonMumbai"]

# CONTRACTS

## Hex encoded private keys separated by a comma `,`a
PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" # Default hardhat account 0 private key. DON'T USE FOR DEPLOYMENTS

## Infura credentials
INFURA_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"

## Gas Reporting
REPORT_GAS='true'
COINMARKETCAP_API_KEY="zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz"

## Block explorers
ETHERSCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
POLYGONSCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
BASESCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"

# SUBGRAPH

## The Graph credentials
GRAPH_KEY="zzzzzzzzzzzz"

## Subgraph
SUBGRAPH_NAME="osx"
SUBGRAPH_VERSION="alice-debug-1s"
SUBGRAPH_NETWORK_NAME="goerli" # ["mainnet", "goerli", "polygon", "polygonMumbai"]
43 changes: 43 additions & 0 deletions .github/workflows/contracts-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'contracts'

env:
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
working-directory: packages/contracts

on:
workflow_dispatch:
push:
paths:
- 'packages/contracts/**'
- '.github/workflows/contracts-*.yml'

jobs:
tests:
runs-on: 'ubuntu-latest'
defaults:
run:
working-directory: ${{env.working-directory}}
steps:
- name: 'Check out the repo'
uses: 'actions/checkout@v3'

- name: 'Install Node.js'
uses: 'actions/setup-node@v3'
with:
cache: 'yarn'
node-version: 16

- name: 'Install the dependencies'
run: 'yarn install'

- name: 'Lint the code'
run: 'yarn lint'
working-directory: packages/contracts

- name: 'Build the contracts'
run: 'yarn build'
working-directory: packages/contracts

- name: 'Test the contracts and generate the coverage report'
run: 'yarn coverage'
working-directory: packages/contracts
31 changes: 31 additions & 0 deletions .github/workflows/formatting-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 'formatting'

env:
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
working-directory: .

on:
workflow_dispatch:
push:

jobs:
checks:
runs-on: 'ubuntu-latest'
defaults:
run:
working-directory: ${{env.working-directory}}
steps:
- name: 'Check out the repo'
uses: 'actions/checkout@v3'

- name: 'Install Node.js'
uses: 'actions/setup-node@v3'
with:
cache: 'yarn'
node-version: 16

- name: 'Install the dependencies'
run: 'yarn install'

- name: 'Check code formatting'
run: yarn prettier:check
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# directories
.coverage_artifacts
.coverage_cache
.coverage_contracts
artifacts
build
cache
coverage
dist
node_modules
typechain

packages/subgraph/imported
packages/subgraph/generated
packages/subgraph/tests/.bin

# files
*.env
*.log
.DS_Store
.pnp.*
coverage.json

packages/contracts/plugin-info.json

packages/subgraph/deploy-output.txt
packages/subgraph/subgraph.yaml
packages/subgraph/tests/.latest.json
packages/subgraph/tests/helpers/extended-schema.ts
27 changes: 27 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# directories
.coverage_artifacts
.coverage_cache
.coverage_contracts
artifacts
build
cache
coverage
deployments
dist
node_modules
typechain
types
imported
generated
*/js-client/test/integration/*.test.ts

# files
*.env
*.log
.DS_Store
.pnp.*
coverage.json
package-lock.json
pnpm-lock.yaml
yarn.lock
extended-schema.ts
18 changes: 18 additions & 0 deletions contracts/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# directories
.coverage_artifacts
.coverage_cache
.coverage_contracts
artifacts
build
cache
coverage
dist
node_modules
typechain

# files
*.env
*.log
.DS_Store
.pnp.*
coverage.json
22 changes: 22 additions & 0 deletions contracts/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
extends:
- 'eslint:recommended'
- 'plugin:@typescript-eslint/eslint-recommended'
- 'plugin:@typescript-eslint/recommended'
- 'prettier'
parser: '@typescript-eslint/parser'
parserOptions:
project: 'tsconfig.json'
plugins:
- '@typescript-eslint'
root: true
rules:
'@typescript-eslint/no-floating-promises':
- error
- ignoreIIFE: true
ignoreVoid: true
'@typescript-eslint/no-inferrable-types': 'off'
'@typescript-eslint/no-explicit-any': 'off'
'@typescript-eslint/no-unused-vars':
- error
- argsIgnorePattern: '_'
varsIgnorePattern: '_'
7 changes: 7 additions & 0 deletions contracts/.solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
istanbulReporter: ['html', 'lcov'],
providerOptions: {
privateKey: process.env.PRIVATE_KEY,
},
skipFiles: ['test'],
};
19 changes: 19 additions & 0 deletions contracts/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"code-complexity": ["error", 8],
"compiler-version": ["error", "^0.8.8"],
"func-visibility": ["error", {"ignoreConstructors": true}],
"max-line-length": ["off", 100],
"named-parameters-mapping": "warn",
"no-console": "warn",
"not-rely-on-time": "off",
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
]
}
}
3 changes: 3 additions & 0 deletions contracts/.solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# directories
**/artifacts
**/node_modules
Loading

0 comments on commit 5d75e86

Please sign in to comment.