Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General repo improvements #109

Merged
merged 4 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 43 additions & 41 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,64 +12,66 @@ env:
NODE_OPTIONS: --max_old_space_size=4096

jobs:

tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Cache Compiler Installations
uses: actions/cache@v2
with:
path: |
~/.solcx
~/.vvm
key: compiler-cache
- name: Cache Compiler Installations
uses: actions/cache@v2
with:
path: |
~/.solcx
~/.vvm
key: compiler-cache

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'npm'
- run: npm install -g ganache
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "npm"
- run: npm install -g ganache

- name: Setup Python 3.8
uses: actions/setup-python@v3
with:
cache: 'pip'
python-version: '3.8'
- run: pip install -r requirements.txt
- name: Setup Python 3.8
uses: actions/setup-python@v3
with:
cache: "pip"
python-version: "3.8"
- run: pip install -r requirements.txt

- name: Run Tests
run: ape test
- name: Run Tests
run: ape test

- name: Deploy NuCypher Token
run: ape run scripts/deploy_nucypher_token.py --network ethereum:local
- name: Deploy NuCypher Token
run: ape run scripts/deploy_nucypher_token.py --network ethereum:local

- name: Deploy TACo Application
run: ape run scripts/deploy_taco_application.py --network ethereum:local
- name: Deploy TACo Application
run: ape run scripts/deploy_taco_application.py --network ethereum:local

- name: Deploy Staking Escrow
run: ape run scripts/deploy_staking_escrow.py --network ethereum:local
- name: Deploy Staking Escrow
run: ape run scripts/deploy_staking_escrow.py --network ethereum:local

- name: Deploy Subscription Manager
run: ape run scripts/deploy_subscription_manager.py --network ethereum:local
- name: Deploy Subscription Manager
run: ape run scripts/deploy_subscription_manager.py --network ethereum:local

linting:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Install Solhint and Prettier
run: npm install -g solhint solhint-plugin-prettier prettier

- name: Install Solhint
run: npm install -g solhint
- name: Install Solidity plugin for Prettier
run: npm install prettier-plugin-solidity

- name: Solidty Lint
run: solhint 'contracts/**/*.sol'
- name: Solidty Lint
run: solhint 'contracts/**/*.sol'

- name: Python lint
uses: cclauss/GitHub-Action-for-pylint@0.7.0
continue-on-error: true
with:
args: "pylint **/*.py"
- name: Python lint
uses: cclauss/GitHub-Action-for-pylint@0.7.0
continue-on-error: true
with:
args: "pylint **/*.py"
35 changes: 29 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
repos:
- repo: https://github.com/psf/black
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- id: black

- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: flake8
- id: flake8

- repo: https://github.com/pre-commit/mirrors-isort
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
- id: isort

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
hooks:
- id: prettier

- repo: local
hooks:
- id: lint-sol
name: "lint solidity"
description: "Checks Solidity code according to the package's linter configuration"
language: node
entry: solhint
files: '\.sol$'
args:
- --config=./.solhint.json
- --ignore-path=./.solhintignore
- ./contracts/**/*.sol
additional_dependencies:
- solhint
- solhint-plugin-prettier
- prettier
- prettier-plugin-solidity
6 changes: 6 additions & 0 deletions .prettierignore
theref marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/contracts/contracts/proxy/
**/contracts/contracts/StakingEscrow.sol
**/contracts/contracts/NuCypherToken.sol
**/contracts/test/proxy/
**/contracts/test/StakingEscrowTestSet.sol
**/.cache
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["prettier-plugin-solidity"],
"printWidth": 100
}
43 changes: 40 additions & 3 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,46 @@
{
"extends": "solhint:recommended",
"plugins": [],
"plugins": ["prettier"],
"rules": {
"explicit-types": ["error", "explicit"],
"no-console": "error",
"no-empty-blocks": "error",
"compiler-version": ["error", "^0.8.0"],
"max-states-count": ["warn", 20],
"no-unused-vars": "error",
"reason-string": ["error", { "maxLength": 250 }],
"constructor-syntax": "error",
"quotes": ["error", "double"],
"const-name-snakecase": "error",
"contract-name-camelcase": "error",
"event-name-camelcase": "error",
"func-name-mixedcase": "error",
"immutable-vars-naming": ["error", { "immutablesAsConstants": false }],
"modifier-name-mixedcase": "error",
"var-name-mixedcase": "error",
"named-parameters-mapping": "warn",
"use-forbidden-name": "error",
"imports-on-top": "error",
"ordering": "warn",
"visibility-modifier-order": "error",
"avoid-call-value": "error",
"avoid-low-level-calls": "error",
"avoid-sha3": "error",
"avoid-suicide": "error",
"avoid-sha3": "warn",
"compiler-version": ["error", "^0.8.0"]
"avoid-throw": "error",
"avoid-tx-origin": "error",
"check-send-result": "error",
"func-visibility": ["error", { "ignoreConstructors": true }],
"multiple-sends": "error",
"no-complex-fallback": "error",
"no-inline-assembly": "off",
"no-unused-import": "error",
"not-rely-on-block-hash": "error",
"not-rely-on-time": "off",
"reentrancy": "error",
"state-visibility": "error",
"no-global-import": "off",
"func-named-parameters": "off",
"prettier/prettier": "error"
}
}
5 changes: 5 additions & 0 deletions .solhintignore
theref marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/contracts/contracts/proxy/
**/contracts/contracts/StakingEscrow.sol
**/contracts/contracts/NuCypherToken.sol
**/contracts/test/proxy/
**/contracts/test/StakingEscrowTestSet.sol
3 changes: 2 additions & 1 deletion contracts/aragon/interfaces/IERC900History.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

pragma solidity ^0.8.0;


// Minimum interface to interact with Aragon's Aggregator
interface IERC900History {
function totalStakedForAt(address addr, uint256 blockNumber) external view returns (uint256);

function totalStakedAt(uint256 blockNumber) external view returns (uint256);

function supportsHistory() external pure returns (bool);
}
Loading
Loading