From 59618d62f5f59183622bd2d0a7b9d49ee8e24565 Mon Sep 17 00:00:00 2001 From: Gas One Cent <86567384+gas1cent@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:30:26 +0400 Subject: [PATCH] style: fix linter warnings --- .../BondEscalationResolutionModule.sol | 2 - .../extensions/IBondEscalationAccounting.sol | 40 +++++++++---------- .../dispute/ICircuitResolverModule.sol | 18 ++++----- .../modules/request/IHttpRequestModule.sol | 24 +++++------ .../modules/resolution/IArbitratorModule.sol | 22 +++++----- .../unit/extensions/AccountingExtension.t.sol | 2 +- .../dispute/RootVerificationModule.t.sol | 8 ++-- .../BondEscalationResolutionModule.t.sol | 24 +++++------ solidity/test/utils/Helpers.sol | 3 -- 9 files changed, 69 insertions(+), 74 deletions(-) diff --git a/solidity/contracts/modules/resolution/BondEscalationResolutionModule.sol b/solidity/contracts/modules/resolution/BondEscalationResolutionModule.sol index 6bb09197..edbaa772 100644 --- a/solidity/contracts/modules/resolution/BondEscalationResolutionModule.sol +++ b/solidity/contracts/modules/resolution/BondEscalationResolutionModule.sol @@ -7,8 +7,6 @@ import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol import {FixedPointMathLib} from 'solmate/utils/FixedPointMathLib.sol'; // solhint-disable-next-line no-unused-import -import {IResolutionModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/resolution/IResolutionModule.sol'; import {Module, IModule} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; diff --git a/solidity/interfaces/extensions/IBondEscalationAccounting.sol b/solidity/interfaces/extensions/IBondEscalationAccounting.sol index ce7728c9..835e9346 100644 --- a/solidity/interfaces/extensions/IBondEscalationAccounting.sol +++ b/solidity/interfaces/extensions/IBondEscalationAccounting.sol @@ -89,26 +89,6 @@ interface IBondEscalationAccounting is IAccountingExtension { bytes32 indexed _requestId, bytes32 indexed _disputeId, address indexed _pledger, IERC20 _token, uint256 _amount ); - /*/////////////////////////////////////////////////////////////// - STRUCTS - //////////////////////////////////////////////////////////////*/ - - /** - * @notice Contains the data of the result of an escalation. Is used by users to claim their pledges - * @param requestId The ID of the bond-escalated request - * @param forVotesWon Whether the for votes won the dispute - * @param token The address of the token being paid out - * @param amountPerPledger The amount of token paid to each of the winning pledgers - * @param bondEscalationModule The address of the bond escalation module that was used - */ - struct EscalationResult { - bytes32 requestId; - bool forVotesWon; - IERC20 token; - uint256 amountPerPledger; - IBondEscalationModule bondEscalationModule; - } - /*/////////////////////////////////////////////////////////////// ERRORS //////////////////////////////////////////////////////////////*/ @@ -133,6 +113,26 @@ interface IBondEscalationAccounting is IAccountingExtension { */ error BondEscalationAccounting_AlreadySettled(); + /*/////////////////////////////////////////////////////////////// + STRUCTS + //////////////////////////////////////////////////////////////*/ + + /** + * @notice Contains the data of the result of an escalation. Is used by users to claim their pledges + * @param requestId The ID of the bond-escalated request + * @param forVotesWon Whether the for votes won the dispute + * @param token The address of the token being paid out + * @param amountPerPledger The amount of token paid to each of the winning pledgers + * @param bondEscalationModule The address of the bond escalation module that was used + */ + struct EscalationResult { + bytes32 requestId; + bool forVotesWon; + IERC20 token; + uint256 amountPerPledger; + IBondEscalationModule bondEscalationModule; + } + /*/////////////////////////////////////////////////////////////// VARIABLES //////////////////////////////////////////////////////////////*/ diff --git a/solidity/interfaces/modules/dispute/ICircuitResolverModule.sol b/solidity/interfaces/modules/dispute/ICircuitResolverModule.sol index ae3272fd..c7de588d 100644 --- a/solidity/interfaces/modules/dispute/ICircuitResolverModule.sol +++ b/solidity/interfaces/modules/dispute/ICircuitResolverModule.sol @@ -20,6 +20,15 @@ import {IAccountingExtension} from '../../extensions/IAccountingExtension.sol'; * and the request is finalized. */ interface ICircuitResolverModule is IDisputeModule { + /*/////////////////////////////////////////////////////////////// + ERRORS + //////////////////////////////////////////////////////////////*/ + + /** + * @notice Thrown when the verification of a response fails + */ + error CircuitResolverModule_VerificationFailed(); + /*/////////////////////////////////////////////////////////////// STRUCTS //////////////////////////////////////////////////////////////*/ @@ -41,15 +50,6 @@ interface ICircuitResolverModule is IDisputeModule { uint256 bondSize; } - /*/////////////////////////////////////////////////////////////// - ERRORS - //////////////////////////////////////////////////////////////*/ - - /** - * @notice Thrown when the verification of a response fails - */ - error CircuitResolverModule_VerificationFailed(); - /*/////////////////////////////////////////////////////////////// LOGIC //////////////////////////////////////////////////////////////*/ diff --git a/solidity/interfaces/modules/request/IHttpRequestModule.sol b/solidity/interfaces/modules/request/IHttpRequestModule.sol index a4e3db93..9060688c 100644 --- a/solidity/interfaces/modules/request/IHttpRequestModule.sol +++ b/solidity/interfaces/modules/request/IHttpRequestModule.sol @@ -12,6 +12,18 @@ import {IAccountingExtension} from '../../../interfaces/extensions/IAccountingEx * @notice Module allowing users to request HTTP calls */ interface IHttpRequestModule is IRequestModule { + /*/////////////////////////////////////////////////////////////// + ENUMS + //////////////////////////////////////////////////////////////*/ + + /** + * @notice Available HTTP methods + */ + enum HttpMethod { + GET, + POST + } + /*/////////////////////////////////////////////////////////////// STRUCTS //////////////////////////////////////////////////////////////*/ @@ -34,18 +46,6 @@ interface IHttpRequestModule is IRequestModule { uint256 paymentAmount; } - /*/////////////////////////////////////////////////////////////// - ENUMS - //////////////////////////////////////////////////////////////*/ - - /** - * @notice Available HTTP methods - */ - enum HttpMethod { - GET, - POST - } - /*/////////////////////////////////////////////////////////////// LOGIC //////////////////////////////////////////////////////////////*/ diff --git a/solidity/interfaces/modules/resolution/IArbitratorModule.sol b/solidity/interfaces/modules/resolution/IArbitratorModule.sol index fe78357f..74d182a2 100644 --- a/solidity/interfaces/modules/resolution/IArbitratorModule.sol +++ b/solidity/interfaces/modules/resolution/IArbitratorModule.sol @@ -29,17 +29,6 @@ interface IArbitratorModule is IResolutionModule { */ error ArbitratorModule_InvalidResolutionStatus(); - /*/////////////////////////////////////////////////////////////// - STRUCTS - //////////////////////////////////////////////////////////////*/ - /** - * @notice Parameters of the request as stored in the module - * @param arbitrator The address of the arbitrator - */ - struct RequestParameters { - address arbitrator; - } - /*/////////////////////////////////////////////////////////////// ENUMS //////////////////////////////////////////////////////////////*/ @@ -53,6 +42,17 @@ interface IArbitratorModule is IResolutionModule { Resolved // The arbitration process is resolved } + /*/////////////////////////////////////////////////////////////// + STRUCTS + //////////////////////////////////////////////////////////////*/ + /** + * @notice Parameters of the request as stored in the module + * @param arbitrator The address of the arbitrator + */ + struct RequestParameters { + address arbitrator; + } + /*/////////////////////////////////////////////////////////////// LOGIC //////////////////////////////////////////////////////////////*/ diff --git a/solidity/test/unit/extensions/AccountingExtension.t.sol b/solidity/test/unit/extensions/AccountingExtension.t.sol index c342a343..d22ef4b2 100644 --- a/solidity/test/unit/extensions/AccountingExtension.t.sol +++ b/solidity/test/unit/extensions/AccountingExtension.t.sol @@ -5,7 +5,7 @@ import 'forge-std/Test.sol'; import {Helpers} from '../../utils/Helpers.sol'; -import {Oracle, IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Oracle.sol'; +import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Oracle.sol'; import { AccountingExtension, IAccountingExtension, IERC20 } from '../../../contracts/extensions/AccountingExtension.sol'; diff --git a/solidity/test/unit/modules/dispute/RootVerificationModule.t.sol b/solidity/test/unit/modules/dispute/RootVerificationModule.t.sol index b38234e5..2c3bc89c 100644 --- a/solidity/test/unit/modules/dispute/RootVerificationModule.t.sol +++ b/solidity/test/unit/modules/dispute/RootVerificationModule.t.sol @@ -30,7 +30,7 @@ contract BaseTest is Test, Helpers { // A mock tree verifier ITreeVerifier public treeVerifier; // Mock addresses - IERC20 public _token = IERC20(makeAddr('token')); + IERC20 public token = IERC20(makeAddr('token')); // Mock request data bytes32[32] internal _treeBranches = [ @@ -162,7 +162,7 @@ contract RootVerificationModule_Unit_DisputeResponse is BaseTest { leavesToInsert: _leavesToInsert, treeVerifier: treeVerifier, accountingExtension: _accountingExtension, - bondToken: _token, + bondToken: token, bondSize: _bondSize }) ); @@ -202,7 +202,7 @@ contract RootVerificationModule_Unit_DisputeResponse is BaseTest { leavesToInsert: _leavesToInsert, treeVerifier: treeVerifier, accountingExtension: _accountingExtension, - bondToken: _token, + bondToken: token, bondSize: _bondSize }) ); @@ -258,7 +258,7 @@ contract RootVerificationModule_Unit_DisputeResponse is BaseTest { leavesToInsert: _leavesToInsert, treeVerifier: treeVerifier, accountingExtension: _accountingExtension, - bondToken: _token, + bondToken: token, bondSize: _bondSize }) ); diff --git a/solidity/test/unit/modules/resolution/BondEscalationResolutionModule.t.sol b/solidity/test/unit/modules/resolution/BondEscalationResolutionModule.t.sol index faf3fbab..1d6045a7 100644 --- a/solidity/test/unit/modules/resolution/BondEscalationResolutionModule.t.sol +++ b/solidity/test/unit/modules/resolution/BondEscalationResolutionModule.t.sol @@ -219,15 +219,15 @@ contract BondEscalationResolutionModule_Unit_StartResolution is BaseTest { } contract BondEscalationResolutionModule_Unit_PledgeForDispute is BaseTest { - uint256 _percentageDiff = 20; - uint256 _timeUntilDeadline = 1001; + uint256 internal _percentageDiff = 20; + uint256 internal _timeUntilDeadline = 1001; // block.timestamp < _inequalityData.time + _timeToBreakInequality - uint256 _timeToBreakInequality = 5000; - uint128 _startTime; + uint256 internal _timeToBreakInequality = 5000; + uint128 internal _startTime; - bytes32 _disputeId; - bytes32 _requestId; + bytes32 internal _disputeId; + bytes32 internal _requestId; function setUp() public override { super.setUp(); @@ -525,15 +525,15 @@ contract BondEscalationResolutionModule_Unit_PledgeForDispute is BaseTest { } contract BondEscalationResolutionModule_Unit_PledgeAgainstDispute is BaseTest { - uint256 _percentageDiff = 20; - uint256 _timeUntilDeadline = 1001; + uint256 internal _percentageDiff = 20; + uint256 internal _timeUntilDeadline = 1001; // block.timestamp < _inequalityData.time + _timeToBreakInequality - uint256 _timeToBreakInequality = 5000; - uint128 _startTime; + uint256 internal _timeToBreakInequality = 5000; + uint128 internal _startTime; - bytes32 _disputeId; - bytes32 _requestId; + bytes32 internal _disputeId; + bytes32 internal _requestId; function setUp() public override { super.setUp(); diff --git a/solidity/test/utils/Helpers.sol b/solidity/test/utils/Helpers.sol index 5069ae89..41bd14a5 100644 --- a/solidity/test/utils/Helpers.sol +++ b/solidity/test/utils/Helpers.sol @@ -3,9 +3,6 @@ pragma solidity ^0.8.19; import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; import {DSTestPlus} from '@defi-wonderland/solidity-utils/solidity/test/DSTestPlus.sol'; -import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; - -import {IAccountingExtension} from '../../interfaces/extensions/IAccountingExtension.sol'; import {TestConstants} from './TestConstants.sol'; contract Helpers is DSTestPlus, TestConstants {