diff --git a/.commitlintrc.yaml b/.commitlintrc.yaml new file mode 100644 index 000000000..247ff21e6 --- /dev/null +++ b/.commitlintrc.yaml @@ -0,0 +1,3 @@ +extends: + - "@commitlint/config-conventional" + \ No newline at end of file diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 000000000..b5a5eb074 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx commitlint --edit "$1" diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..d24fdfc60 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx lint-staged diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..b43bf86b5 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +README.md diff --git a/.solhint.json b/.solhint.json new file mode 100644 index 000000000..742915020 --- /dev/null +++ b/.solhint.json @@ -0,0 +1,16 @@ +{ + "extends": "solhint:recommended", + "rules": { + "code-complexity": ["warn", 7], + "function-max-lines": ["warn", 50], + "max-line-length": ["error", 120], + "func-param-name-mixedcase": "warn", + "modifier-name-mixedcase": "warn", + "ordering": "warn", + "compiler-version": ["error", "^0.8.20"], + "func-visibility": ["warn", { "ignoreConstructors": true }], + "immutable-vars-naming": "off", + "one-contract-per-file": "off", + "no-console": "off" + } +} diff --git a/.solhintignore b/.solhintignore new file mode 100644 index 000000000..7a2b3c1c1 --- /dev/null +++ b/.solhintignore @@ -0,0 +1,2 @@ +lib +node_modules/ diff --git a/README.md b/README.md index e74d7a753..52ece5546 100644 --- a/README.md +++ b/README.md @@ -467,4 +467,4 @@ Shout out to the following organizations for their unconditional donations to us
-Disclaimer: DappLearning is a non-profit learning organization and not involved in any commercial events or endorsements for commercial projects. +Disclaimer: DappLearning is a non-profit learning organization and not involved in any commercial events or endorsements for commercial projects. \ No newline at end of file diff --git a/defi/Uniswap-V3/frontGuide/sdk/scripts/pool.ts b/defi/Uniswap-V3/frontGuide/sdk/scripts/pool.ts index 00526cd8c..9d3b8413a 100644 --- a/defi/Uniswap-V3/frontGuide/sdk/scripts/pool.ts +++ b/defi/Uniswap-V3/frontGuide/sdk/scripts/pool.ts @@ -7,11 +7,7 @@ import { BigNumber } from 'ethers'; // usdc/eth const poolAddress = '0x8ad599c3A0ff1De082011EFDDc58f1908eb6e6D8'; -const poolContract = new ethers.Contract( - poolAddress, - IUniswapV3PoolABI, - ethers.provider -); +const poolContract = new ethers.Contract(poolAddress, IUniswapV3PoolABI, ethers.provider); interface Immutables { factory: string; @@ -66,14 +62,7 @@ async function main() { const TokenA = new Token(1, immutables.token0, 6, 'USDC', 'USD Coin'); const TokenB = new Token(1, immutables.token1, 18, 'WETH', 'Wrapped Ether'); - const poolExample = new Pool( - TokenA, - TokenB, - immutables.fee, - state.sqrtPriceX96.toString(), - state.liquidity.toString(), - state.tick - ); + const poolExample = new Pool(TokenA, TokenB, immutables.fee, state.sqrtPriceX96.toString(), state.liquidity.toString(), state.tick); console.log(poolExample); } diff --git a/package.json b/package.json index a42fc2b18..589a5bbc2 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,27 @@ ], "license": "ISC", "dependencies": { - "create-next-app": "^12.3.1", - "prettier": "^2.0.5" + "create-next-app": "^12.3.1" }, "devDependencies": { - "hardhat": "^2.12.4" + "@commitlint/config-conventional": "^19.1.0", + "commitlint": "^19.2.1", + "hardhat": "^2.12.4", + "husky": "^9.0.11", + "lint-staged": "^15.2.2", + "prettier": "^3.2.5", + "prettier-plugin-solidity": "^1.3.1", + "solhint": "^4.5.2" + }, + "scripts": { + "prepare": "husky" + }, + "lint-staged": { + "*.sol": [ + "solhint", + "prettier --write --plugin=prettier-plugin-solidity" + ], + "*.{js,jsx,ts,tsx}": "prettier --write", + "*.md": "prettier --write" } }