From a73226451cbf1fe829d03b6aae653544410f1bac Mon Sep 17 00:00:00 2001 From: turtlemoji <78362532+turtlemoji@users.noreply.github.com> Date: Thu, 28 Sep 2023 15:05:04 -0700 Subject: [PATCH] refactor: lint main contracts (#212) Co-authored-by: Gas One Cent <86567384+gas1cent@users.noreply.github.com> --- .solhint.json | 1 + .solhintignore | 3 +- package.json | 2 +- solidity/contracts/Oracle.sol | 17 +++--- .../extensions/AccountingExtension.sol | 4 +- .../extensions/BondEscalationAccounting.sol | 28 ++++++++-- .../modules/dispute/BondEscalationModule.sol | 12 +++-- .../modules/dispute/BondedDisputeModule.sol | 12 +++-- .../modules/dispute/CircuitResolverModule.sol | 14 ++--- .../dispute/RootVerificationModule.sol | 15 +++--- .../modules/finality/CallbackModule.sol | 2 +- .../finality/MultipleCallbacksModule.sol | 2 +- .../request/ContractCallRequestModule.sol | 5 +- .../modules/request/HttpRequestModule.sol | 3 +- .../request/SparseMerkleTreeRequestModule.sol | 4 +- .../modules/resolution/ArbitratorModule.sol | 1 + .../BondEscalationResolutionModule.sol | 42 ++++++++++++--- .../resolution/ERC20ResolutionModule.sol | 2 + .../PrivateERC20ResolutionModule.sol | 20 +++---- .../resolution/SequentialResolutionModule.sol | 25 +++++---- .../modules/response/BondedResponseModule.sol | 4 +- solidity/interfaces/IOracle.sol | 16 +++--- .../extensions/IAccountingExtension.sol | 2 +- .../resolution/IERC20ResolutionModule.sol | 52 +++++++++---------- .../ISequentialResolutionModule.sol | 3 +- .../test/integration/RootVerification.t.sol | 5 +- solidity/test/unit/Oracle.t.sol | 48 ++++++++--------- .../modules/dispute/BondedDisputeModule.t.sol | 7 +-- .../dispute/CircuitResolverModule.t.sol | 7 +-- .../dispute/RootVerificationModule.t.sol | 9 ++-- .../request/ContractCallRequestModule.t.sol | 8 +-- .../modules/request/HttpRequestModule.t.sol | 10 ++-- .../SparseMerkleTreeRequestModule.t.sol | 8 +-- .../response/BondedResponseModule.t.sol | 9 ++-- 34 files changed, 239 insertions(+), 163 deletions(-) diff --git a/.solhint.json b/.solhint.json index 4592084..fdcc499 100644 --- a/.solhint.json +++ b/.solhint.json @@ -12,6 +12,7 @@ "const-name-snakecase": "off", "no-inline-assembly": "off", "no-empty-blocks": "off", + "func-named-parameters": ["error", 4], "private-vars-leading-underscore": ["warn", { "strict": false }], "defi-wonderland/non-state-vars-leading-underscore": ["warn"], "defi-wonderland/contract-data-order": ["warn"], diff --git a/.solhintignore b/.solhintignore index beffb38..e361980 100644 --- a/.solhintignore +++ b/.solhintignore @@ -3,4 +3,5 @@ cache out // NOTE Unrequired linting check -solidity/test/invariant/imports/WETH9.sol \ No newline at end of file +solidity/test/invariant/imports/WETH9.sol +solidity/contracts/libraries/MerkleLib.sol \ No newline at end of file diff --git a/package.json b/package.json index 039ed51..b0fcc0e 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ }, "lint-staged": { "*.{js,css,md,ts,sol}": "forge fmt", - "*.sol": "solhint --fix 'solidity/**/*.sol'", + "*.sol": "solhint --fix 'solidity/contracts/**/*.sol' 'solidity/interfaces/**/*.sol' && solhint --fix -c .solhint.tests.json 'solidity/test/**/*.sol'", "package.json": "sort-package-json" }, "dependencies": { diff --git a/solidity/contracts/Oracle.sol b/solidity/contracts/Oracle.sol index 9bb40c7..c7d312b 100644 --- a/solidity/contracts/Oracle.sol +++ b/solidity/contracts/Oracle.sol @@ -198,7 +198,8 @@ contract Oracle is IOracle { if (_responses[_responseId].proposer != _proposer) { revert Oracle_CannotTamperParticipant(); } - emit Oracle_ResponseProposed(_requestId, _proposer, _responseId); + + emit ResponseProposed(_requestId, _proposer, _responseId); } /// @inheritdoc IOracle @@ -218,7 +219,7 @@ contract Oracle is IOracle { delete _responses[_responseId]; _responseIds[_response.requestId].remove(_responseId); - emit Oracle_ResponseDeleted(_response.requestId, msg.sender, _responseId); + emit ResponseDeleted(_response.requestId, msg.sender, _responseId); } /// @inheritdoc IOracle @@ -253,7 +254,7 @@ contract Oracle is IOracle { _request.disputeModule.onDisputeStatusChange(_disputeId, _dispute); } - emit Oracle_ResponseDisputed(msg.sender, _responseId, _disputeId); + emit ResponseDisputed(msg.sender, _responseId, _disputeId); } /// @inheritdoc IOracle @@ -278,7 +279,7 @@ contract Oracle is IOracle { _request.resolutionModule.startResolution(_disputeId); } - emit Oracle_DisputeEscalated(msg.sender, _disputeId); + emit DisputeEscalated(msg.sender, _disputeId); } /// @inheritdoc IOracle @@ -298,7 +299,7 @@ contract Oracle is IOracle { _request.resolutionModule.resolveDispute(_disputeId); - emit Oracle_DisputeResolved(msg.sender, _disputeId); + emit DisputeResolved(msg.sender, _disputeId); } /// @inheritdoc IOracle @@ -311,7 +312,7 @@ contract Oracle is IOracle { _dispute.status = _status; _request.disputeModule.onDisputeStatusChange(_disputeId, _dispute); - emit Oracle_DisputeStatusUpdated(_disputeId, _status); + emit DisputeStatusUpdated(_disputeId, _status); } /// @inheritdoc IOracle @@ -405,7 +406,7 @@ contract Oracle is IOracle { _request.responseModule.finalizeRequest(_requestId, msg.sender); _request.requestModule.finalizeRequest(_requestId, msg.sender); - emit Oracle_RequestFinalized(_requestId, msg.sender); + emit OracleRequestFinalized(_requestId, msg.sender); } /** @@ -446,7 +447,7 @@ contract Oracle is IOracle { _request.finalityModule.setupRequest(_requestId, _request.finalityModuleData); } - emit Oracle_RequestCreated(_requestId, msg.sender); + emit RequestCreated(_requestId, msg.sender); } /** diff --git a/solidity/contracts/extensions/AccountingExtension.sol b/solidity/contracts/extensions/AccountingExtension.sol index 5d38879..451fdef 100644 --- a/solidity/contracts/extensions/AccountingExtension.sol +++ b/solidity/contracts/extensions/AccountingExtension.sol @@ -32,7 +32,7 @@ contract AccountingExtension is IAccountingExtension { } /** - * @notice Checks that the caller is a allowed module used in the request. + * @notice Checks that the caller is an allowed module used in the request. */ modifier onlyAllowedModule(bytes32 _requestId) { if (!ORACLE.allowedModule(_requestId, msg.sender)) revert AccountingExtension_UnauthorizedModule(); @@ -84,7 +84,7 @@ contract AccountingExtension is IAccountingExtension { bondedAmountOf[_payer][_token][_requestId] -= _amount; } - emit Paid(_requestId, _receiver, _payer, _token, _amount); + emit Paid({_requestId: _requestId, _beneficiary: _receiver, _payer: _payer, _token: _token, _amount: _amount}); } /// @inheritdoc IAccountingExtension diff --git a/solidity/contracts/extensions/BondEscalationAccounting.sol b/solidity/contracts/extensions/BondEscalationAccounting.sol index b6d3eab..aa14956 100644 --- a/solidity/contracts/extensions/BondEscalationAccounting.sol +++ b/solidity/contracts/extensions/BondEscalationAccounting.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.19; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; -import {IWETH9} from '../../interfaces/external/IWETH9.sol'; import {AccountingExtension} from './AccountingExtension.sol'; @@ -39,7 +38,7 @@ contract BondEscalationAccounting is AccountingExtension, IBondEscalationAccount balanceOf[_pledger][_token] -= _amount; } - emit Pledged(_pledger, _requestId, _disputeId, _token, _amount); + emit Pledged({_pledger: _pledger, _requestId: _requestId, _disputeId: _disputeId, _token: _token, _amount: _amount}); } /// @inheritdoc IBondEscalationAccounting @@ -68,7 +67,14 @@ contract BondEscalationAccounting is AccountingExtension, IBondEscalationAccount bondEscalationModule: IBondEscalationModule(msg.sender) }); - emit BondEscalationSettled(_requestId, _disputeId, _forVotesWon, _token, _amountPerPledger, _winningPledgersLength); + emit BondEscalationSettled({ + _requestId: _requestId, + _disputeId: _disputeId, + _forVotesWon: _forVotesWon, + _token: _token, + _amountPerPledger: _amountPerPledger, + _winningPledgersLength: _winningPledgersLength + }); } /// @inheritdoc IBondEscalationAccounting @@ -93,7 +99,13 @@ contract BondEscalationAccounting is AccountingExtension, IBondEscalationAccount pledges[_disputeId][_token] -= _claimAmount; } - emit EscalationRewardClaimed(_requestId, _disputeId, _pledger, _result.token, _claimAmount); + emit EscalationRewardClaimed({ + _requestId: _requestId, + _disputeId: _disputeId, + _pledger: _pledger, + _token: _result.token, + _amount: _claimAmount + }); } /// @inheritdoc IBondEscalationAccounting @@ -112,6 +124,12 @@ contract BondEscalationAccounting is AccountingExtension, IBondEscalationAccount pledges[_disputeId][_token] -= _amount; } - emit PledgeReleased(_requestId, _disputeId, _pledger, _token, _amount); + emit PledgeReleased({ + _requestId: _requestId, + _disputeId: _disputeId, + _pledger: _pledger, + _token: _token, + _amount: _amount + }); } } diff --git a/solidity/contracts/modules/dispute/BondEscalationModule.sol b/solidity/contracts/modules/dispute/BondEscalationModule.sol index 9b05c0e..4ba1da9 100644 --- a/solidity/contracts/modules/dispute/BondEscalationModule.sol +++ b/solidity/contracts/modules/dispute/BondEscalationModule.sol @@ -4,6 +4,8 @@ pragma solidity ^0.8.19; import {FixedPointMathLib} from 'solmate/utils/FixedPointMathLib.sol'; import {IBondEscalationModule} from '../../../interfaces/modules/dispute/IBondEscalationModule.sol'; import {IOracle} from '../../../interfaces/IOracle.sol'; + +// solhint-disable-next-line no-unused-import import {Module, IModule} from '../../Module.sol'; contract BondEscalationModule is Module, IBondEscalationModule { @@ -153,9 +155,13 @@ contract BondEscalationModule is Module, IBondEscalationModule { _winningPledgersLength: _won ? _escalation.amountOfPledgesForDispute : _escalation.amountOfPledgesAgainstDispute }); } - emit DisputeStatusChanged( - _dispute.requestId, _dispute.responseId, _dispute.disputer, _dispute.proposer, _dispute.status - ); + emit DisputeStatusChanged({ + _requestId: _dispute.requestId, + _responseId: _dispute.responseId, + _disputer: _dispute.disputer, + _proposer: _dispute.proposer, + _status: _dispute.status + }); } //////////////////////////////////////////////////////////////////// diff --git a/solidity/contracts/modules/dispute/BondedDisputeModule.sol b/solidity/contracts/modules/dispute/BondedDisputeModule.sol index ce9f4cb..3196a01 100644 --- a/solidity/contracts/modules/dispute/BondedDisputeModule.sol +++ b/solidity/contracts/modules/dispute/BondedDisputeModule.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IBondedDisputeModule} from '../../../interfaces/modules/dispute/IBondedDisputeModule.sol'; import {IOracle} from '../../../interfaces/IOracle.sol'; -import {IAccountingExtension} from '../../../interfaces/extensions/IAccountingExtension.sol'; + +// solhint-disable-next-line no-unused-import import {Module, IModule} from '../../Module.sol'; contract BondedDisputeModule is Module, IBondedDisputeModule { @@ -104,6 +104,12 @@ contract BondedDisputeModule is Module, IBondedDisputeModule { }); } - emit DisputeStatusChanged(_dispute.requestId, _dispute.responseId, _disputer, _proposer, _status); + emit DisputeStatusChanged({ + _requestId: _dispute.requestId, + _responseId: _dispute.responseId, + _disputer: _disputer, + _proposer: _proposer, + _status: _status + }); } } diff --git a/solidity/contracts/modules/dispute/CircuitResolverModule.sol b/solidity/contracts/modules/dispute/CircuitResolverModule.sol index f050305..5be6fb1 100644 --- a/solidity/contracts/modules/dispute/CircuitResolverModule.sol +++ b/solidity/contracts/modules/dispute/CircuitResolverModule.sol @@ -1,12 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; - import {ICircuitResolverModule} from '../../../interfaces/modules/dispute/ICircuitResolverModule.sol'; import {IOracle} from '../../../interfaces/IOracle.sol'; -import {IAccountingExtension} from '../../../interfaces/extensions/IAccountingExtension.sol'; +// solhint-disable-next-line no-unused-import import {Module, IModule} from '../../Module.sol'; contract CircuitResolverModule is Module, ICircuitResolverModule { @@ -54,9 +52,13 @@ contract CircuitResolverModule is Module, ICircuitResolverModule { delete _correctResponses[_dispute.requestId]; - emit DisputeStatusChanged( - _dispute.requestId, _dispute.responseId, _dispute.disputer, _dispute.proposer, _dispute.status - ); + emit DisputeStatusChanged({ + _requestId: _dispute.requestId, + _responseId: _dispute.responseId, + _disputer: _dispute.disputer, + _proposer: _dispute.proposer, + _status: _dispute.status + }); } /// @inheritdoc ICircuitResolverModule diff --git a/solidity/contracts/modules/dispute/RootVerificationModule.sol b/solidity/contracts/modules/dispute/RootVerificationModule.sol index 77cb3f4..3694d42 100644 --- a/solidity/contracts/modules/dispute/RootVerificationModule.sol +++ b/solidity/contracts/modules/dispute/RootVerificationModule.sol @@ -1,15 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; - import {MerkleLib} from '../../libraries/MerkleLib.sol'; import {IRootVerificationModule} from '../../../interfaces/modules/dispute/IRootVerificationModule.sol'; import {IOracle} from '../../../interfaces/IOracle.sol'; -import {ITreeVerifier} from '../../../interfaces/ITreeVerifier.sol'; -import {IAccountingExtension} from '../../../interfaces/extensions/IAccountingExtension.sol'; +// solhint-disable-next-line no-unused-import import {Module, IModule} from '../../Module.sol'; contract RootVerificationModule is Module, IRootVerificationModule { @@ -60,9 +57,13 @@ contract RootVerificationModule is Module, IRootVerificationModule { delete _correctRoots[_dispute.requestId]; - emit DisputeStatusChanged( - _dispute.requestId, _dispute.responseId, _dispute.disputer, _dispute.proposer, _dispute.status - ); + emit DisputeStatusChanged({ + _requestId: _dispute.requestId, + _responseId: _dispute.responseId, + _disputer: _dispute.disputer, + _proposer: _dispute.proposer, + _status: _dispute.status + }); } /// @inheritdoc IRootVerificationModule diff --git a/solidity/contracts/modules/finality/CallbackModule.sol b/solidity/contracts/modules/finality/CallbackModule.sol index 6862ee2..c199e53 100644 --- a/solidity/contracts/modules/finality/CallbackModule.sol +++ b/solidity/contracts/modules/finality/CallbackModule.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.19; import {IOracle} from '../../../interfaces/IOracle.sol'; import {ICallbackModule} from '../../../interfaces/modules/finality/ICallbackModule.sol'; +// solhint-disable-next-line no-unused-import import {Module, IModule} from '../../Module.sol'; contract CallbackModule is Module, ICallbackModule { @@ -33,7 +34,6 @@ contract CallbackModule is Module, ICallbackModule { address _finalizer ) external override(Module, ICallbackModule) onlyOracle { RequestParameters memory _params = decodeRequestData(_requestId); - // solhint-disable-next-line _params.target.call(_params.data); emit Callback(_requestId, _params.target, _params.data); emit RequestFinalized(_requestId, _finalizer); diff --git a/solidity/contracts/modules/finality/MultipleCallbacksModule.sol b/solidity/contracts/modules/finality/MultipleCallbacksModule.sol index cd26422..05fb89d 100644 --- a/solidity/contracts/modules/finality/MultipleCallbacksModule.sol +++ b/solidity/contracts/modules/finality/MultipleCallbacksModule.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.19; import {IOracle} from '../../../interfaces/IOracle.sol'; import {IMultipleCallbacksModule} from '../../../interfaces/modules/finality/IMultipleCallbacksModule.sol'; +// solhint-disable-next-line no-unused-import import {Module, IModule} from '../../Module.sol'; contract MultipleCallbacksModule is Module, IMultipleCallbacksModule { @@ -44,7 +45,6 @@ contract MultipleCallbacksModule is Module, IMultipleCallbacksModule { uint256 _length = _params.targets.length; for (uint256 _i; _i < _length;) { - // solhint-disable-next-line _params.targets[_i].call(_params.data[_i]); emit Callback(_requestId, _params.targets[_i], _params.data[_i]); unchecked { diff --git a/solidity/contracts/modules/request/ContractCallRequestModule.sol b/solidity/contracts/modules/request/ContractCallRequestModule.sol index b655d34..49ac6cd 100644 --- a/solidity/contracts/modules/request/ContractCallRequestModule.sol +++ b/solidity/contracts/modules/request/ContractCallRequestModule.sol @@ -1,11 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; - import {IContractCallRequestModule} from '../../../interfaces/modules/request/IContractCallRequestModule.sol'; -import {IAccountingExtension} from '../../../interfaces/extensions/IAccountingExtension.sol'; import {IOracle} from '../../../interfaces/IOracle.sol'; + +// solhint-disable-next-line no-unused-import import {Module, IModule} from '../../Module.sol'; contract ContractCallRequestModule is Module, IContractCallRequestModule { diff --git a/solidity/contracts/modules/request/HttpRequestModule.sol b/solidity/contracts/modules/request/HttpRequestModule.sol index c965080..a8e69fa 100644 --- a/solidity/contracts/modules/request/HttpRequestModule.sol +++ b/solidity/contracts/modules/request/HttpRequestModule.sol @@ -1,10 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IHttpRequestModule} from '../../../interfaces/modules/request/IHttpRequestModule.sol'; -import {IAccountingExtension} from '../../../interfaces/extensions/IAccountingExtension.sol'; import {IOracle} from '../../../interfaces/IOracle.sol'; +// solhint-disable-next-line no-unused-import import {Module, IModule} from '../../Module.sol'; contract HttpRequestModule is Module, IHttpRequestModule { diff --git a/solidity/contracts/modules/request/SparseMerkleTreeRequestModule.sol b/solidity/contracts/modules/request/SparseMerkleTreeRequestModule.sol index e4a4ba0..148a4b4 100644 --- a/solidity/contracts/modules/request/SparseMerkleTreeRequestModule.sol +++ b/solidity/contracts/modules/request/SparseMerkleTreeRequestModule.sol @@ -1,11 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; - import {ISparseMerkleTreeRequestModule} from '../../../interfaces/modules/request/ISparseMerkleTreeRequestModule.sol'; -import {IAccountingExtension} from '../../../interfaces/extensions/IAccountingExtension.sol'; import {IOracle} from '../../../interfaces/IOracle.sol'; +// solhint-disable-next-line no-unused-import import {Module, IModule} from '../../Module.sol'; contract SparseMerkleTreeRequestModule is Module, ISparseMerkleTreeRequestModule { diff --git a/solidity/contracts/modules/resolution/ArbitratorModule.sol b/solidity/contracts/modules/resolution/ArbitratorModule.sol index 6bc1eb5..61acbb4 100644 --- a/solidity/contracts/modules/resolution/ArbitratorModule.sol +++ b/solidity/contracts/modules/resolution/ArbitratorModule.sol @@ -5,6 +5,7 @@ import {IArbitratorModule} from '../../../interfaces/modules/resolution/IArbitra import {IOracle} from '../../../interfaces/IOracle.sol'; import {IArbitrator, IOracle} from '../../../interfaces/IArbitrator.sol'; +// solhint-disable-next-line no-unused-import import {Module, IModule} from '../../Module.sol'; contract ArbitratorModule is Module, IArbitratorModule { diff --git a/solidity/contracts/modules/resolution/BondEscalationResolutionModule.sol b/solidity/contracts/modules/resolution/BondEscalationResolutionModule.sol index 8aa505c..329a057 100644 --- a/solidity/contracts/modules/resolution/BondEscalationResolutionModule.sol +++ b/solidity/contracts/modules/resolution/BondEscalationResolutionModule.sol @@ -1,17 +1,19 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; +// solhint-disable-next-line no-unused-import import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import {FixedPointMathLib} from 'solmate/utils/FixedPointMathLib.sol'; -import { - IBondEscalationResolutionModule, - IResolutionModule -} from '../../../interfaces/modules/resolution/IBondEscalationResolutionModule.sol'; import {IOracle} from '../../../interfaces/IOracle.sol'; +import {IBondEscalationResolutionModule} from + '../../../interfaces/modules/resolution/IBondEscalationResolutionModule.sol'; +// solhint-disable no-unused-import +import {IResolutionModule} from '../../../interfaces/modules/resolution/IResolutionModule.sol'; import {Module, IModule} from '../../Module.sol'; +// solhint-enable no-unused-import contract BondEscalationResolutionModule is Module, IBondEscalationResolutionModule { using SafeERC20 for IERC20; @@ -246,7 +248,13 @@ contract BondEscalationResolutionModule is Module, IBondEscalationResolutionModu _token: _params.bondToken, _amount: _amountToRelease }); - emit PledgeClaimedDisputerWon(_requestId, _disputeId, msg.sender, _params.bondToken, _amountToRelease); + emit PledgeClaimedDisputerWon({ + _requestId: _requestId, + _disputeId: _disputeId, + _pledger: msg.sender, + _token: _params.bondToken, + _pledgeReleased: _amountToRelease + }); } else if (_escalation.resolution == Resolution.DisputerLost) { _pledgerBalanceBefore = pledgesAgainstDispute[_disputeId][msg.sender]; pledgesAgainstDispute[_disputeId][msg.sender] -= _pledgerBalanceBefore; @@ -261,7 +269,13 @@ contract BondEscalationResolutionModule is Module, IBondEscalationResolutionModu _token: _params.bondToken, _amount: _amountToRelease }); - emit PledgeClaimedDisputerLost(_requestId, _disputeId, msg.sender, _params.bondToken, _amountToRelease); + emit PledgeClaimedDisputerLost({ + _requestId: _requestId, + _disputeId: _disputeId, + _pledger: msg.sender, + _token: _params.bondToken, + _pledgeReleased: _amountToRelease + }); } else if (_escalation.resolution == Resolution.NoResolution) { uint256 _pledgerBalanceFor = pledgesForDispute[_disputeId][msg.sender]; uint256 _pledgerBalanceAgainst = pledgesAgainstDispute[_disputeId][msg.sender]; @@ -275,7 +289,13 @@ contract BondEscalationResolutionModule is Module, IBondEscalationResolutionModu _token: _params.bondToken, _amount: _pledgerBalanceFor }); - emit PledgeClaimedNoResolution(_requestId, _disputeId, msg.sender, _params.bondToken, _pledgerBalanceFor); + emit PledgeClaimedNoResolution({ + _requestId: _requestId, + _disputeId: _disputeId, + _pledger: msg.sender, + _token: _params.bondToken, + _pledgeReleased: _pledgerBalanceFor + }); } if (_pledgerBalanceAgainst > 0) { @@ -287,7 +307,13 @@ contract BondEscalationResolutionModule is Module, IBondEscalationResolutionModu _token: _params.bondToken, _amount: _pledgerBalanceAgainst }); - emit PledgeClaimedNoResolution(_requestId, _disputeId, msg.sender, _params.bondToken, _pledgerBalanceAgainst); + emit PledgeClaimedNoResolution({ + _requestId: _requestId, + _disputeId: _disputeId, + _pledger: msg.sender, + _token: _params.bondToken, + _pledgeReleased: _pledgerBalanceAgainst + }); } } } diff --git a/solidity/contracts/modules/resolution/ERC20ResolutionModule.sol b/solidity/contracts/modules/resolution/ERC20ResolutionModule.sol index d75cbe6..2589b34 100644 --- a/solidity/contracts/modules/resolution/ERC20ResolutionModule.sol +++ b/solidity/contracts/modules/resolution/ERC20ResolutionModule.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; +// solhint-disable-next-line no-unused-import import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IERC20ResolutionModule} from '../../../interfaces/modules/resolution/IERC20ResolutionModule.sol'; @@ -8,6 +9,7 @@ import {IOracle} from '../../../interfaces/IOracle.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; +// solhint-disable-next-line no-unused-import import {Module, IModule} from '../../Module.sol'; contract ERC20ResolutionModule is Module, IERC20ResolutionModule { diff --git a/solidity/contracts/modules/resolution/PrivateERC20ResolutionModule.sol b/solidity/contracts/modules/resolution/PrivateERC20ResolutionModule.sol index 6ac9942..f68517a 100644 --- a/solidity/contracts/modules/resolution/PrivateERC20ResolutionModule.sol +++ b/solidity/contracts/modules/resolution/PrivateERC20ResolutionModule.sol @@ -1,12 +1,14 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; +// solhint-disable-next-line no-unused-import import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IPrivateERC20ResolutionModule} from '../../../interfaces/modules/resolution/IPrivateERC20ResolutionModule.sol'; import {IOracle} from '../../../interfaces/IOracle.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; +// solhint-disable-next-line no-unused-import import {Module, IModule} from '../../Module.sol'; contract PrivateERC20ResolutionModule is Module, IPrivateERC20ResolutionModule { @@ -63,13 +65,13 @@ contract PrivateERC20ResolutionModule is Module, IPrivateERC20ResolutionModule { /// @inheritdoc IPrivateERC20ResolutionModule function revealVote(bytes32 _requestId, bytes32 _disputeId, uint256 _numberOfVotes, bytes32 _salt) public { - Escalation memory escalation = escalations[_disputeId]; - if (escalation.startTime == 0) revert PrivateERC20ResolutionModule_DisputeNotEscalated(); + Escalation memory _escalation = escalations[_disputeId]; + if (_escalation.startTime == 0) revert PrivateERC20ResolutionModule_DisputeNotEscalated(); RequestParameters memory _params = decodeRequestData(_requestId); (uint256 _revealStartTime, uint256 _revealEndTime) = ( - escalation.startTime + _params.committingTimeWindow, - escalation.startTime + _params.committingTimeWindow + _params.revealingTimeWindow + _escalation.startTime + _params.committingTimeWindow, + _escalation.startTime + _params.committingTimeWindow + _params.revealingTimeWindow ); if (block.timestamp <= _revealStartTime) revert PrivateERC20ResolutionModule_OnGoingCommittingPhase(); if (block.timestamp > _revealEndTime) revert PrivateERC20ResolutionModule_RevealingPhaseOver(); @@ -96,19 +98,19 @@ contract PrivateERC20ResolutionModule is Module, IPrivateERC20ResolutionModule { if (_dispute.createdAt == 0) revert PrivateERC20ResolutionModule_NonExistentDispute(); if (_dispute.status != IOracle.DisputeStatus.None) revert PrivateERC20ResolutionModule_AlreadyResolved(); - Escalation memory escalation = escalations[_disputeId]; - if (escalation.startTime == 0) revert PrivateERC20ResolutionModule_DisputeNotEscalated(); + Escalation memory _escalation = escalations[_disputeId]; + if (_escalation.startTime == 0) revert PrivateERC20ResolutionModule_DisputeNotEscalated(); RequestParameters memory _params = decodeRequestData(_dispute.requestId); - if (block.timestamp < escalation.startTime + _params.committingTimeWindow) { + if (block.timestamp < _escalation.startTime + _params.committingTimeWindow) { revert PrivateERC20ResolutionModule_OnGoingCommittingPhase(); } - if (block.timestamp < escalation.startTime + _params.committingTimeWindow + _params.revealingTimeWindow) { + if (block.timestamp < _escalation.startTime + _params.committingTimeWindow + _params.revealingTimeWindow) { revert PrivateERC20ResolutionModule_OnGoingRevealingPhase(); } - uint256 _quorumReached = escalation.totalVotes >= _params.minVotesForQuorum ? 1 : 0; + uint256 _quorumReached = _escalation.totalVotes >= _params.minVotesForQuorum ? 1 : 0; address[] memory __voters = _voters[_disputeId].values(); diff --git a/solidity/contracts/modules/resolution/SequentialResolutionModule.sol b/solidity/contracts/modules/resolution/SequentialResolutionModule.sol index 386d1f5..fc066e6 100644 --- a/solidity/contracts/modules/resolution/SequentialResolutionModule.sol +++ b/solidity/contracts/modules/resolution/SequentialResolutionModule.sol @@ -33,6 +33,9 @@ contract SequentialResolutionModule is Module, ISequentialResolutionModule { constructor(IOracle _oracle) Module(_oracle) {} + /** + * @notice Checks that the caller is a valid sub-module + */ modifier onlySubmodule(bytes32 _requestId) { if (!_resolutionModules[_getSequenceId(_requestId)].contains(msg.sender)) { revert SequentialResolutionModule_OnlySubmodule(); @@ -44,10 +47,10 @@ contract SequentialResolutionModule is Module, ISequentialResolutionModule { function addResolutionModuleSequence(IResolutionModule[] memory _modules) external returns (uint256 _sequenceId) { _sequenceId = ++currentSequenceId; EnumerableSet.AddressSet storage _setModules = _resolutionModules[_sequenceId]; - for (uint256 i; i < _modules.length; ++i) { - _setModules.add(address(_modules[i])); + for (uint256 _i; _i < _modules.length; ++_i) { + _setModules.add(address(_modules[_i])); } - emit SequentialResolutionModule_ResolutionSequenceAdded(_sequenceId, _modules); + emit ResolutionSequenceAdded(_sequenceId, _modules); } /// @inheritdoc ISequentialResolutionModule @@ -67,8 +70,8 @@ contract SequentialResolutionModule is Module, ISequentialResolutionModule { uint256 _length = _modules.length(); uint256 _count = (_batchSize > _length - _startFrom) ? _length - _startFrom : _batchSize; _list = new IResolutionModule[](_count); - for (uint256 i; i < _count; ++i) { - _list[i] = IResolutionModule(_modules.at(_startFrom + i)); + for (uint256 _i; _i < _count; ++_i) { + _list[_i] = IResolutionModule(_modules.at(_startFrom + _i)); } } @@ -88,8 +91,8 @@ contract SequentialResolutionModule is Module, ISequentialResolutionModule { address _finalizer ) external virtual override(Module, IModule) onlyOracle { EnumerableSet.AddressSet storage _modules = _resolutionModules[_getSequenceId(_requestId)]; - for (uint256 i; i < _modules.length(); ++i) { - IResolutionModule(_modules.at(i)).finalizeRequest(_requestId, _finalizer); + for (uint256 _i; _i < _modules.length(); ++_i) { + IResolutionModule(_modules.at(_i)).finalizeRequest(_requestId, _finalizer); } } @@ -127,8 +130,8 @@ contract SequentialResolutionModule is Module, ISequentialResolutionModule { function _afterSetupRequest(bytes32 _requestId, bytes calldata _data) internal override { RequestParameters memory _params = _decodeData(_data); EnumerableSet.AddressSet storage _modules = _resolutionModules[_params.sequenceId]; - for (uint256 i; i < _modules.length(); ++i) { - IResolutionModule(_modules.at(i)).setupRequest(_requestId, _params.submoduleData[i]); + for (uint256 _i; _i < _modules.length(); ++_i) { + IResolutionModule(_modules.at(_i)).setupRequest(_requestId, _params.submoduleData[_i]); } } @@ -246,6 +249,8 @@ contract SequentialResolutionModule is Module, ISequentialResolutionModule { // ============ ORACLE Proxy not implemented ============= + // solhint-disable defi-wonderland/named-return-values + // This functions use msg.sender in the oracle implementation and cannot be called from a the sequential resolution module /// @inheritdoc IOracle function createRequest(IOracle.NewRequest memory) external pure returns (bytes32) { @@ -276,4 +281,6 @@ contract SequentialResolutionModule is Module, ISequentialResolutionModule { function deleteResponse(bytes32) external pure { revert SequentialResolutionModule_NotImplemented(); } + + // solhint-enable defi-wonderland/named-return-values } diff --git a/solidity/contracts/modules/response/BondedResponseModule.sol b/solidity/contracts/modules/response/BondedResponseModule.sol index d4aa7d5..b54e8f4 100644 --- a/solidity/contracts/modules/response/BondedResponseModule.sol +++ b/solidity/contracts/modules/response/BondedResponseModule.sol @@ -1,11 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; - import {IOracle} from '../../../interfaces/IOracle.sol'; import {IBondedResponseModule} from '../../../interfaces/modules/response/IBondedResponseModule.sol'; -import {IAccountingExtension} from '../../../interfaces/extensions/IAccountingExtension.sol'; +// solhint-disable-next-line no-unused-import import {Module, IModule} from '../../Module.sol'; contract BondedResponseModule is Module, IBondedResponseModule { diff --git a/solidity/interfaces/IOracle.sol b/solidity/interfaces/IOracle.sol index 8aa348b..77caaa0 100644 --- a/solidity/interfaces/IOracle.sol +++ b/solidity/interfaces/IOracle.sol @@ -21,7 +21,7 @@ interface IOracle { * @param _requestId The id of the created request * @param _requester The address of the user who created the request */ - event Oracle_RequestCreated(bytes32 indexed _requestId, address indexed _requester); + event RequestCreated(bytes32 indexed _requestId, address indexed _requester); /** * @notice Emitted when a response is proposed @@ -29,7 +29,7 @@ interface IOracle { * @param _proposer The address of the user who proposed the response * @param _responseId The id of the proposed response */ - event Oracle_ResponseProposed(bytes32 indexed _requestId, address indexed _proposer, bytes32 indexed _responseId); + event ResponseProposed(bytes32 indexed _requestId, address indexed _proposer, bytes32 indexed _responseId); /** * @notice Emitted when a response is disputed @@ -37,35 +37,35 @@ interface IOracle { * @param _responseId The id of the response being disputed * @param _disputeId The id of the dispute */ - event Oracle_ResponseDisputed(address indexed _disputer, bytes32 indexed _responseId, bytes32 indexed _disputeId); + event ResponseDisputed(address indexed _disputer, bytes32 indexed _responseId, bytes32 indexed _disputeId); /** * @notice Emitted when a request is finalized * @param _requestId The id of the request being finalized * @param _caller The address of the user who finalized the request */ - event Oracle_RequestFinalized(bytes32 indexed _requestId, address indexed _caller); + event OracleRequestFinalized(bytes32 indexed _requestId, address indexed _caller); /** * @notice Emitted when a dispute is escalated * @param _caller The address of the user who escalated the dispute * @param _disputeId The id of the dispute being escalated */ - event Oracle_DisputeEscalated(address indexed _caller, bytes32 indexed _disputeId); + event DisputeEscalated(address indexed _caller, bytes32 indexed _disputeId); /** * @notice Emitted when a dispute's status changes * @param _disputeId The id of the dispute * @param _status The new dispute status */ - event Oracle_DisputeStatusUpdated(bytes32 indexed _disputeId, DisputeStatus _status); + event DisputeStatusUpdated(bytes32 indexed _disputeId, DisputeStatus _status); /** * @notice Emitted when a dispute is resolved * @param _caller The address of the user who resolved the dispute * @param _disputeId The id of the dispute being resolved */ - event Oracle_DisputeResolved(address indexed _caller, bytes32 indexed _disputeId); + event DisputeResolved(address indexed _caller, bytes32 indexed _disputeId); /** * @notice Emitted when a response is deleted @@ -73,7 +73,7 @@ interface IOracle { * @param _caller The address of the user who deleted the response * @param _responseId The id of the deleted response */ - event Oracle_ResponseDeleted(bytes32 indexed _requestId, address indexed _caller, bytes32 indexed _responseId); + event ResponseDeleted(bytes32 indexed _requestId, address indexed _caller, bytes32 indexed _responseId); /*/////////////////////////////////////////////////////////////// ERRORS diff --git a/solidity/interfaces/extensions/IAccountingExtension.sol b/solidity/interfaces/extensions/IAccountingExtension.sol index cc5a24e..ae9bc07 100644 --- a/solidity/interfaces/extensions/IAccountingExtension.sol +++ b/solidity/interfaces/extensions/IAccountingExtension.sol @@ -91,7 +91,7 @@ interface IAccountingExtension { /** * @notice Returns the interface for the Oracle contract */ - function ORACLE() external view returns (IOracle); + function ORACLE() external view returns (IOracle _oracle); /** * @notice Returns the amount of a token a user has bonded diff --git a/solidity/interfaces/modules/resolution/IERC20ResolutionModule.sol b/solidity/interfaces/modules/resolution/IERC20ResolutionModule.sol index f913c8d..7ba3ba2 100644 --- a/solidity/interfaces/modules/resolution/IERC20ResolutionModule.sol +++ b/solidity/interfaces/modules/resolution/IERC20ResolutionModule.sol @@ -13,32 +13,6 @@ import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; * dispute, the dispute is resolved in favor of the dispute. Otherwise, the dispute is resolved against the dispute. */ interface IERC20ResolutionModule is IResolutionModule { - /*/////////////////////////////////////////////////////////////// - STRUCTS - //////////////////////////////////////////////////////////////*/ - - /** - * @notice Parameters of the request as stored in the module - * @param votingToken The token used to vote - * @param minVotesForQuorum The minimum amount of votes to win the dispute - * @param timeUntilDeadline The time until the voting phase ends - */ - struct RequestParameters { - IERC20 votingToken; - uint256 minVotesForQuorum; - uint256 timeUntilDeadline; - } - - /** - * @notice Escalation data for a dispute - * @param startTime The timestamp at which the dispute was escalated - * @param totalVotes The total amount of votes cast for the dispute - */ - struct Escalation { - uint256 startTime; - uint256 totalVotes; - } - /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ @@ -97,6 +71,32 @@ interface IERC20ResolutionModule is IResolutionModule { */ error ERC20ResolutionModule_AlreadyResolved(); + /*/////////////////////////////////////////////////////////////// + STRUCTS + //////////////////////////////////////////////////////////////*/ + + /** + * @notice Parameters of the request as stored in the module + * @param votingToken The token used to vote + * @param minVotesForQuorum The minimum amount of votes to win the dispute + * @param timeUntilDeadline The time until the voting phase ends + */ + struct RequestParameters { + IERC20 votingToken; + uint256 minVotesForQuorum; + uint256 timeUntilDeadline; + } + + /** + * @notice Escalation data for a dispute + * @param startTime The timestamp at which the dispute was escalated + * @param totalVotes The total amount of votes cast for the dispute + */ + struct Escalation { + uint256 startTime; + uint256 totalVotes; + } + /*/////////////////////////////////////////////////////////////// LOGIC //////////////////////////////////////////////////////////////*/ diff --git a/solidity/interfaces/modules/resolution/ISequentialResolutionModule.sol b/solidity/interfaces/modules/resolution/ISequentialResolutionModule.sol index 308059b..4ea0492 100644 --- a/solidity/interfaces/modules/resolution/ISequentialResolutionModule.sol +++ b/solidity/interfaces/modules/resolution/ISequentialResolutionModule.sol @@ -3,7 +3,6 @@ pragma solidity ^0.8.19; import {IOracle} from '../../IOracle.sol'; import {IResolutionModule} from './IResolutionModule.sol'; -import {IModule} from '../../IModule.sol'; interface ISequentialResolutionModule is IOracle, IResolutionModule { /*/////////////////////////////////////////////////////////////// @@ -13,7 +12,7 @@ interface ISequentialResolutionModule is IOracle, IResolutionModule { /** * @notice Emitted when a new resolution sequence is added */ - event SequentialResolutionModule_ResolutionSequenceAdded(uint256 _sequenceId, IResolutionModule[] _modules); + event ResolutionSequenceAdded(uint256 _sequenceId, IResolutionModule[] _modules); /*/////////////////////////////////////////////////////////////// ERRORS diff --git a/solidity/test/integration/RootVerification.t.sol b/solidity/test/integration/RootVerification.t.sol index 9b05b5b..dc1add9 100644 --- a/solidity/test/integration/RootVerification.t.sol +++ b/solidity/test/integration/RootVerification.t.sol @@ -1,12 +1,13 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; +import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; + import './IntegrationBase.sol'; import { SparseMerkleTreeRequestModule, ISparseMerkleTreeRequestModule, - IOracle, - IERC20 + IOracle } from '../../contracts/modules/request/SparseMerkleTreeRequestModule.sol'; import {SparseMerkleTreeL32Verifier} from '../../contracts/periphery/SparseMerkleTreeL32Verifier.sol'; import { diff --git a/solidity/test/unit/Oracle.t.sol b/solidity/test/unit/Oracle.t.sol index 575f09c..49256f0 100644 --- a/solidity/test/unit/Oracle.t.sol +++ b/solidity/test/unit/Oracle.t.sol @@ -68,14 +68,14 @@ contract Oracle_UnitTest is Test { // 100% random sequence of bytes representing request, response, or dispute id bytes32 public mockId = bytes32('69'); - event Oracle_RequestCreated(bytes32 indexed _requestId, address indexed _requester); - event Oracle_ResponseProposed(bytes32 indexed _requestId, address indexed _proposer, bytes32 indexed _responseId); - event Oracle_ResponseDisputed(address indexed _disputer, bytes32 indexed _responseId, bytes32 indexed _disputeId); - event Oracle_RequestFinalized(bytes32 indexed _requestId, address indexed _caller); - event Oracle_DisputeEscalated(address indexed _caller, bytes32 indexed _disputeId); - event Oracle_DisputeStatusUpdated(bytes32 indexed _disputeId, IOracle.DisputeStatus _newStatus); - event Oracle_DisputeResolved(address indexed _caller, bytes32 indexed _disputeId); - event Oracle_ResponseDeleted(bytes32 indexed _requestId, address indexed _caller, bytes32 indexed _responseId); + event RequestCreated(bytes32 indexed _requestId, address indexed _requester); + event ResponseProposed(bytes32 indexed _requestId, address indexed _proposer, bytes32 indexed _responseId); + event ResponseDisputed(address indexed _disputer, bytes32 indexed _responseId, bytes32 indexed _disputeId); + event OracleRequestFinalized(bytes32 indexed _requestId, address indexed _caller); + event DisputeEscalated(address indexed _caller, bytes32 indexed _disputeId); + event DisputeStatusUpdated(bytes32 indexed _disputeId, IOracle.DisputeStatus _newStatus); + event DisputeResolved(address indexed _caller, bytes32 indexed _disputeId); + event ResponseDeleted(bytes32 indexed _requestId, address indexed _caller, bytes32 indexed _responseId); /** * @notice Deploy the target and mock oracle+modules @@ -190,7 +190,7 @@ contract Oracle_UnitTest is Test { // Check: emits RequestCreated event? vm.expectEmit(true, true, true, true); - emit Oracle_RequestCreated(_theoricRequestId, sender); + emit RequestCreated(_theoricRequestId, sender); // Test: create the request vm.prank(sender); @@ -317,7 +317,7 @@ contract Oracle_UnitTest is Test { // Check: emits RequestCreated event? vm.expectEmit(true, true, true, true); - emit Oracle_RequestCreated(_theoricRequestId, sender); + emit RequestCreated(_theoricRequestId, sender); } vm.prank(sender); @@ -492,7 +492,7 @@ contract Oracle_UnitTest is Test { // Check: emits ResponseProposed event? vm.expectEmit(true, true, true, true); - emit Oracle_ResponseProposed(_requestId, sender, _responseId); + emit ResponseProposed(_requestId, sender, _responseId); // Test: propose the response vm.prank(sender); @@ -500,7 +500,7 @@ contract Oracle_UnitTest is Test { // Check: emits ResponseProposed event? vm.expectEmit(true, true, true, true); - emit Oracle_ResponseProposed( + emit ResponseProposed( _requestId, sender, keccak256(abi.encodePacked(sender, address(oracle), _requestId, _responseNonce + 1)) ); @@ -590,7 +590,7 @@ contract Oracle_UnitTest is Test { // Check: emits ResponseProposed event? vm.expectEmit(true, true, true, true); - emit Oracle_ResponseProposed(_requestId, _proposer, _responseId); + emit ResponseProposed(_requestId, _proposer, _responseId); // Test: propose the response vm.prank(address(disputeModule)); @@ -598,7 +598,7 @@ contract Oracle_UnitTest is Test { // Check: emits ResponseProposed event? vm.expectEmit(true, true, true, true); - emit Oracle_ResponseProposed( + emit ResponseProposed( _requestId, _proposer, keccak256(abi.encodePacked(_proposer, address(oracle), _requestId, _responseNonce + 1)) ); @@ -668,7 +668,7 @@ contract Oracle_UnitTest is Test { // Check: is event emitted? vm.expectEmit(true, true, true, true); - emit Oracle_ResponseDeleted(_requestId, sender, _responseId); + emit ResponseDeleted(_requestId, sender, _responseId); vm.prank(sender); oracle.deleteResponse(_responseId); @@ -790,7 +790,7 @@ contract Oracle_UnitTest is Test { // Check: emits ResponseDisputed event? vm.expectEmit(true, true, true, true); - emit Oracle_ResponseDisputed(sender, _responseId, _disputeId); + emit ResponseDisputed(sender, _responseId, _disputeId); // Test: dispute the response vm.prank(sender); @@ -869,7 +869,7 @@ contract Oracle_UnitTest is Test { // Check: emits DisputeStatusUpdated event? vm.expectEmit(true, true, true, true); - emit Oracle_DisputeStatusUpdated(_disputeId, IOracle.DisputeStatus(_newStatus)); + emit DisputeStatusUpdated(_disputeId, IOracle.DisputeStatus(_newStatus)); // Test: change the status vm.prank(address(resolutionModule)); @@ -901,7 +901,7 @@ contract Oracle_UnitTest is Test { // Check: emits DisputeResolved event? vm.expectEmit(true, true, true, true); - emit Oracle_DisputeResolved(address(this), _disputeId); + emit DisputeResolved(address(this), _disputeId); // Test: resolve the dispute oracle.resolveDispute(_disputeId); @@ -1061,9 +1061,9 @@ contract Oracle_UnitTest is Test { vm.expectCall(address(finalityModule), abi.encodeCall(IModule.finalizeRequest, (_requestId, _caller))); } - // Check: emits RequestFinalized event? + // Check: emits OracleRequestFinalized event? vm.expectEmit(true, true, true, true); - emit Oracle_RequestFinalized(_requestId, _caller); + emit OracleRequestFinalized(_requestId, _caller); // Test: finalize the request vm.prank(_caller); @@ -1206,9 +1206,9 @@ contract Oracle_UnitTest is Test { vm.expectCall(address(finalityModule), abi.encodeCall(IModule.finalizeRequest, (_requestId, _caller))); } - // Check: emits RequestFinalized event? + // Check: emits OracleRequestFinalized event? vm.expectEmit(true, true, true, true); - emit Oracle_RequestFinalized(_requestId, _caller); + emit OracleRequestFinalized(_requestId, _caller); // Test: finalize the request vm.prank(_caller); @@ -1244,7 +1244,7 @@ contract Oracle_UnitTest is Test { // Expect dispute escalated event vm.expectEmit(true, true, true, true); - emit Oracle_DisputeEscalated(address(this), _disputeId); + emit DisputeEscalated(address(this), _disputeId); // Test: escalate the dispute oracle.escalateDispute(_disputeId); @@ -1270,7 +1270,7 @@ contract Oracle_UnitTest is Test { // Expect dispute escalated event vm.expectEmit(true, true, true, true); - emit Oracle_DisputeEscalated(address(this), _disputeId); + emit DisputeEscalated(address(this), _disputeId); // Test: escalate the dispute oracle.escalateDispute(_disputeId); diff --git a/solidity/test/unit/modules/dispute/BondedDisputeModule.t.sol b/solidity/test/unit/modules/dispute/BondedDisputeModule.t.sol index c28132e..5effeba 100644 --- a/solidity/test/unit/modules/dispute/BondedDisputeModule.t.sol +++ b/solidity/test/unit/modules/dispute/BondedDisputeModule.t.sol @@ -3,14 +3,15 @@ pragma solidity ^0.8.19; import 'forge-std/Test.sol'; +import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; + import { BondedDisputeModule, IBondedDisputeModule, - IOracle, - IAccountingExtension, - IERC20 + IOracle } from '../../../../contracts/modules/dispute/BondedDisputeModule.sol'; +import {IAccountingExtension} from '../../../../interfaces/extensions/IAccountingExtension.sol'; import {IModule} from '../../../../interfaces/IModule.sol'; /** diff --git a/solidity/test/unit/modules/dispute/CircuitResolverModule.t.sol b/solidity/test/unit/modules/dispute/CircuitResolverModule.t.sol index e3f23be..e9cfecc 100644 --- a/solidity/test/unit/modules/dispute/CircuitResolverModule.t.sol +++ b/solidity/test/unit/modules/dispute/CircuitResolverModule.t.sol @@ -3,14 +3,15 @@ pragma solidity ^0.8.19; import 'forge-std/Test.sol'; +import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; + import { CircuitResolverModule, ICircuitResolverModule, - IOracle, - IAccountingExtension, - IERC20 + IOracle } from '../../../../contracts/modules/dispute/CircuitResolverModule.sol'; +import {IAccountingExtension} from '../../../../interfaces/extensions/IAccountingExtension.sol'; import {IModule} from '../../../../interfaces/IModule.sol'; /** diff --git a/solidity/test/unit/modules/dispute/RootVerificationModule.t.sol b/solidity/test/unit/modules/dispute/RootVerificationModule.t.sol index a7bbf23..5814115 100644 --- a/solidity/test/unit/modules/dispute/RootVerificationModule.t.sol +++ b/solidity/test/unit/modules/dispute/RootVerificationModule.t.sol @@ -3,15 +3,16 @@ pragma solidity ^0.8.19; import 'forge-std/Test.sol'; +import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; + import { RootVerificationModule, IRootVerificationModule, - IOracle, - ITreeVerifier, - IAccountingExtension, - IERC20 + IOracle } from '../../../../contracts/modules/dispute/RootVerificationModule.sol'; +import {IAccountingExtension} from '../../../../interfaces/extensions/IAccountingExtension.sol'; +import {ITreeVerifier} from '../../../../interfaces/ITreeVerifier.sol'; import {IModule} from '../../../../interfaces/IModule.sol'; /** diff --git a/solidity/test/unit/modules/request/ContractCallRequestModule.t.sol b/solidity/test/unit/modules/request/ContractCallRequestModule.t.sol index fade188..d8d55a6 100644 --- a/solidity/test/unit/modules/request/ContractCallRequestModule.t.sol +++ b/solidity/test/unit/modules/request/ContractCallRequestModule.t.sol @@ -3,15 +3,17 @@ pragma solidity ^0.8.19; import 'forge-std/Test.sol'; +import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; + import { ContractCallRequestModule, IContractCallRequestModule, - IOracle, - IAccountingExtension, - IERC20 + IOracle } from '../../../../contracts/modules/request/ContractCallRequestModule.sol'; import {IModule} from '../../../../interfaces/IModule.sol'; +import {IAccountingExtension} from '../../../../interfaces/extensions/IAccountingExtension.sol'; + /** * @dev Harness to set an entry in the requestData mapping, without triggering setup request hooks */ diff --git a/solidity/test/unit/modules/request/HttpRequestModule.t.sol b/solidity/test/unit/modules/request/HttpRequestModule.t.sol index 547eb89..a9bf336 100644 --- a/solidity/test/unit/modules/request/HttpRequestModule.t.sol +++ b/solidity/test/unit/modules/request/HttpRequestModule.t.sol @@ -3,13 +3,13 @@ pragma solidity ^0.8.19; import 'forge-std/Test.sol'; +import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; + import { - HttpRequestModule, - IHttpRequestModule, - IOracle, - IAccountingExtension, - IERC20 + HttpRequestModule, IHttpRequestModule, IOracle } from '../../../../contracts/modules/request/HttpRequestModule.sol'; + +import {IAccountingExtension} from '../../../../interfaces/extensions/IAccountingExtension.sol'; import {IModule} from '../../../../interfaces/IModule.sol'; /** * @dev Harness to set an entry in the requestData mapping, without triggering setup request hooks diff --git a/solidity/test/unit/modules/request/SparseMerkleTreeRequestModule.t.sol b/solidity/test/unit/modules/request/SparseMerkleTreeRequestModule.t.sol index 728dc4d..a9540b1 100644 --- a/solidity/test/unit/modules/request/SparseMerkleTreeRequestModule.t.sol +++ b/solidity/test/unit/modules/request/SparseMerkleTreeRequestModule.t.sol @@ -3,13 +3,15 @@ pragma solidity ^0.8.19; import 'forge-std/Test.sol'; +import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; + import { SparseMerkleTreeRequestModule, ISparseMerkleTreeRequestModule, - IOracle, - IAccountingExtension, - IERC20 + IOracle } from '../../../../contracts/modules/request/SparseMerkleTreeRequestModule.sol'; + +import {IAccountingExtension} from '../../../../interfaces/extensions/IAccountingExtension.sol'; import {IModule} from '../../../../interfaces/IModule.sol'; import {ITreeVerifier} from '../../../../interfaces/ITreeVerifier.sol'; diff --git a/solidity/test/unit/modules/response/BondedResponseModule.t.sol b/solidity/test/unit/modules/response/BondedResponseModule.t.sol index d3bb7bb..631f1dd 100644 --- a/solidity/test/unit/modules/response/BondedResponseModule.t.sol +++ b/solidity/test/unit/modules/response/BondedResponseModule.t.sol @@ -3,15 +3,16 @@ pragma solidity ^0.8.19; import 'forge-std/Test.sol'; +import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; + import { BondedResponseModule, IBondedResponseModule, - IOracle, - IAccountingExtension, - IERC20 + IModule, + IOracle } from '../../../../contracts/modules/response/BondedResponseModule.sol'; -import {IModule} from '../../../../interfaces/IModule.sol'; +import {IAccountingExtension} from '../../../../interfaces/extensions/IAccountingExtension.sol'; /** * @dev Harness to set an entry in the requestData mapping, without triggering setup request hooks