Skip to content

Commit

Permalink
🎨 solhint for prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
0xZick committed Mar 10, 2023
1 parent 2f9cc21 commit 7f476e0
Show file tree
Hide file tree
Showing 50 changed files with 36,733 additions and 37,250 deletions.
82 changes: 41 additions & 41 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
name: test

on:
push:
branches:
- master
pull_request:
push:
branches:
- master
pull_request:

env:
FOUNDRY_PROFILE: ci
FOUNDRY_PROFILE: ci

jobs:
foundry:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

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

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vv
id: forge-test

- name: Run Forge coverage
run: |
forge coverage --report lcov
id: forge-coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
foundry:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

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

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vv
id: forge-test

- name: Run Forge coverage
run: |
forge coverage --report lcov
id: forge-coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
15 changes: 14 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,22 @@
**/node_modules
**/out
**/types
**/typechain-types
**/.idea
**/.github

*.md
*.env
*.log
*.sqrl
coverage.json
coverage.json
tsconfig.json
yarn.lock
package-lock.json
.env.example
.gitignore
.gitmodules
.prettierignore
.solhintignore
foundry.toml
remappings.txt
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
}
}
]
}
}
35 changes: 35 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"singleQuote": ["error", false],
"code-complexity": ["error", 18],
"compiler-version": ["error", ">=0.8.17"],
"constructor-syntax": "error",
"func-visibility": [
"error",
{
"ignoreConstructors": true
}
],
"max-line-length": ["error", 120],
"not-rely-on-time": "off",
"avoid-low-level-calls": "off",
"no-empty-blocks": "off",
"no-inline-assembly": "off",
"avoid-tx-origin": "off",
"prettier/prettier": [
"error",
{
"endOfLine": "lf"
}
],
"reason-string": [
"error",
{
"maxBytes": 64,
"maxLength": 64
}
]
}
}
23 changes: 23 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**/.git/
**/.yarn/
**/artifacts
**/build
**/cache
**/cache_hardhat
**/lib
**/coverage
**/node_modules
**/out
**/types
**/typechain-types
**/.idea
**/.github

*.md
*.env
*.log
*.sqrl
coverage.json
tsconfig.json
yarn.lock
package-lock.json
134 changes: 66 additions & 68 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,90 +4,88 @@ import "@typechain/hardhat";
import "@nomiclabs/hardhat-etherscan";
import "hardhat-deploy";
import "hardhat-tracer";
import "hardhat-gas-reporter"
import "hardhat-preprocessor";
import "hardhat-gas-reporter";
import "hardhat-preprocessor";
import { HardhatUserConfig, task } from "hardhat/config";
import { config as dotEnvConfig } from "dotenv";

function getRemappings() {
return fs
.readFileSync("remappings.txt", "utf8")
.split("\n")
.filter(Boolean)
.map((line) => line.trim().split("="));
return fs
.readFileSync("remappings.txt", "utf8")
.split("\n")
.filter(Boolean)
.map(line => line.trim().split("="));
}

dotEnvConfig();

const { INFURA_TOKEN, PRIVATE_KEY, ETHERSCAN_API_KEY } = process.env;

const config: HardhatUserConfig = {
solidity: {
version: "0.8.13",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
solidity: {
version: "0.8.13",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
},
paths: {
sources: "./src", // Use ./src rather than ./contracts as Hardhat expects
cache: "./cache_hardhat", // Use a different cache for Hardhat than Foundry
},
networks: {
goerli: {
url: `https://goerli.infura.io/v3/${INFURA_TOKEN}`,
accounts: PRIVATE_KEY
? [PRIVATE_KEY]
: {
mnemonic:
"test test test test test test test test test test test junk",
},
paths: {
sources: "./src", // Use ./src rather than ./contracts as Hardhat expects
cache: "./cache_hardhat", // Use a different cache for Hardhat than Foundry
},
mainnet: {
url: `https://mainnet.infura.io/v3/${INFURA_TOKEN}`,
accounts: PRIVATE_KEY
? [PRIVATE_KEY]
: {
mnemonic:
"test test test test test test test test test test test junk",
},
networks: {
goerli: {
url: `https://goerli.infura.io/v3/${INFURA_TOKEN}`,
accounts: PRIVATE_KEY
? [PRIVATE_KEY]
: {
mnemonic: "test test test test test test test test test test test junk",
},
},
mainnet: {
url: `https://mainnet.infura.io/v3/${INFURA_TOKEN}`,
accounts: PRIVATE_KEY
? [PRIVATE_KEY]
: {
mnemonic: "test test test test test test test test test test test junk",
},
},
hardhat: {
blockGasLimit: 9500000,
chainId: 1,
forking: {
url: `https://eth-mainnet.alchemyapi.io/v2/qPC1XAgnhOiR3kuhw9DJ8g8WVLWs6R9Q`,
blockNumber: 16241092,
},
initialBaseFeePerGas: 5,
},
coverage: {
url: "http://127.0.0.1:8555",
},
},
hardhat: {
blockGasLimit: 9500000,
chainId: 1,
forking: {
url: `https://eth-mainnet.alchemyapi.io/v2/qPC1XAgnhOiR3kuhw9DJ8g8WVLWs6R9Q`,
blockNumber: 16241092,
},
initialBaseFeePerGas: 5,
etherscan: {
apiKey: ETHERSCAN_API_KEY,
},
coverage: {
url: "http://127.0.0.1:8555",
mocha: {
timeout: 100000000,
},
// This fully resolves paths for imports in the ./lib directory for Hardhat
preprocess: {
eachLine: hre => ({
transform: (line: string) => {
if (line.match(/^\s*import /i)) {
getRemappings().forEach(([find, replace]) => {
if (line.match(find)) {
line = line.replace(find, replace);
}
});
}
return line;
},
}),
},
},
etherscan: {
apiKey: ETHERSCAN_API_KEY,
},
mocha: {
timeout: 100000000
},
// This fully resolves paths for imports in the ./lib directory for Hardhat
preprocess: {
eachLine: (hre) => ({
transform: (line: string) => {
if (line.match(/^\s*import /i)) {
getRemappings().forEach(([find, replace]) => {
if (line.match(find)) {
line = line.replace(find, replace);
}
});
}
return line;
},
}),
},
};

export default config;
Loading

0 comments on commit 7f476e0

Please sign in to comment.