From dbfc3af961355373f17ad92035a8b8593f6d73d7 Mon Sep 17 00:00:00 2001 From: kyriediculous Date: Thu, 30 Nov 2023 17:32:25 +0100 Subject: [PATCH] feat: linter updates --- package.json | 4 ++-- script/Adapter_Deploy.s.sol | 2 ++ script/Tenderize_Deploy.s.sol | 2 ++ script/XYZ_Data.s.sol | 2 ++ script/XYZ_Deploy.s.sol | 2 ++ script/XYZ_Faucet.s.sol | 2 ++ src/adapters/PolygonAdapter.sol | 1 + src/adapters/interfaces/IPolygon.sol | 2 ++ src/tenderizer/Tenderizer.sol | 1 + src/utils/TWAP.sol | 8 ++++---- test/adapters/PolygonAdapter.t.sol | 3 +++ test/helpers/StakingXYZ.sol | 2 +- test/helpers/XYZAdapter.sol | 4 ++-- test/tenderizer/Tenderizer.harness.sol | 1 + 14 files changed, 27 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 2f8b760..7d0c4fe 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ }, "scripts": { "clean": "rimraf cache out", - "lint": "yarn lint:sol && yarn prettier:check", - "lint:sol": "forge fmt --check && yarn solhint \"{src,test}/**/*.sol\"", + "lint": "yarn lint:sol && yarn prettier:write", + "lint:sol": "yarn solhint \"{src,test,script}/**/*.sol\"", "postinstall": "husky install", "prettier:check": "prettier --check \"**/*.{json,md,yml}\"", "prettier:write": "prettier --write \"**/*.{json,md,yml}\"" diff --git a/script/Adapter_Deploy.s.sol b/script/Adapter_Deploy.s.sol index af2e66f..08cd8b0 100644 --- a/script/Adapter_Deploy.s.sol +++ b/script/Adapter_Deploy.s.sol @@ -9,6 +9,8 @@ // // Copyright (c) Tenderize Labs Ltd +// solhint-disable no-console + pragma solidity >=0.8.19; import { Script } from "forge-std/Script.sol"; diff --git a/script/Tenderize_Deploy.s.sol b/script/Tenderize_Deploy.s.sol index 5b7942c..172b206 100644 --- a/script/Tenderize_Deploy.s.sol +++ b/script/Tenderize_Deploy.s.sol @@ -9,6 +9,8 @@ // // Copyright (c) Tenderize Labs Ltd +// solhint-disable no-console + pragma solidity >=0.8.19; import { Script, console2 } from "forge-std/Script.sol"; diff --git a/script/XYZ_Data.s.sol b/script/XYZ_Data.s.sol index 2adb2c0..a57c089 100644 --- a/script/XYZ_Data.s.sol +++ b/script/XYZ_Data.s.sol @@ -9,6 +9,8 @@ // // Copyright (c) Tenderize Labs Ltd +// solhint-disable no-console + pragma solidity >=0.8.19; import { Script, console2 } from "forge-std/Script.sol"; diff --git a/script/XYZ_Deploy.s.sol b/script/XYZ_Deploy.s.sol index 81cb483..a278e2a 100644 --- a/script/XYZ_Deploy.s.sol +++ b/script/XYZ_Deploy.s.sol @@ -9,6 +9,8 @@ // // Copyright (c) Tenderize Labs Ltd +// solhint-disable no-console + pragma solidity >=0.8.19; import { Script, console2 } from "forge-std/Script.sol"; diff --git a/script/XYZ_Faucet.s.sol b/script/XYZ_Faucet.s.sol index 5d5b0e9..ef08244 100644 --- a/script/XYZ_Faucet.s.sol +++ b/script/XYZ_Faucet.s.sol @@ -9,6 +9,8 @@ // // Copyright (c) Tenderize Labs Ltd +// solhint-disable no-console + pragma solidity >=0.8.19; import { Script, console2 } from "forge-std/Script.sol"; diff --git a/src/adapters/PolygonAdapter.sol b/src/adapters/PolygonAdapter.sol index 8e6e8f9..8cdc339 100644 --- a/src/adapters/PolygonAdapter.sol +++ b/src/adapters/PolygonAdapter.sol @@ -136,6 +136,7 @@ contract PolygonAdapter is Adapter { // This call will revert if there are no rewards // In which case we don't throw, just return the current staked amount. + // solhint-disable-next-line no-empty-blocks try validatorShares.restake() { } catch { return currentStake; diff --git a/src/adapters/interfaces/IPolygon.sol b/src/adapters/interfaces/IPolygon.sol index 293cc51..e1ec203 100644 --- a/src/adapters/interfaces/IPolygon.sol +++ b/src/adapters/interfaces/IPolygon.sol @@ -2,6 +2,8 @@ // SPDX-License-Identifier: MIT +// solhint-disable func-name-mixedcase + pragma solidity >=0.8.19; struct DelegatorUnbond { diff --git a/src/tenderizer/Tenderizer.sol b/src/tenderizer/Tenderizer.sol index 4cce714..2163ea6 100644 --- a/src/tenderizer/Tenderizer.sol +++ b/src/tenderizer/Tenderizer.sol @@ -41,6 +41,7 @@ contract Tenderizer is TenderizerImmutableArgs, TenderizerEvents, TToken, Multic uint256 private constant MAX_FEE = 0.005e6; // 0.5% uint256 private constant FEE_BASE = 1e6; + // solhint-disable-next-line no-empty-blocks constructor(address _registry, address _unlocks) TenderizerImmutableArgs(_registry, _unlocks) { } // @inheritdoc TToken diff --git a/src/utils/TWAP.sol b/src/utils/TWAP.sol index 3422efd..560bb66 100644 --- a/src/utils/TWAP.sol +++ b/src/utils/TWAP.sol @@ -11,10 +11,10 @@ pragma solidity >=0.8.19; -import "@uniswap/v3-core/interfaces/IUniswapV3Pool.sol"; -import "@uniswap/v3-core/libraries/TickMath.sol"; -import "@uniswap/v3-core/libraries/FixedPoint96.sol"; -import "@uniswap/v3-core/libraries/FullMath.sol"; +import { IUniswapV3Pool } from "@uniswap/v3-core/interfaces/IUniswapV3Pool.sol"; +import { TickMath } from "@uniswap/v3-core/libraries/TickMath.sol"; +import { FixedPoint96 } from "@uniswap/v3-core/libraries/FixedPoint96.sol"; +import { FullMath } from "@uniswap/v3-core/libraries/FullMath.sol"; library TWAP { function getSqrtTwapX96(address uniswapV3Pool, uint32 twapInterval) internal view returns (uint160 sqrtPriceX96) { diff --git a/test/adapters/PolygonAdapter.t.sol b/test/adapters/PolygonAdapter.t.sol index b066e9c..5d2b8a5 100644 --- a/test/adapters/PolygonAdapter.t.sol +++ b/test/adapters/PolygonAdapter.t.sol @@ -9,6 +9,9 @@ // // Copyright (c) Tenderize Labs Ltd +// solhint-disable state-visibility +// solhint-disable func-name-mixedcase + pragma solidity >=0.8.19; import { Test, stdError } from "forge-std/Test.sol"; diff --git a/test/helpers/StakingXYZ.sol b/test/helpers/StakingXYZ.sol index 1fa8b74..c605f3e 100644 --- a/test/helpers/StakingXYZ.sol +++ b/test/helpers/StakingXYZ.sol @@ -15,7 +15,7 @@ import { MockERC20 } from "solmate/test/utils/mocks/MockERC20.sol"; pragma solidity >=0.8.19; contract StakingXYZ { - address immutable token; + address private immutable token; uint256 public nextRewardTimeStamp; uint256 public immutable APR; diff --git a/test/helpers/XYZAdapter.sol b/test/helpers/XYZAdapter.sol index ea74d67..0b610b1 100644 --- a/test/helpers/XYZAdapter.sol +++ b/test/helpers/XYZAdapter.sol @@ -19,8 +19,8 @@ import { StakingXYZ } from "./StakingXYZ.sol"; pragma solidity >=0.8.19; contract XYZAdapter is Adapter { - address immutable STAKINGXYZ; - address immutable XYZ_TOKEN; + address private immutable STAKINGXYZ; + address private immutable XYZ_TOKEN; constructor(address _stakingXYZ, address _xyz) { STAKINGXYZ = _stakingXYZ; diff --git a/test/tenderizer/Tenderizer.harness.sol b/test/tenderizer/Tenderizer.harness.sol index 7baeb2b..41061fe 100644 --- a/test/tenderizer/Tenderizer.harness.sol +++ b/test/tenderizer/Tenderizer.harness.sol @@ -16,6 +16,7 @@ import { Unlocks } from "core/unlocks/Unlocks.sol"; import { Registry } from "core/registry/Registry.sol"; // solhint-disable func-name-mixedcase +// solhint-disable no-empty-blocks contract TenderizerHarness is Tenderizer { constructor(address _registry, address _unlocks) Tenderizer(_registry, _unlocks) { }