From 74236c07edb98d9bcd3aab8594fc0e0dd2860df5 Mon Sep 17 00:00:00 2001 From: Gas <86567384+gas1cent@users.noreply.github.com> Date: Thu, 12 Oct 2023 23:16:32 +0400 Subject: [PATCH] build: update solhint wonderland plugin (#221) * build: update wonderland solhint plugin * fix: yarn lint command * style: fix the order of members in `IOracle` * style: unused import * style: unused imports --- package.json | 4 +-- solidity/interfaces/IOracle.sol | 32 +++++++++---------- solidity/test/integration/IntegrationBase.sol | 4 +-- .../test/mocks/contracts/MockAccounting.sol | 2 +- .../test/mocks/interfaces/IMockAccounting.sol | 2 -- solidity/test/utils/Helpers.sol | 3 -- yarn.lock | 8 ++--- 7 files changed, 25 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index e1e7bf5..a73f646 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "docs:build": "./build-docs.sh", "docs:run": "mdbook serve docs", "postinstall": "husky install", - "lint:check": "yarn lint:sol-tests && yarn lint:sol-logic && forge fmt check", + "lint:check": "yarn lint:sol-tests && yarn lint:sol-logic && forge fmt --check", "lint:fix": "sort-package-json && forge fmt && yarn lint:sol-tests --fix && yarn lint:sol-logic --fix", "lint:sol-logic": "solhint 'solidity/contracts/**/*.sol' 'solidity/interfaces/**/*.sol'", "lint:sol-tests": "solhint -c .solhint.tests.json 'solidity/test/**/*.sol'", @@ -56,7 +56,7 @@ "lint-staged": "13.2.2", "pinst": "3.0.0", "solhint": "3.5.1", - "solhint-plugin-defi-wonderland": "1.1.0", + "solhint-plugin-defi-wonderland": "1.1.2", "solidity-docgen": "0.6.0-beta.35", "sort-package-json": "2.4.1", "standard-version": "9.5.0", diff --git a/solidity/interfaces/IOracle.sol b/solidity/interfaces/IOracle.sol index 77caaa0..fba4bd6 100644 --- a/solidity/interfaces/IOracle.sol +++ b/solidity/interfaces/IOracle.sol @@ -163,6 +163,22 @@ interface IOracle { */ error Oracle_CannotTamperParticipant(); + /*/////////////////////////////////////////////////////////////// + ENUMS + //////////////////////////////////////////////////////////////*/ + + /** + * @notice All available statuses a dispute can have + */ + enum DisputeStatus { + None, + Active, + Escalated, + Won, + Lost, + NoResolution + } + /*/////////////////////////////////////////////////////////////// STRUCTS //////////////////////////////////////////////////////////////*/ @@ -293,22 +309,6 @@ interface IOracle { DisputeStatus status; } - /*/////////////////////////////////////////////////////////////// - ENUMS - //////////////////////////////////////////////////////////////*/ - - /** - * @notice All available statuses a dispute can have - */ - enum DisputeStatus { - None, - Active, - Escalated, - Won, - Lost, - NoResolution - } - /*/////////////////////////////////////////////////////////////// VARIABLES //////////////////////////////////////////////////////////////*/ diff --git a/solidity/test/integration/IntegrationBase.sol b/solidity/test/integration/IntegrationBase.sol index 634ff1a..c4ec1a3 100644 --- a/solidity/test/integration/IntegrationBase.sol +++ b/solidity/test/integration/IntegrationBase.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; +// solhint-disable no-unused-import // solhint-disable-next-line no-console import {console} from 'forge-std/console.sol'; -/* solhint-disable no-unused-import */ import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {DSTestPlus} from '@defi-wonderland/solidity-utils/solidity/test/DSTestPlus.sol'; import {Helpers} from '../utils/Helpers.sol'; @@ -26,7 +26,7 @@ import {MockResolutionModule, IMockResolutionModule} from '../mocks/contracts/Mo import {MockFinalityModule, IMockFinalityModule} from '../mocks/contracts/MockFinalityModule.sol'; import {TestConstants} from '../utils/TestConstants.sol'; -/* solhint-enable no-unused-import */ +// solhint-enable no-unused-import contract IntegrationBase is DSTestPlus, TestConstants, Helpers { uint256 public constant FORK_BLOCK = 756_611; diff --git a/solidity/test/mocks/contracts/MockAccounting.sol b/solidity/test/mocks/contracts/MockAccounting.sol index e7b0665..b906d87 100644 --- a/solidity/test/mocks/contracts/MockAccounting.sol +++ b/solidity/test/mocks/contracts/MockAccounting.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IMockAccounting, IERC20} from '../interfaces/IMockAccounting.sol'; +import {IMockAccounting} from '../interfaces/IMockAccounting.sol'; contract MockAccounting is IMockAccounting {} diff --git a/solidity/test/mocks/interfaces/IMockAccounting.sol b/solidity/test/mocks/interfaces/IMockAccounting.sol index a68eeb1..7427c43 100644 --- a/solidity/test/mocks/interfaces/IMockAccounting.sol +++ b/solidity/test/mocks/interfaces/IMockAccounting.sol @@ -1,6 +1,4 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; - interface IMockAccounting {} diff --git a/solidity/test/utils/Helpers.sol b/solidity/test/utils/Helpers.sol index 462e0d0..827e802 100644 --- a/solidity/test/utils/Helpers.sol +++ b/solidity/test/utils/Helpers.sol @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {DSTestPlus} from '@defi-wonderland/solidity-utils/solidity/test/DSTestPlus.sol'; - import {IOracle} from '../../contracts/Oracle.sol'; -import {IMockAccounting} from '../mocks/interfaces/IMockAccounting.sol'; contract Helpers is DSTestPlus { function _getMockDispute( diff --git a/yarn.lock b/yarn.lock index 0a27304..a5a064f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2779,10 +2779,10 @@ slice-ansi@^5.0.0: ansi-styles "^6.0.0" is-fullwidth-code-point "^4.0.0" -solhint-plugin-defi-wonderland@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/solhint-plugin-defi-wonderland/-/solhint-plugin-defi-wonderland-1.1.0.tgz#6b82ee4da9fea1a4aeed4409915c3980f0f6b6a2" - integrity sha512-dl5wyURqrs9KgkDjYDW5RN55Fij7rrtybluqG45csilqD9x2vd+iAkaMD2VU150TqmfrcYN5p1Rer3sKWRNIPQ== +solhint-plugin-defi-wonderland@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/solhint-plugin-defi-wonderland/-/solhint-plugin-defi-wonderland-1.1.2.tgz#9bb26e173dd14c23eb28d107dd5ee21953ce0d5e" + integrity sha512-LkszaY3JwTpnWPRWTjPVzemMl+2LSw64Xd0wOE3dmPvBsELfvPo659zfQexLfxEtuubfuA33rw5WQw0LBC2alA== dependencies: solhint "3.3.7"