Skip to content

Commit fcf6051

Browse files
committed
Initial development setup
Hardhat-based development environment with Solidity and JS linting based on Keep rules. Configuration for Slither static analyzer from Trail Of Bits included as well.
1 parent 550e49d commit fcf6051

12 files changed

+9107
-0
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.sol linguist-language=Solidity

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
artifacts/
3+
cache/
4+
typechain/

.pre-commit-config.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
repos:
2+
- repo: https://github.com/keep-network/pre-commit-hooks.git
3+
rev: v1.3.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: pretty-format-json
7+
args: ['--autofix']
8+
- repo: local
9+
hooks:
10+
- id: lint-js
11+
name: 'lint js'
12+
entry: /usr/bin/env bash -c "cd solidity && npm run lint:js"
13+
files: '\.js$'
14+
language: script
15+
description: "Checks JS code according to the package's linter configuration"
16+
- id: lint-sol
17+
name: 'lint solidity'
18+
entry: /usr/bin/env bash -c "cd solidity && npm run lint:sol"
19+
files: '\.sol$'
20+
language: script
21+
description: "Checks Solidity code according to the package's linter configuration"

solidity/.eslintrc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": ["eslint-config-keep", "prettier"],
3+
"parserOptions": {
4+
"ecmaVersion": 2017,
5+
"sourceType": "module"
6+
},
7+
"env": {
8+
"es6": true,
9+
"mocha": true
10+
},
11+
"rules": {
12+
"new-cap": "off"
13+
}
14+
}
15+

solidity/.solhint.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "keep",
3+
"plugins": [],
4+
"rules": {
5+
"func-visibility": ["error", {"ignoreConstructors": true}]
6+
}
7+
}
8+

solidity/.solhintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

solidity/contracts/TBTCToken.sol

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity <0.9.0;
4+
5+
contract TBTCToken {}

solidity/hardhat.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require("@nomiclabs/hardhat-waffle")
2+
require("hardhat-gas-reporter")
3+
4+
module.exports = {
5+
solidity: {
6+
version: "0.7.6",
7+
},
8+
}

solidity/package.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "@keep-network/tbtc-v2",
3+
"license": "MIT",
4+
"dependencies": {
5+
"@openzeppelin/contracts": "^3.3.0"
6+
},
7+
"devDependencies": {
8+
"@nomiclabs/hardhat-ethers": "^2.0.2",
9+
"@nomiclabs/hardhat-waffle": "^2.0.1",
10+
"chai": "^4.3.4",
11+
"eslint": "^7.27.0",
12+
"eslint-config-keep": "github:keep-network/eslint-config-keep#0.3.0",
13+
"ethereum-waffle": "^3.3.0",
14+
"ethers": "^5.3.0",
15+
"hardhat": "^2.3.0",
16+
"hardhat-gas-reporter": "^1.0.4",
17+
"prettier": "^2.3.0",
18+
"prettier-plugin-solidity": "^1.0.0-beta.11 ",
19+
"solhint": "^3.3.6",
20+
"solhint-config-keep": "github:keep-network/solhint-config-keep",
21+
"typescript": "^4.3.2"
22+
},
23+
"scripts": {
24+
"build": "hardhat compile",
25+
"lint": "npm run lint:js && npm run lint:sol",
26+
"lint:fix:js": "eslint . --fix",
27+
"lint:fix:sol": "solhint 'contracts/**/*.sol' --fix && prettier --write '**/*.sol'",
28+
"lint:js": "eslint . ",
29+
"lint:sol": "solhint 'contracts/**/*.sol' && prettier --check '**/*.sol'",
30+
"test": "hardhat test"
31+
}
32+
}
33+

solidity/slither.config.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"detectors_to_exclude": "assembly,naming-convention,solc-version,timestamp,too-many-digits",
3+
"filter_paths": "contracts/test|node_modules"
4+
}
5+

solidity/test/TBTCToken.test.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const { expect } = require("chai")
2+
3+
describe("TBTCToken", () => {
4+
it("works", async () => {
5+
expect(1).is.equal(1)
6+
})
7+
})

0 commit comments

Comments
 (0)