diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml new file mode 100644 index 00000000..de1cc2b3 --- /dev/null +++ b/.github/workflows/canary.yml @@ -0,0 +1,56 @@ +name: Canary Release + +on: workflow_dispatch + +jobs: + export: + name: Generate Interfaces And Contracts + + runs-on: ubuntu-latest + strategy: + matrix: + export_type: ['interfaces', 'all'] + + env: + PROJECT_NAME: '@defi-wonderland/prophet-modules' + EXPORT_NAME: ${{ matrix.export_type == 'interfaces' && '-interfaces' || '' }} + + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Install Node + uses: actions/setup-node@v4 + with: + registry-url: 'https://registry.npmjs.org' + node-version: 20.x + cache: 'yarn' + + - name: Install dependencies + run: yarn --frozen-lockfile + + - name: Build project and generate out directory + run: yarn build + + - name: Update version + run: yarn version --new-version "0.0.0-${GITHUB_SHA::8}" --no-git-tag-version + + - name: Export Solidity - Export Type ${{ matrix.export_type }} + uses: defi-wonderland/solidity-exporter-action@v2.1.0 + with: + package_name: ${{ env.PROJECT_NAME }} + out: 'out' + interfaces: 'solidity/interfaces' + contracts: 'solidity/contracts' + libraries: "solidity/libraries" + export_type: '${{ matrix.export_type }}' + + - name: Publish to NPM - Export Type ${{ matrix.export_type }} + run: cd export/${{ env.PROJECT_NAME }}${{ env.EXPORT_NAME }} && npm publish --access public --tag canary + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/interfaces-canary.yml b/.github/workflows/interfaces-canary.yml deleted file mode 100644 index db1858ad..00000000 --- a/.github/workflows/interfaces-canary.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Interface Exporter Action - Canary - -on: workflow_dispatch - -jobs: - generate-and-publish-interfaces: - name: Generate Interfaces (canary) - runs-on: ubuntu-latest - strategy: - matrix: - typing_type: ["abi", "contracts"] - - steps: - - uses: actions/checkout@v3 - - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: nightly - - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: 16 - registry-url: "https://registry.npmjs.org" - - - name: Install dependencies - run: yarn --frozen-lockfile - - - name: Build project and generate out directory - run: yarn build - - - name: Update version - run: yarn version --new-version "0.0.0-${GITHUB_SHA::8}" --no-git-tag-version - - - name: Export Interfaces - ${{ matrix.typing_type }} - uses: defi-wonderland/interface-exporter-action@v1.2.1 - with: - out_dir: "out" - interfaces_dir: "solidity/interfaces" - contracts_dir: "solidity/contracts" - typing_type: "${{ matrix.typing_type }}" - package_name: "@defi-wonderland/prophet-modules-${{ matrix.typing_type }}" - destination_dir: "exported-interfaces/prophet-modules-${{ matrix.typing_type }}" - - - name: Publish - run: cd exported-interfaces/prophet-modules-${{ matrix.typing_type }} && npm publish --access public --tag canary - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/interfaces-production.yml b/.github/workflows/interfaces-production.yml deleted file mode 100644 index e1284492..00000000 --- a/.github/workflows/interfaces-production.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Interface Exporter Action - Production - -on: - push: - branches: - - main - -jobs: - generate-and-publish-interfaces: - if: github.repository == 'defi-wonderland/prophet-modules' - name: Generate Interfaces - runs-on: ubuntu-latest - strategy: - matrix: - typing_type: ["abi", "contracts"] - - steps: - - uses: actions/checkout@v3 - - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: nightly - - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: 16 - registry-url: "https://registry.npmjs.org" - - - name: Install dependencies - run: yarn --frozen-lockfile - - - name: Build project and generate out directory - run: yarn build - - - name: Export Interfaces - ${{ matrix.typing_type }} - uses: defi-wonderland/interface-exporter-action@v1.2.1 - with: - out_dir: "out" - interfaces_dir: "solidity/interfaces" - contracts_dir: "solidity/contracts" - typing_type: "${{ matrix.typing_type }}" - package_name: "@defi-wonderland/prophet-modules-${{ matrix.typing_type }}" - destination_dir: "exported-interfaces/prophet-modules-${{ matrix.typing_type }}" - - - name: Publish - run: cd exported-interfaces/prophet-modules-${{ matrix.typing_type }} && npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..996ea82f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,55 @@ +name: Production Release + +on: + release: + types: [published] + +jobs: + release: + name: Release + + runs-on: ubuntu-latest + strategy: + matrix: + export_type: ['interfaces', 'all'] + + env: + PROJECT_NAME: '@defi-wonderland/prophet-modules' + EXPORT_NAME: ${{ matrix.export_type == 'interfaces' && '-interfaces' || '' }} + + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Install Node + uses: actions/setup-node@v4 + with: + registry-url: 'https://registry.npmjs.org' + node-version: 20.x + cache: 'yarn' + + - name: Install dependencies + run: yarn --frozen-lockfile + + - name: Build project and generate out directory + run: yarn build + + - name: Export Solidity - Export Type ${{ matrix.export_type }} + uses: defi-wonderland/solidity-exporter-action@v2.1.0 + with: + package_name: ${{ env.PROJECT_NAME }} + out: 'out' + interfaces: 'solidity/interfaces' + contracts: 'solidity/contracts' + libraries: "solidity/libraries" + export_type: '${{ matrix.export_type }}' + + - name: Publish to NPM - Export Type ${{ matrix.export_type }} + run: cd export/${{ env.PROJECT_NAME }}${{ env.EXPORT_NAME }} && npm publish --access public --tag latest + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 5a5af24d..5005a532 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "package.json": "sort-package-json" }, "dependencies": { - "@defi-wonderland/prophet-core-contracts": "0.0.0-d01bc1a0", + "@defi-wonderland/prophet-core": "0.0.0-2e39539b", "@openzeppelin/contracts": "4.9.5", "solmate": "https://github.com/transmissions11/solmate.git#bfc9c25865a274a7827fea5abf6e4fb64fc64e6c" }, diff --git a/solidity/contracts/extensions/AccountingExtension.sol b/solidity/contracts/extensions/AccountingExtension.sol index 97384f31..6b173f19 100644 --- a/solidity/contracts/extensions/AccountingExtension.sol +++ b/solidity/contracts/extensions/AccountingExtension.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; -import {Validator} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Validator.sol'; +import {Validator} from '@defi-wonderland/prophet-core/solidity/contracts/Validator.sol'; import {IAccountingExtension} from '../../interfaces/extensions/IAccountingExtension.sol'; diff --git a/solidity/contracts/extensions/BondEscalationAccounting.sol b/solidity/contracts/extensions/BondEscalationAccounting.sol index 4bca276a..8e337644 100644 --- a/solidity/contracts/extensions/BondEscalationAccounting.sol +++ b/solidity/contracts/extensions/BondEscalationAccounting.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {AccountingExtension} from './AccountingExtension.sol'; diff --git a/solidity/contracts/modules/dispute/BondEscalationModule.sol b/solidity/contracts/modules/dispute/BondEscalationModule.sol index d33ce09b..b4917d60 100644 --- a/solidity/contracts/modules/dispute/BondEscalationModule.sol +++ b/solidity/contracts/modules/dispute/BondEscalationModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -// solhint-disable-next-line no-unused-import -import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {FixedPointMathLib} from 'solmate/utils/FixedPointMathLib.sol'; import {IBondEscalationModule} from '../../../interfaces/modules/dispute/IBondEscalationModule.sol'; @@ -339,12 +338,9 @@ contract BondEscalationModule is Module, IBondEscalationModule { } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - pure - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external pure override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = address(_params.accountingExtension) != address(0) && address(_params.bondToken) != address(0) && _params.bondSize != 0 && _params.bondEscalationDeadline != 0 && _params.maxNumberOfEscalations != 0 diff --git a/solidity/contracts/modules/dispute/BondedDisputeModule.sol b/solidity/contracts/modules/dispute/BondedDisputeModule.sol index 9c43ea64..2f1a6700 100644 --- a/solidity/contracts/modules/dispute/BondedDisputeModule.sol +++ b/solidity/contracts/modules/dispute/BondedDisputeModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -// solhint-disable-next-line no-unused-import -import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IBondedDisputeModule} from '../../../interfaces/modules/dispute/IBondedDisputeModule.sol'; @@ -105,12 +104,9 @@ contract BondedDisputeModule is Module, IBondedDisputeModule { } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - pure - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external pure override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = address(_params.accountingExtension) != address(0) && address(_params.bondToken) != address(0) && _params.bondSize != 0; diff --git a/solidity/contracts/modules/dispute/CircuitResolverModule.sol b/solidity/contracts/modules/dispute/CircuitResolverModule.sol index a0d04782..e7d0f391 100644 --- a/solidity/contracts/modules/dispute/CircuitResolverModule.sol +++ b/solidity/contracts/modules/dispute/CircuitResolverModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -// solhint-disable-next-line no-unused-import -import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IProphetVerifier} from '../../../interfaces/IProphetVerifier.sol'; import {ICircuitResolverModule} from '../../../interfaces/modules/dispute/ICircuitResolverModule.sol'; @@ -94,12 +93,9 @@ contract CircuitResolverModule is Module, ICircuitResolverModule { } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - view - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external view override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = address(_params.accountingExtension) != address(0) && address(_params.bondToken) != address(0) && _params.bondSize != 0 && _targetHasBytecode(_params.verifier) && _params.callData.length != 0; diff --git a/solidity/contracts/modules/dispute/RootVerificationModule.sol b/solidity/contracts/modules/dispute/RootVerificationModule.sol index c32016fe..ae3dde97 100644 --- a/solidity/contracts/modules/dispute/RootVerificationModule.sol +++ b/solidity/contracts/modules/dispute/RootVerificationModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -// solhint-disable-next-line no-unused-import -import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IRootVerificationModule} from '../../../interfaces/modules/dispute/IRootVerificationModule.sol'; import {MerkleLib} from '../../libraries/MerkleLib.sol'; @@ -92,12 +91,9 @@ contract RootVerificationModule is Module, IRootVerificationModule { } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - pure - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external pure override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = address(_params.accountingExtension) != address(0) && address(_params.bondToken) != address(0) && address(_params.treeVerifier) != address(0) && _params.bondSize != 0 && _params.treeData.length != 0 diff --git a/solidity/contracts/modules/finality/CallbackModule.sol b/solidity/contracts/modules/finality/CallbackModule.sol index 968b0dde..6e3e6403 100644 --- a/solidity/contracts/modules/finality/CallbackModule.sol +++ b/solidity/contracts/modules/finality/CallbackModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -// solhint-disable-next-line no-unused-import -import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IProphetCallback} from '../../../interfaces/IProphetCallback.sol'; import {ICallbackModule} from '../../../interfaces/modules/finality/ICallbackModule.sol'; @@ -35,12 +34,9 @@ contract CallbackModule is Module, ICallbackModule { } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - view - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external view override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = _params.data.length != 0 && _targetHasBytecode(_params.target); } diff --git a/solidity/contracts/modules/finality/MultipleCallbacksModule.sol b/solidity/contracts/modules/finality/MultipleCallbacksModule.sol index 32c4d845..2faa1071 100644 --- a/solidity/contracts/modules/finality/MultipleCallbacksModule.sol +++ b/solidity/contracts/modules/finality/MultipleCallbacksModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -// solhint-disable-next-line no-unused-import -import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IProphetCallback} from '../../../interfaces/IProphetCallback.sol'; import {IMultipleCallbacksModule} from '../../../interfaces/modules/finality/IMultipleCallbacksModule.sol'; @@ -42,12 +41,9 @@ contract MultipleCallbacksModule is Module, IMultipleCallbacksModule { } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - view - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external view override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = true; diff --git a/solidity/contracts/modules/request/ContractCallRequestModule.sol b/solidity/contracts/modules/request/ContractCallRequestModule.sol index 33c1824b..f214419a 100644 --- a/solidity/contracts/modules/request/ContractCallRequestModule.sol +++ b/solidity/contracts/modules/request/ContractCallRequestModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -// solhint-disable-next-line no-unused-import -import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IContractCallRequestModule} from '../../../interfaces/modules/request/IContractCallRequestModule.sol'; @@ -61,12 +60,9 @@ contract ContractCallRequestModule is Module, IContractCallRequestModule { } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - pure - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external pure override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = address(_params.accountingExtension) != address(0) && address(_params.paymentToken) != address(0) && _params.target != address(0) && _params.paymentAmount != 0 && _params.functionSelector != bytes4(0); diff --git a/solidity/contracts/modules/request/HttpRequestModule.sol b/solidity/contracts/modules/request/HttpRequestModule.sol index 95fc7f8c..6f3cd9d2 100644 --- a/solidity/contracts/modules/request/HttpRequestModule.sol +++ b/solidity/contracts/modules/request/HttpRequestModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -// solhint-disable-next-line no-unused-import -import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IHttpRequestModule} from '../../../interfaces/modules/request/IHttpRequestModule.sol'; @@ -61,12 +60,9 @@ contract HttpRequestModule is Module, IHttpRequestModule { } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - pure - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external pure override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = address(_params.accountingExtension) != address(0) && address(_params.paymentToken) != address(0) && _params.paymentAmount != 0 && bytes(_params.url).length != 0 && bytes(_params.body).length != 0; diff --git a/solidity/contracts/modules/request/SparseMerkleTreeRequestModule.sol b/solidity/contracts/modules/request/SparseMerkleTreeRequestModule.sol index 2e3adffc..de32c11e 100644 --- a/solidity/contracts/modules/request/SparseMerkleTreeRequestModule.sol +++ b/solidity/contracts/modules/request/SparseMerkleTreeRequestModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -// solhint-disable-next-line no-unused-import -import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {ISparseMerkleTreeRequestModule} from '../../../interfaces/modules/request/ISparseMerkleTreeRequestModule.sol'; @@ -61,12 +60,9 @@ contract SparseMerkleTreeRequestModule is Module, ISparseMerkleTreeRequestModule } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - pure - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external pure override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = address(_params.accountingExtension) != address(0) && address(_params.paymentToken) != address(0) && address(_params.treeVerifier) != address(0) && _params.paymentAmount != 0 && _params.treeData.length != 0 diff --git a/solidity/contracts/modules/resolution/ArbitratorModule.sol b/solidity/contracts/modules/resolution/ArbitratorModule.sol index 8d4af435..65772374 100644 --- a/solidity/contracts/modules/resolution/ArbitratorModule.sol +++ b/solidity/contracts/modules/resolution/ArbitratorModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -// solhint-disable-next-line no-unused-import -import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IArbitrator} from '../../../interfaces/IArbitrator.sol'; import {IArbitratorModule} from '../../../interfaces/modules/resolution/IArbitratorModule.sol'; @@ -68,12 +67,9 @@ contract ArbitratorModule is Module, IArbitratorModule { } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - pure - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external pure override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = _params.arbitrator != address(0); } diff --git a/solidity/contracts/modules/resolution/BondEscalationResolutionModule.sol b/solidity/contracts/modules/resolution/BondEscalationResolutionModule.sol index a1e3392f..6f5f3bdd 100644 --- a/solidity/contracts/modules/resolution/BondEscalationResolutionModule.sol +++ b/solidity/contracts/modules/resolution/BondEscalationResolutionModule.sol @@ -6,13 +6,12 @@ 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'; -// solhint-disable-next-line no-unused-import -import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; // solhint-disable-next-line no-unused-import import {IResolutionModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/resolution/IResolutionModule.sol'; + '@defi-wonderland/prophet-core/solidity/interfaces/modules/resolution/IResolutionModule.sol'; import {IBondEscalationResolutionModule} from '../../../interfaces/modules/resolution/IBondEscalationResolutionModule.sol'; @@ -340,12 +339,9 @@ contract BondEscalationResolutionModule is Module, IBondEscalationResolutionModu } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - pure - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external pure override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = address(_params.accountingExtension) != address(0) && address(_params.bondToken) != address(0) && _params.percentageDiff != 0 && _params.pledgeThreshold != 0 && _params.timeUntilDeadline != 0 diff --git a/solidity/contracts/modules/resolution/ERC20ResolutionModule.sol b/solidity/contracts/modules/resolution/ERC20ResolutionModule.sol index 2f80211e..e623c3ac 100644 --- a/solidity/contracts/modules/resolution/ERC20ResolutionModule.sol +++ b/solidity/contracts/modules/resolution/ERC20ResolutionModule.sol @@ -6,9 +6,8 @@ import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.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 {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IERC20ResolutionModule} from '../../../interfaces/modules/resolution/IERC20ResolutionModule.sol'; @@ -132,12 +131,9 @@ contract ERC20ResolutionModule is Module, IERC20ResolutionModule { } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - pure - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external pure override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = address(_params.accountingExtension) != address(0) && address(_params.votingToken) != address(0) && _params.minVotesForQuorum != 0 && _params.timeUntilDeadline != 0; diff --git a/solidity/contracts/modules/resolution/PrivateERC20ResolutionModule.sol b/solidity/contracts/modules/resolution/PrivateERC20ResolutionModule.sol index bb2fe905..74506a8e 100644 --- a/solidity/contracts/modules/resolution/PrivateERC20ResolutionModule.sol +++ b/solidity/contracts/modules/resolution/PrivateERC20ResolutionModule.sol @@ -6,9 +6,8 @@ import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.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 {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IPrivateERC20ResolutionModule} from '../../../interfaces/modules/resolution/IPrivateERC20ResolutionModule.sol'; @@ -159,12 +158,9 @@ contract PrivateERC20ResolutionModule is Module, IPrivateERC20ResolutionModule { } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - pure - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external pure override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = address(_params.accountingExtension) != address(0) && address(_params.votingToken) != address(0) && _params.minVotesForQuorum != 0 && _params.committingTimeWindow != 0 && _params.revealingTimeWindow != 0; diff --git a/solidity/contracts/modules/response/BondedResponseModule.sol b/solidity/contracts/modules/response/BondedResponseModule.sol index 6a55b75a..a7d8d14f 100644 --- a/solidity/contracts/modules/response/BondedResponseModule.sol +++ b/solidity/contracts/modules/response/BondedResponseModule.sol @@ -2,9 +2,9 @@ pragma solidity ^0.8.19; import {IBondedResponseModule} from '../../../interfaces/modules/response/IBondedResponseModule.sol'; -// solhint-disable-next-line no-unused-import -import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; + +import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; contract BondedResponseModule is Module, IBondedResponseModule { constructor(IOracle _oracle) Module(_oracle) {} @@ -126,12 +126,9 @@ contract BondedResponseModule is Module, IBondedResponseModule { } /// @inheritdoc IModule - function validateParameters(bytes calldata _encodedParameters) - external - pure - override(Module, IModule) - returns (bool _valid) - { + function validateParameters( + bytes calldata _encodedParameters + ) external pure override(Module, IModule) returns (bool _valid) { RequestParameters memory _params = decodeRequestData(_encodedParameters); _valid = address(_params.accountingExtension) != address(0) && address(_params.bondToken) != address(0) && _params.bondSize != 0 && _params.disputeWindow != 0 && _params.deadline != 0; diff --git a/solidity/interfaces/IArbitrator.sol b/solidity/interfaces/IArbitrator.sol index 78b8f5eb..c5fdc6cd 100644 --- a/solidity/interfaces/IArbitrator.sol +++ b/solidity/interfaces/IArbitrator.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; interface IArbitrator { /** diff --git a/solidity/interfaces/extensions/IAccountingExtension.sol b/solidity/interfaces/extensions/IAccountingExtension.sol index d1f0ba1a..cf4c8b06 100644 --- a/solidity/interfaces/extensions/IAccountingExtension.sol +++ b/solidity/interfaces/extensions/IAccountingExtension.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; /* diff --git a/solidity/interfaces/extensions/IBondEscalationAccounting.sol b/solidity/interfaces/extensions/IBondEscalationAccounting.sol index 840f84e4..d0714d2d 100644 --- a/solidity/interfaces/extensions/IBondEscalationAccounting.sol +++ b/solidity/interfaces/extensions/IBondEscalationAccounting.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.19; import {IBondEscalationModule} from '../modules/dispute/IBondEscalationModule.sol'; import {IAccountingExtension} from './IAccountingExtension.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; /** @@ -149,7 +149,9 @@ interface IBondEscalationAccounting is IAccountingExtension { * @return _amountPerPledger Amount of `_token` to be rewarded to each of the winning pledgers * @return _bondEscalationModule The address of the bond escalation module that was used */ - function escalationResults(bytes32 _disputeId) + function escalationResults( + bytes32 _disputeId + ) external returns (bytes32 _requestId, IERC20 _token, uint256 _amountPerPledger, IBondEscalationModule _bondEscalationModule); diff --git a/solidity/interfaces/modules/dispute/IBondEscalationModule.sol b/solidity/interfaces/modules/dispute/IBondEscalationModule.sol index 175a984f..8059f5aa 100644 --- a/solidity/interfaces/modules/dispute/IBondEscalationModule.sol +++ b/solidity/interfaces/modules/dispute/IBondEscalationModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IDisputeModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/dispute/IDisputeModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {IDisputeModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/dispute/IDisputeModule.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IBondEscalationAccounting} from '../../extensions/IBondEscalationAccounting.sol'; diff --git a/solidity/interfaces/modules/dispute/IBondedDisputeModule.sol b/solidity/interfaces/modules/dispute/IBondedDisputeModule.sol index cfe2ff61..feaa3426 100644 --- a/solidity/interfaces/modules/dispute/IBondedDisputeModule.sol +++ b/solidity/interfaces/modules/dispute/IBondedDisputeModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IDisputeModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/dispute/IDisputeModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {IDisputeModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/dispute/IDisputeModule.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IAccountingExtension} from '../../extensions/IAccountingExtension.sol'; diff --git a/solidity/interfaces/modules/dispute/ICircuitResolverModule.sol b/solidity/interfaces/modules/dispute/ICircuitResolverModule.sol index 5db18b0c..b040a5ab 100644 --- a/solidity/interfaces/modules/dispute/ICircuitResolverModule.sol +++ b/solidity/interfaces/modules/dispute/ICircuitResolverModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IDisputeModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/dispute/IDisputeModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {IDisputeModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/dispute/IDisputeModule.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IAccountingExtension} from '../../extensions/IAccountingExtension.sol'; diff --git a/solidity/interfaces/modules/dispute/IRootVerificationModule.sol b/solidity/interfaces/modules/dispute/IRootVerificationModule.sol index 1877d2cf..8b80dfa7 100644 --- a/solidity/interfaces/modules/dispute/IRootVerificationModule.sol +++ b/solidity/interfaces/modules/dispute/IRootVerificationModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IDisputeModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/dispute/IDisputeModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {IDisputeModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/dispute/IDisputeModule.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {ITreeVerifier} from '../../ITreeVerifier.sol'; diff --git a/solidity/interfaces/modules/finality/ICallbackModule.sol b/solidity/interfaces/modules/finality/ICallbackModule.sol index d5cb064f..f7ad9ef1 100644 --- a/solidity/interfaces/modules/finality/ICallbackModule.sol +++ b/solidity/interfaces/modules/finality/ICallbackModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IFinalityModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/finality/IFinalityModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {IFinalityModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/finality/IFinalityModule.sol'; /** * @title CallbackModule diff --git a/solidity/interfaces/modules/finality/IMultipleCallbacksModule.sol b/solidity/interfaces/modules/finality/IMultipleCallbacksModule.sol index ea4546b3..811e46c5 100644 --- a/solidity/interfaces/modules/finality/IMultipleCallbacksModule.sol +++ b/solidity/interfaces/modules/finality/IMultipleCallbacksModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IFinalityModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/finality/IFinalityModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {IFinalityModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/finality/IFinalityModule.sol'; /** * @title MultipleCallbackModule diff --git a/solidity/interfaces/modules/request/IContractCallRequestModule.sol b/solidity/interfaces/modules/request/IContractCallRequestModule.sol index 9c30ae34..b65c1e7f 100644 --- a/solidity/interfaces/modules/request/IContractCallRequestModule.sol +++ b/solidity/interfaces/modules/request/IContractCallRequestModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IRequestModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/request/IRequestModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {IRequestModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/request/IRequestModule.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IAccountingExtension} from '../../../interfaces/extensions/IAccountingExtension.sol'; diff --git a/solidity/interfaces/modules/request/IHttpRequestModule.sol b/solidity/interfaces/modules/request/IHttpRequestModule.sol index 69302148..c8ac81e2 100644 --- a/solidity/interfaces/modules/request/IHttpRequestModule.sol +++ b/solidity/interfaces/modules/request/IHttpRequestModule.sol @@ -2,9 +2,8 @@ pragma solidity ^0.8.19; import {IAccountingExtension} from '../../../interfaces/extensions/IAccountingExtension.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IRequestModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/request/IRequestModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {IRequestModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/request/IRequestModule.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; /* diff --git a/solidity/interfaces/modules/request/ISparseMerkleTreeRequestModule.sol b/solidity/interfaces/modules/request/ISparseMerkleTreeRequestModule.sol index 33d8c40b..999a59a4 100644 --- a/solidity/interfaces/modules/request/ISparseMerkleTreeRequestModule.sol +++ b/solidity/interfaces/modules/request/ISparseMerkleTreeRequestModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IRequestModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/request/IRequestModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {IRequestModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/request/IRequestModule.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {ITreeVerifier} from '../../../interfaces/ITreeVerifier.sol'; diff --git a/solidity/interfaces/modules/resolution/IArbitratorModule.sol b/solidity/interfaces/modules/resolution/IArbitratorModule.sol index 28544801..5e34ea70 100644 --- a/solidity/interfaces/modules/resolution/IArbitratorModule.sol +++ b/solidity/interfaces/modules/resolution/IArbitratorModule.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IResolutionModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/resolution/IResolutionModule.sol'; + '@defi-wonderland/prophet-core/solidity/interfaces/modules/resolution/IResolutionModule.sol'; /* * @title ArbitratorModule diff --git a/solidity/interfaces/modules/resolution/IBondEscalationResolutionModule.sol b/solidity/interfaces/modules/resolution/IBondEscalationResolutionModule.sol index f7582e5e..a9c8e0b2 100644 --- a/solidity/interfaces/modules/resolution/IBondEscalationResolutionModule.sol +++ b/solidity/interfaces/modules/resolution/IBondEscalationResolutionModule.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IResolutionModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/resolution/IResolutionModule.sol'; + '@defi-wonderland/prophet-core/solidity/interfaces/modules/resolution/IResolutionModule.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IBondEscalationAccounting} from '../../extensions/IBondEscalationAccounting.sol'; @@ -220,10 +220,9 @@ interface IBondEscalationResolutionModule is IResolutionModule { * @return _pledgesFor The amount of pledges in favor of the dispute. * @return _pledgesAgainst The amount of pledges against the dispute. */ - function escalations(bytes32 _disputeId) - external - view - returns (Resolution _resolution, uint128 _startTime, uint256 _pledgesFor, uint256 _pledgesAgainst); + function escalations( + bytes32 _disputeId + ) external view returns (Resolution _resolution, uint128 _startTime, uint256 _pledgesFor, uint256 _pledgesAgainst); /** * @notice Returns the inequality status and its last update time of a given dispute. diff --git a/solidity/interfaces/modules/resolution/IERC20ResolutionModule.sol b/solidity/interfaces/modules/resolution/IERC20ResolutionModule.sol index 86429c23..f4fe7bbe 100644 --- a/solidity/interfaces/modules/resolution/IERC20ResolutionModule.sol +++ b/solidity/interfaces/modules/resolution/IERC20ResolutionModule.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IResolutionModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/resolution/IResolutionModule.sol'; + '@defi-wonderland/prophet-core/solidity/interfaces/modules/resolution/IResolutionModule.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IAccountingExtension} from '../../extensions/IAccountingExtension.sol'; diff --git a/solidity/interfaces/modules/resolution/IPrivateERC20ResolutionModule.sol b/solidity/interfaces/modules/resolution/IPrivateERC20ResolutionModule.sol index fccddc87..51ae24e6 100644 --- a/solidity/interfaces/modules/resolution/IPrivateERC20ResolutionModule.sol +++ b/solidity/interfaces/modules/resolution/IPrivateERC20ResolutionModule.sol @@ -2,9 +2,9 @@ pragma solidity ^0.8.19; import {IAccountingExtension} from '../../extensions/IAccountingExtension.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IResolutionModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/resolution/IResolutionModule.sol'; + '@defi-wonderland/prophet-core/solidity/interfaces/modules/resolution/IResolutionModule.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; /* diff --git a/solidity/interfaces/modules/response/IBondedResponseModule.sol b/solidity/interfaces/modules/response/IBondedResponseModule.sol index c8128f4e..4bae38f9 100644 --- a/solidity/interfaces/modules/response/IBondedResponseModule.sol +++ b/solidity/interfaces/modules/response/IBondedResponseModule.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IResponseModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/response/IResponseModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {IResponseModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/response/IResponseModule.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IAccountingExtension} from '../../extensions/IAccountingExtension.sol'; diff --git a/solidity/scripts/Deploy.sol b/solidity/scripts/Deploy.sol index 5033eca0..74ca00ed 100644 --- a/solidity/scripts/Deploy.sol +++ b/solidity/scripts/Deploy.sol @@ -3,9 +3,9 @@ pragma solidity ^0.8.19; import {Script, console} from 'forge-std/Script.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IResolutionModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/resolution/IResolutionModule.sol'; + '@defi-wonderland/prophet-core/solidity/interfaces/modules/resolution/IResolutionModule.sol'; import {BondEscalationModule} from '../contracts/modules/dispute/BondEscalationModule.sol'; import {BondedDisputeModule} from '../contracts/modules/dispute/BondedDisputeModule.sol'; diff --git a/solidity/test/integration/Arbitration.t.sol b/solidity/test/integration/Arbitration.t.sol index 6f9235e5..d0732b69 100644 --- a/solidity/test/integration/Arbitration.t.sol +++ b/solidity/test/integration/Arbitration.t.sol @@ -1,8 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IArbitrator} from '../../interfaces/IArbitrator.sol'; -import {MockAtomicArbitrator} from '../mocks/MockAtomicArbitrator.sol'; import './IntegrationBase.sol'; contract Integration_Arbitration is IntegrationBase { diff --git a/solidity/test/integration/BondEscalation.t.sol b/solidity/test/integration/BondEscalation.t.sol index 3ce1e13b..e97dd759 100644 --- a/solidity/test/integration/BondEscalation.t.sol +++ b/solidity/test/integration/BondEscalation.t.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.19; import './IntegrationBase.sol'; -import {IValidator} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IValidator.sol'; contract Integration_BondEscalation is IntegrationBase { address internal _secondDisputer = makeAddr('secondDisputer'); @@ -494,7 +493,7 @@ contract Integration_BondEscalation is IntegrationBase { // Create a new proposal with another dispute module _bondEscalationAccounting.approveModule(mockRequest.requestModule); - vm.expectRevert(IValidator.Validator_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); _bondEscalationAccounting.releasePledge(mockRequest, mockDispute, _attacker, usdc, _pledgeSize * 4); vm.stopPrank(); } diff --git a/solidity/test/integration/EscalateDispute.t.sol b/solidity/test/integration/EscalateDispute.t.sol index 88d3165f..deee62d3 100644 --- a/solidity/test/integration/EscalateDispute.t.sol +++ b/solidity/test/integration/EscalateDispute.t.sol @@ -72,7 +72,7 @@ contract Integration_EscalateDispute is IntegrationBase { function test_escalateDispute() public { // Escalate dispute reverts if dispute does not exist mockDispute.requestId = bytes32(0); - vm.expectRevert(IOracle.Oracle_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); oracle.escalateDispute(mockRequest, mockResponse, mockDispute); mockDispute.requestId = _requestId; diff --git a/solidity/test/integration/Finalization.t.sol b/solidity/test/integration/Finalization.t.sol index 23a988ef..4b0883d3 100644 --- a/solidity/test/integration/Finalization.t.sol +++ b/solidity/test/integration/Finalization.t.sol @@ -46,9 +46,8 @@ contract Integration_Finalization is IntegrationBase { function test_revertFinalizeIfNoResponse() public { _createRequest(); - mockResponse.response = abi.encode('nonexistent'); // Check: reverts if request has no response? - vm.expectRevert(IOracle.Oracle_InvalidFinalizedResponse.selector); + vm.expectRevert(IOracle.Oracle_InvalidResponse.selector); vm.prank(_finalizer); oracle.finalize(mockRequest, mockResponse); diff --git a/solidity/test/integration/IntegrationBase.sol b/solidity/test/integration/IntegrationBase.sol index a6f3de5b..04560e47 100644 --- a/solidity/test/integration/IntegrationBase.sol +++ b/solidity/test/integration/IntegrationBase.sol @@ -5,38 +5,44 @@ pragma solidity ^0.8.19; // solhint-disable-next-line no-console import {console} from 'forge-std/console.sol'; -import {IOracle, Oracle} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Oracle.sol'; -import {IDisputeModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/dispute/IDisputeModule.sol'; - -import {IFinalityModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/finality/IFinalityModule.sol'; -import {IRequestModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/request/IRequestModule.sol'; +import {IOracle, Oracle} from '@defi-wonderland/prophet-core/solidity/contracts/Oracle.sol'; +import {IDisputeModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/dispute/IDisputeModule.sol'; +import {IFinalityModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/finality/IFinalityModule.sol'; +import {IRequestModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/request/IRequestModule.sol'; import {IResolutionModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/resolution/IResolutionModule.sol'; -import {IResponseModule} from - '@defi-wonderland/prophet-core-contracts/solidity/interfaces/modules/response/IResponseModule.sol'; + '@defi-wonderland/prophet-core/solidity/interfaces/modules/resolution/IResolutionModule.sol'; +import {IResponseModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/response/IResponseModule.sol'; +import {ValidatorLib} from '@defi-wonderland/prophet-core/solidity/libraries/ValidatorLib.sol'; import {DSTestPlus} from '@defi-wonderland/solidity-utils/solidity/test/DSTestPlus.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IWETH9} from '../utils/external/IWETH9.sol'; import {AccountingExtension, IAccountingExtension} from '../../contracts/extensions/AccountingExtension.sol'; - import { BondEscalationAccounting, IBondEscalationAccounting } from '../../contracts/extensions/BondEscalationAccounting.sol'; import {BondEscalationModule, IBondEscalationModule} from '../../contracts/modules/dispute/BondEscalationModule.sol'; import {BondedDisputeModule, IBondedDisputeModule} from '../../contracts/modules/dispute/BondedDisputeModule.sol'; +import { + IRootVerificationModule, RootVerificationModule +} from '../../contracts/modules/dispute/RootVerificationModule.sol'; import {CallbackModule, ICallbackModule} from '../../contracts/modules/finality/CallbackModule.sol'; import {HttpRequestModule, IHttpRequestModule} from '../../contracts/modules/request/HttpRequestModule.sol'; +import { + ISparseMerkleTreeRequestModule, + SparseMerkleTreeRequestModule +} from '../../contracts/modules/request/SparseMerkleTreeRequestModule.sol'; import {ArbitratorModule, IArbitratorModule} from '../../contracts/modules/resolution/ArbitratorModule.sol'; import {BondedResponseModule, IBondedResponseModule} from '../../contracts/modules/response/BondedResponseModule.sol'; +import {SparseMerkleTreeL32Verifier} from '../../contracts/periphery/SparseMerkleTreeL32Verifier.sol'; +import {IArbitrator} from '../../interfaces/IArbitrator.sol'; import {IProphetCallback} from '../../interfaces/IProphetCallback.sol'; +import {ITreeVerifier} from '../../interfaces/ITreeVerifier.sol'; import {MockArbitrator} from '../mocks/MockArbitrator.sol'; +import {MockAtomicArbitrator} from '../mocks/MockAtomicArbitrator.sol'; import {MockCallback} from '../mocks/MockCallback.sol'; import {Helpers} from '../utils/Helpers.sol'; diff --git a/solidity/test/integration/ResponseDispute.t.sol b/solidity/test/integration/ResponseDispute.t.sol index 638cb9ff..9e859439 100644 --- a/solidity/test/integration/ResponseDispute.t.sol +++ b/solidity/test/integration/ResponseDispute.t.sol @@ -49,7 +49,7 @@ contract Integration_ResponseDispute is IntegrationBase { vm.assume(_nonExistentResponseId != _getId(mockResponse)); mockDispute.responseId = _nonExistentResponseId; - vm.expectRevert(IOracle.Oracle_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); vm.prank(disputer); oracle.disputeResponse(mockRequest, mockResponse, mockDispute); @@ -63,7 +63,7 @@ contract Integration_ResponseDispute is IntegrationBase { mockDispute.requestId = _requestId; - vm.expectRevert(IOracle.Oracle_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); vm.prank(disputer); oracle.disputeResponse(mockRequest, mockResponse, mockDispute); diff --git a/solidity/test/integration/ResponseProposal.t.sol b/solidity/test/integration/ResponseProposal.t.sol index eaee2adc..e7decc7c 100644 --- a/solidity/test/integration/ResponseProposal.t.sol +++ b/solidity/test/integration/ResponseProposal.t.sol @@ -92,7 +92,7 @@ contract Integration_ResponseProposal is IntegrationBase { mockResponse.requestId = _nonExistentRequestId; // Check: does revert if request does not exist? - vm.expectRevert(IOracle.Oracle_InvalidResponseBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidResponseBody.selector); vm.prank(proposer); oracle.proposeResponse(mockRequest, mockResponse); diff --git a/solidity/test/integration/RootVerification.t.sol b/solidity/test/integration/RootVerification.t.sol index e35236e8..a5877b76 100644 --- a/solidity/test/integration/RootVerification.t.sol +++ b/solidity/test/integration/RootVerification.t.sol @@ -1,15 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import { - IRootVerificationModule, RootVerificationModule -} from '../../contracts/modules/dispute/RootVerificationModule.sol'; -import { - ISparseMerkleTreeRequestModule, - SparseMerkleTreeRequestModule -} from '../../contracts/modules/request/SparseMerkleTreeRequestModule.sol'; -import {SparseMerkleTreeL32Verifier} from '../../contracts/periphery/SparseMerkleTreeL32Verifier.sol'; -import {ITreeVerifier} from '../../interfaces/ITreeVerifier.sol'; import './IntegrationBase.sol'; contract Integration_RootVerification is IntegrationBase { diff --git a/solidity/test/mocks/MockAtomicArbitrator.sol b/solidity/test/mocks/MockAtomicArbitrator.sol index d651f236..94323d0e 100644 --- a/solidity/test/mocks/MockAtomicArbitrator.sol +++ b/solidity/test/mocks/MockAtomicArbitrator.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.19; import {IArbitrator} from '../../interfaces/IArbitrator.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; contract MockAtomicArbitrator is IArbitrator { IOracle.DisputeStatus public answer; diff --git a/solidity/test/unit/extensions/AccountingExtension.t.sol b/solidity/test/unit/extensions/AccountingExtension.t.sol index 13aecead..e51914c6 100644 --- a/solidity/test/unit/extensions/AccountingExtension.t.sol +++ b/solidity/test/unit/extensions/AccountingExtension.t.sol @@ -8,7 +8,7 @@ import {Helpers} from '../../utils/Helpers.sol'; import { AccountingExtension, IAccountingExtension, IERC20 } from '../../../contracts/extensions/AccountingExtension.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Oracle.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/contracts/Oracle.sol'; import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; import {MockERC20Proxy} from '../../mocks/MockERC20Proxy.sol'; diff --git a/solidity/test/unit/modules/dispute/BondEscalationAccounting.t.sol b/solidity/test/unit/modules/dispute/BondEscalationAccounting.t.sol index d76ace9c..4b9061dd 100644 --- a/solidity/test/unit/modules/dispute/BondEscalationAccounting.t.sol +++ b/solidity/test/unit/modules/dispute/BondEscalationAccounting.t.sol @@ -82,10 +82,9 @@ contract BaseTest is Test, Helpers { bytes32 indexed _requestId, bytes32 indexed _disputeId, address indexed _pledger, IERC20 _token, uint256 _amount ); - function _createWinningPledgersArray(uint256 _numWinningPledgers) - internal - returns (address[] memory _winningPledgers) - { + function _createWinningPledgersArray( + uint256 _numWinningPledgers + ) internal returns (address[] memory _winningPledgers) { _winningPledgers = new address[](_numWinningPledgers); address _winningPledger; @@ -246,7 +245,7 @@ contract BondEscalationAccounting_Unit_OnSettleBondEscalation is BaseTest { } function test_revertIfInsufficientFunds(uint256 _amountPerPledger, uint256 _numOfWinningPledgers) public { - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); bytes32 _disputeId = _getId(_dispute); @@ -279,7 +278,7 @@ contract BondEscalationAccounting_Unit_OnSettleBondEscalation is BaseTest { } function test_successfulCall(uint256 _numOfWinningPledgers, uint256 _amountPerPledger) public { - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); bytes32 _disputeId = _getId(_dispute); @@ -326,9 +325,8 @@ contract BondEscalationAccounting_Unit_OnSettleBondEscalation is BaseTest { contract BondEscalationAccounting_Unit_ReleasePledge is BaseTest { function test_revertIfDisallowedModule(address _pledger, uint256 _amount) public { - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); - bytes32 _disputeId = _getId(_dispute); // Mock and expect the call to oracle checking if the module is allowed _mockAndExpect( @@ -350,7 +348,7 @@ contract BondEscalationAccounting_Unit_ReleasePledge is BaseTest { function test_revertIfInsufficientFunds(uint256 _amount, address _pledger) public { vm.assume(_amount < type(uint256).max); - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); bytes32 _disputeId = _getId(_dispute); @@ -375,7 +373,7 @@ contract BondEscalationAccounting_Unit_ReleasePledge is BaseTest { } function test_successfulCall(uint256 _amount, address _pledger) public { - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); bytes32 _disputeId = _getId(_dispute); @@ -399,7 +397,7 @@ contract BondEscalationAccounting_Unit_ReleasePledge is BaseTest { } function test_emitsEvent(uint256 _amount, address _pledger) public { - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); bytes32 _disputeId = _getId(_dispute); diff --git a/solidity/test/unit/modules/dispute/BondEscalationModule.t.sol b/solidity/test/unit/modules/dispute/BondEscalationModule.t.sol index 0b8bdcbd..fad1843a 100644 --- a/solidity/test/unit/modules/dispute/BondEscalationModule.t.sol +++ b/solidity/test/unit/modules/dispute/BondEscalationModule.t.sol @@ -5,9 +5,9 @@ import 'forge-std/Test.sol'; import {Helpers} from '../../../utils/Helpers.sol'; -import {IModule} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IModule.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IValidator} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IValidator.sol'; +import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {ValidatorLib} from '@defi-wonderland/prophet-core/solidity/libraries/ValidatorLib.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {Strings} from '@openzeppelin/contracts/utils/Strings.sol'; @@ -158,17 +158,16 @@ contract BondEscalationModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleName() public { + function test_moduleName() public view { assertEq(bondEscalationModule.moduleName(), 'BondEscalationModule'); } /** * @notice Tests that decodeRequestData decodes the data correctly */ - function test_decodeRequestDataReturnTheCorrectData(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_decodeRequestDataReturnTheCorrectData( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { mockRequest.disputeModuleData = abi.encode(_params); IBondEscalationModule.RequestParameters memory _decodedParams = @@ -187,7 +186,7 @@ contract BondEscalationModule_Unit_ModuleData is BaseTest { /** * @notice Test that the validateParameters function correctly checks the parameters */ - function test_validateParameters(IBondEscalationModule.RequestParameters calldata _params) public { + function test_validateParameters(IBondEscalationModule.RequestParameters calldata _params) public view { if ( address(_params.accountingExtension) == address(0) || address(_params.bondToken) == address(0) || _params.bondSize == 0 || _params.bondEscalationDeadline == 0 || _params.maxNumberOfEscalations == 0 @@ -207,10 +206,9 @@ contract BondEscalationModule_Unit_EscalateDispute is BaseTest { * - The _requestId tied to the dispute tied to _disputeId must be valid (non-zero) * - The block.timestamp has to be <= bond escalation deadline */ - function test_revertEscalationDuringBondEscalation(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_revertEscalationDuringBondEscalation( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { // Set _bondEscalationDeadline to be the current timestamp to reach the second condition. _params.bondEscalationDeadline = block.timestamp; @@ -289,10 +287,9 @@ contract BondEscalationModule_Unit_EscalateDispute is BaseTest { * - The dispute has to have gone or be going through the bond escalation process * - The pledges must not be tied */ - function test_revertIfEscalatingDisputeIsNotTied(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_revertIfEscalatingDisputeIsNotTied( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { // Set a tying buffer to make the test more explicit _params.tyingBuffer = 1000; // Set bond escalation deadline to be the current timestamp. We will warp this. @@ -607,10 +604,9 @@ contract BondEscalationModule_Unit_OnDisputeStatusChange is BaseTest { /** * @notice Tests that onDisputeStatusChange pays the proposer if the disputer lost */ - function test_callPayIfNormalDisputeLost(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_callPayIfNormalDisputeLost( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.accountingExtension = IBondEscalationAccounting(makeAddr('BondEscalationAccounting')); mockRequest.disputeModuleData = abi.encode(_params); bytes32 _requestId = _getId(mockRequest); @@ -640,10 +636,9 @@ contract BondEscalationModule_Unit_OnDisputeStatusChange is BaseTest { /** * @notice Tests that onDisputeStatusChange pays the disputer if the disputer won */ - function test_callPayIfNormalDisputeWon(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_callPayIfNormalDisputeWon( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.accountingExtension = IBondEscalationAccounting(makeAddr('BondEscalationAccounting')); mockRequest.disputeModuleData = abi.encode(_params); bytes32 _requestId = _getId(mockRequest); @@ -679,10 +674,9 @@ contract BondEscalationModule_Unit_OnDisputeStatusChange is BaseTest { bondEscalationModule.onDisputeStatusChange(_disputeId, mockRequest, mockResponse, mockDispute); } - function test_emitsEvent(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_emitsEvent( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { IOracle.DisputeStatus _status = IOracle.DisputeStatus.Won; mockRequest.disputeModuleData = abi.encode(_params); @@ -725,10 +719,9 @@ contract BondEscalationModule_Unit_OnDisputeStatusChange is BaseTest { * @notice Tests that onDisputeStatusChange returns early if the dispute has gone through the bond * escalation mechanism but no one pledged */ - function test_earlyReturnIfBondEscalatedDisputeHashNoPledgers(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_earlyReturnIfBondEscalatedDisputeHashNoPledgers( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { mockRequest.disputeModuleData = abi.encode(_params); bytes32 _requestId = _getId(mockRequest); @@ -936,7 +929,7 @@ contract BondEscalationModule_Unit_PledgeForDispute is BaseTest { */ function test_revertIfInvalidDisputeBody() public { // Check: does it revert if the dispute body is invalid? - vm.expectRevert(IValidator.Validator_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); bondEscalationModule.pledgeForDispute(mockRequest, mockDispute); } @@ -954,10 +947,9 @@ contract BondEscalationModule_Unit_PledgeForDispute is BaseTest { /** * @notice Tests that pledgeForDispute reverts if someone tries to pledge after the tying buffer. */ - function test_revertIfTimestampBeyondTyingBuffer(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_revertIfTimestampBeyondTyingBuffer( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.bondSize = 1; _params.maxNumberOfEscalations = 1; _params.bondEscalationDeadline = block.timestamp; @@ -980,10 +972,9 @@ contract BondEscalationModule_Unit_PledgeForDispute is BaseTest { /** * @notice Tests that pledgeForDispute reverts if the maximum number of escalations has been reached. */ - function test_revertIfMaxNumberOfEscalationsReached(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_revertIfMaxNumberOfEscalationsReached( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.bondSize = 1; _params.maxNumberOfEscalations = 2; _params.bondEscalationDeadline = block.timestamp - 1; @@ -1019,7 +1010,7 @@ contract BondEscalationModule_Unit_PledgeForDispute is BaseTest { _params.bondEscalationDeadline = block.timestamp + 1; mockRequest.disputeModuleData = abi.encode(_params); - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); bytes32 _disputeId = _getId(_dispute); bondEscalationModule.forTest_setEscalatedDispute(_requestId, _disputeId); @@ -1038,17 +1029,16 @@ contract BondEscalationModule_Unit_PledgeForDispute is BaseTest { * @notice Tests that pledgeForDispute reverts if the timestamp is within the tying buffer and someone attempts * to pledge when the funds are tied, effectively breaking the tie */ - function test_revertIfAttemptToBreakTieDuringTyingBuffer(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_revertIfAttemptToBreakTieDuringTyingBuffer( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.bondSize = 1; _params.maxNumberOfEscalations = 3; _params.bondEscalationDeadline = block.timestamp - 1; _params.tyingBuffer = 1000; mockRequest.disputeModuleData = abi.encode(_params); - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); bytes32 _disputeId = _getId(_dispute); @@ -1067,17 +1057,16 @@ contract BondEscalationModule_Unit_PledgeForDispute is BaseTest { /** * @notice Tests that pledgeForDispute is called successfully */ - function test_successfulCall(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_successfulCall( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.bondSize = 1000; _params.maxNumberOfEscalations = 3; _params.bondEscalationDeadline = block.timestamp - 1; _params.tyingBuffer = 1000; mockRequest.disputeModuleData = abi.encode(_params); - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); bytes32 _disputeId = _getId(_dispute); @@ -1120,7 +1109,7 @@ contract BondEscalationModule_Unit_PledgeAgainstDispute is BaseTest { */ function test_revertIfInvalidDisputeBody() public { // Check: does it revert if the dispute body is invalid? - vm.expectRevert(IValidator.Validator_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); bondEscalationModule.pledgeAgainstDispute(mockRequest, mockDispute); } @@ -1128,9 +1117,7 @@ contract BondEscalationModule_Unit_PledgeAgainstDispute is BaseTest { * @notice Tests that pledgeAgainstDispute reverts if the dispute is not going through the bond escalation mechanism. */ function test_revertIfTheDisputeIsNotGoingThroughTheBondEscalationProcess() public { - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); - bytes32 _requestId = _getId(mockRequest); - bytes32 _disputeId = _getId(_dispute); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); // Check: does it revert if the dispute is not escalated yet? vm.expectRevert(IBondEscalationModule.BondEscalationModule_InvalidDispute.selector); @@ -1140,17 +1127,16 @@ contract BondEscalationModule_Unit_PledgeAgainstDispute is BaseTest { /** * @notice Tests that pledgeAgainstDispute reverts if someone tries to pledge after the tying buffer. */ - function test_revertIfTimestampBeyondTyingBuffer(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_revertIfTimestampBeyondTyingBuffer( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.bondSize = 1; _params.maxNumberOfEscalations = 1; _params.bondEscalationDeadline = block.timestamp; _params.tyingBuffer = 1000; mockRequest.disputeModuleData = abi.encode(_params); - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); bytes32 _disputeId = _getId(_dispute); @@ -1167,17 +1153,16 @@ contract BondEscalationModule_Unit_PledgeAgainstDispute is BaseTest { /** * @notice Tests that pledgeAgainstDispute reverts if the maximum number of escalations has been reached. */ - function test_revertIfMaxNumberOfEscalationsReached(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_revertIfMaxNumberOfEscalationsReached( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.bondSize = 1; _params.maxNumberOfEscalations = 2; _params.bondEscalationDeadline = block.timestamp - 1; _params.tyingBuffer = 1000; mockRequest.disputeModuleData = abi.encode(_params); - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); bytes32 _disputeId = _getId(_dispute); @@ -1198,17 +1183,16 @@ contract BondEscalationModule_Unit_PledgeAgainstDispute is BaseTest { * @notice Tests that pledgeAgainstDispute reverts if someone tries to pledge in favor of the dispute when there are * more pledges against of the dispute than in favor of it */ - function test_revertIfThereIsMorePledgedAgainstDisputeThanFor(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_revertIfThereIsMorePledgedAgainstDisputeThanFor( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.tyingBuffer = bound(_params.tyingBuffer, 0, type(uint128).max); _params.bondSize = 1; _params.maxNumberOfEscalations = 3; _params.bondEscalationDeadline = block.timestamp + 1; mockRequest.disputeModuleData = abi.encode(_params); - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); bytes32 _disputeId = _getId(_dispute); @@ -1229,10 +1213,9 @@ contract BondEscalationModule_Unit_PledgeAgainstDispute is BaseTest { * @notice Tests that pledgeAgainstDispute reverts if the timestamp is within the tying buffer and someone attempts * to pledge when the funds are tied, effectively breaking the tie */ - function test_revertIfAttemptToBreakTieDuringTyingBuffer(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_revertIfAttemptToBreakTieDuringTyingBuffer( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { // Set mock request parameters _params.bondSize = 1; _params.maxNumberOfEscalations = 3; @@ -1240,7 +1223,7 @@ contract BondEscalationModule_Unit_PledgeAgainstDispute is BaseTest { _params.tyingBuffer = 1000; mockRequest.disputeModuleData = abi.encode(_params); - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); bytes32 _disputeId = _getId(_dispute); @@ -1259,17 +1242,16 @@ contract BondEscalationModule_Unit_PledgeAgainstDispute is BaseTest { /** * @notice Tests that pledgeAgainstDispute is called successfully */ - function test_successfulCall(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_successfulCall( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.bondSize = 1000; _params.maxNumberOfEscalations = 3; _params.bondEscalationDeadline = block.timestamp - 1; _params.tyingBuffer = 1000; mockRequest.disputeModuleData = abi.encode(_params); - (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); + (, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); bytes32 _disputeId = _getId(_dispute); @@ -1310,7 +1292,7 @@ contract BondEscalationModule_Unit_SettleBondEscalation is BaseTest { */ function test_revertIfInvalidResponseBody() public { // Check: does it revert if the response body is invalid? - vm.expectRevert(IValidator.Validator_InvalidResponseBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidResponseBody.selector); bondEscalationModule.settleBondEscalation(mockRequest, mockResponse, mockDispute); } @@ -1322,7 +1304,7 @@ contract BondEscalationModule_Unit_SettleBondEscalation is BaseTest { mockResponse.requestId = _requestId; // Check: does it revert if the dispute body is invalid? - vm.expectRevert(IValidator.Validator_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); bondEscalationModule.settleBondEscalation(mockRequest, mockResponse, mockDispute); } @@ -1330,17 +1312,14 @@ contract BondEscalationModule_Unit_SettleBondEscalation is BaseTest { * @notice Tests that settleBondEscalation reverts if someone tries to settle the escalation before the tying buffer * has elapsed. */ - function test_revertIfTimestampLessThanEndOfTyingBuffer(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_revertIfTimestampLessThanEndOfTyingBuffer( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.tyingBuffer = bound(_params.tyingBuffer, 0, type(uint128).max); _params.bondEscalationDeadline = block.timestamp; mockRequest.disputeModuleData = abi.encode(_params); (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); - bytes32 _requestId = _getId(mockRequest); - bytes32 _disputeId = _getId(_dispute); // Check: does it revert if the bond escalation is not over? vm.expectRevert(IBondEscalationModule.BondEscalationModule_BondEscalationNotOver.selector); @@ -1351,17 +1330,15 @@ contract BondEscalationModule_Unit_SettleBondEscalation is BaseTest { * @notice Tests that settleBondEscalation reverts if someone tries to settle a bond-escalated dispute that * is not active. */ - function test_revertIfStatusOfBondEscalationIsNotActive(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_revertIfStatusOfBondEscalationIsNotActive( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.bondEscalationDeadline = block.timestamp; _params.tyingBuffer = 1000; mockRequest.disputeModuleData = abi.encode(_params); (IOracle.Response memory _response, IOracle.Dispute memory _dispute) = _getResponseAndDispute(oracle); bytes32 _requestId = _getId(mockRequest); - bytes32 _disputeId = _getId(_dispute); vm.warp(_params.bondEscalationDeadline + _params.tyingBuffer + 1); @@ -1376,10 +1353,9 @@ contract BondEscalationModule_Unit_SettleBondEscalation is BaseTest { * @notice Tests that settleBondEscalation reverts if someone tries to settle a bond-escalated dispute that * has the same number of pledgers. */ - function test_revertIfSameNumberOfPledgers(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_revertIfSameNumberOfPledgers( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.bondEscalationDeadline = block.timestamp; _params.tyingBuffer = 1000; mockRequest.disputeModuleData = abi.encode(_params); @@ -1406,10 +1382,9 @@ contract BondEscalationModule_Unit_SettleBondEscalation is BaseTest { /** * @notice Tests that settleBondEscalation is called successfully. */ - function test_successfulCallDisputerWon(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_successfulCallDisputerWon( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.bondSize = 1000; _params.bondEscalationDeadline = block.timestamp; _params.tyingBuffer = 1000; @@ -1450,10 +1425,9 @@ contract BondEscalationModule_Unit_SettleBondEscalation is BaseTest { /** * @notice Tests that settleBondEscalation is called successfully. */ - function test_successfulCallDisputerLost(IBondEscalationModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_successfulCallDisputerLost( + IBondEscalationModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { _params.bondSize = 1000; _params.bondEscalationDeadline = block.timestamp; _params.tyingBuffer = 1000; diff --git a/solidity/test/unit/modules/dispute/BondedDisputeModule.t.sol b/solidity/test/unit/modules/dispute/BondedDisputeModule.t.sol index 4f663538..5bfdf16a 100644 --- a/solidity/test/unit/modules/dispute/BondedDisputeModule.t.sol +++ b/solidity/test/unit/modules/dispute/BondedDisputeModule.t.sol @@ -5,8 +5,8 @@ import 'forge-std/Test.sol'; import {Helpers} from '../../../utils/Helpers.sol'; -import {IModule} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IModule.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import { @@ -57,7 +57,7 @@ contract BondedDisputeModule_Unit_ModuleData is BaseTest { address _accountingExtension, address _token, uint256 _bondSize - ) public { + ) public view { // Mock data bytes memory _requestData = abi.encode(_accountingExtension, _token, _bondSize); @@ -73,14 +73,14 @@ contract BondedDisputeModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleNameReturnsName() public { + function test_moduleNameReturnsName() public view { assertEq(bondedDisputeModule.moduleName(), 'BondedDisputeModule'); } /** * @notice Test that the validateParameters function correctly checks the parameters */ - function test_validateParameters(IBondedDisputeModule.RequestParameters calldata _params) public { + function test_validateParameters(IBondedDisputeModule.RequestParameters calldata _params) public view { if ( address(_params.accountingExtension) == address(0) || address(_params.bondToken) == address(0) || _params.bondSize == 0 diff --git a/solidity/test/unit/modules/dispute/CircuitResolverModule.t.sol b/solidity/test/unit/modules/dispute/CircuitResolverModule.t.sol index a464dfca..f2ffb6c3 100644 --- a/solidity/test/unit/modules/dispute/CircuitResolverModule.t.sol +++ b/solidity/test/unit/modules/dispute/CircuitResolverModule.t.sol @@ -5,8 +5,8 @@ import 'forge-std/Test.sol'; import {Helpers} from '../../../utils/Helpers.sol'; -import {IModule} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IModule.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import { @@ -80,7 +80,7 @@ contract CircuitResolverModule_Unit_ModuleData is BaseTest { IERC20 _randomToken, uint256 _bondSize, bytes memory _callData - ) public { + ) public view { // Mock data bytes memory _requestData = abi.encode( ICircuitResolverModule.RequestParameters({ @@ -108,14 +108,14 @@ contract CircuitResolverModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleName() public { + function test_moduleName() public view { assertEq(circuitResolverModule.moduleName(), 'CircuitResolverModule'); } /** * @notice Test that the validateParameters function correctly checks the parameters */ - function test_validateParameters(ICircuitResolverModule.RequestParameters calldata _params) public { + function test_validateParameters(ICircuitResolverModule.RequestParameters calldata _params) public view { if ( address(_params.accountingExtension) == address(0) || address(_params.bondToken) == address(0) || _params.bondSize == 0 || !targetHasBytecode(_params.verifier) || _params.callData.length == 0 diff --git a/solidity/test/unit/modules/dispute/RootVerificationModule.t.sol b/solidity/test/unit/modules/dispute/RootVerificationModule.t.sol index f0a51f83..f19d0ce1 100644 --- a/solidity/test/unit/modules/dispute/RootVerificationModule.t.sol +++ b/solidity/test/unit/modules/dispute/RootVerificationModule.t.sol @@ -5,8 +5,8 @@ import 'forge-std/Test.sol'; import {Helpers} from '../../../utils/Helpers.sol'; -import {IModule} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IModule.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import { @@ -101,7 +101,7 @@ contract RootVerificationModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleNameReturnsName() public { + function test_moduleNameReturnsName() public view { assertEq(rootVerificationModule.moduleName(), 'RootVerificationModule'); } @@ -112,7 +112,7 @@ contract RootVerificationModule_Unit_ModuleData is BaseTest { address _accountingExtension, address _randomToken, uint256 _bondSize - ) public { + ) public view { // Mock data bytes memory _requestData = abi.encode( IRootVerificationModule.RequestParameters({ @@ -148,7 +148,7 @@ contract RootVerificationModule_Unit_ModuleData is BaseTest { /** * @notice Test that the validateParameters function correctly checks the parameters */ - function test_validateParameters(IRootVerificationModule.RequestParameters calldata _params) public { + function test_validateParameters(IRootVerificationModule.RequestParameters calldata _params) public view { if ( address(_params.accountingExtension) == address(0) || address(_params.bondToken) == address(0) || address(_params.treeVerifier) == address(0) || _params.bondSize == 0 || _params.treeData.length == 0 diff --git a/solidity/test/unit/modules/finality/CallbackModule.t.sol b/solidity/test/unit/modules/finality/CallbackModule.t.sol index 8654aef3..afa1f96f 100644 --- a/solidity/test/unit/modules/finality/CallbackModule.t.sol +++ b/solidity/test/unit/modules/finality/CallbackModule.t.sol @@ -5,8 +5,8 @@ import 'forge-std/Test.sol'; import {Helpers} from '../../../utils/Helpers.sol'; -import {IModule} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IModule.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {CallbackModule, ICallbackModule} from '../../../../contracts/modules/finality/CallbackModule.sol'; @@ -47,14 +47,14 @@ contract CallbackModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleNameReturnsName() public { + function test_moduleNameReturnsName() public view { assertEq(callbackModule.moduleName(), 'CallbackModule'); } /** * @notice Test that the decodeRequestData function returns the correct values */ - function test_decodeRequestData(address _target, bytes memory _data) public { + function test_decodeRequestData(address _target, bytes memory _data) public view { // Create and set some mock request data bytes memory _requestData = abi.encode(ICallbackModule.RequestParameters({target: _target, data: _data})); @@ -69,7 +69,7 @@ contract CallbackModule_Unit_ModuleData is BaseTest { /** * @notice Test that the validateParameters function correctly checks the parameters */ - function test_validateParameters(ICallbackModule.RequestParameters calldata _params) public { + function test_validateParameters(ICallbackModule.RequestParameters calldata _params) public view { if (address(_params.target) == address(0) || _params.data.length == 0 || !targetHasBytecode(_params.target)) { assertFalse(callbackModule.validateParameters(abi.encode(_params))); } else { diff --git a/solidity/test/unit/modules/finality/MultipleCallbacksModule.t.sol b/solidity/test/unit/modules/finality/MultipleCallbacksModule.t.sol index 21a26a8c..baa8d8af 100644 --- a/solidity/test/unit/modules/finality/MultipleCallbacksModule.t.sol +++ b/solidity/test/unit/modules/finality/MultipleCallbacksModule.t.sol @@ -5,8 +5,8 @@ import 'forge-std/Test.sol'; import {Helpers} from '../../../utils/Helpers.sol'; -import {IModule} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IModule.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import { IMultipleCallbacksModule, @@ -50,14 +50,14 @@ contract MultipleCallbacksModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleNameReturnsName() public { + function test_moduleNameReturnsName() public view { assertEq(multipleCallbackModule.moduleName(), 'MultipleCallbacksModule'); } /** * @notice Test that the validateParameters function correctly checks the parameters */ - function test_validateParameters(IMultipleCallbacksModule.RequestParameters calldata _params) public { + function test_validateParameters(IMultipleCallbacksModule.RequestParameters calldata _params) public view { bool _valid = true; for (uint256 _i; _i < _params.targets.length; ++_i) { if (_params.targets[_i] == address(0) || !targetHasBytecode(_params.targets[_i])) { diff --git a/solidity/test/unit/modules/request/ContractCallRequestModule.t.sol b/solidity/test/unit/modules/request/ContractCallRequestModule.t.sol index 1a0a69b6..b5ff2e3b 100644 --- a/solidity/test/unit/modules/request/ContractCallRequestModule.t.sol +++ b/solidity/test/unit/modules/request/ContractCallRequestModule.t.sol @@ -5,8 +5,8 @@ import 'forge-std/Test.sol'; import {Helpers} from '../../../utils/Helpers.sol'; -import {IModule} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IModule.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import { @@ -55,14 +55,14 @@ contract ContractCallRequestModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleNameReturnsName() public { + function test_moduleNameReturnsName() public view { assertEq(contractCallRequestModule.moduleName(), 'ContractCallRequestModule', 'Wrong module name'); } /** * @notice Test that the decodeRequestData function returns the correct values */ - function test_decodeRequestData(IERC20 _paymentToken, uint256 _paymentAmount) public { + function test_decodeRequestData(IERC20 _paymentToken, uint256 _paymentAmount) public view { bytes memory _requestData = abi.encode( IContractCallRequestModule.RequestParameters({ target: _targetContract, @@ -90,7 +90,7 @@ contract ContractCallRequestModule_Unit_ModuleData is BaseTest { /** * @notice Test that the validateParameters function correctly checks the parameters */ - function test_validateParameters(IContractCallRequestModule.RequestParameters calldata _params) public { + function test_validateParameters(IContractCallRequestModule.RequestParameters calldata _params) public view { if ( address(_params.accountingExtension) == address(0) || address(_params.paymentToken) == address(0) || _params.target == address(0) || _params.paymentAmount == 0 || _params.functionSelector == bytes4(0) diff --git a/solidity/test/unit/modules/request/HttpRequestModule.t.sol b/solidity/test/unit/modules/request/HttpRequestModule.t.sol index 11cc1063..99b325cb 100644 --- a/solidity/test/unit/modules/request/HttpRequestModule.t.sol +++ b/solidity/test/unit/modules/request/HttpRequestModule.t.sol @@ -5,8 +5,8 @@ import 'forge-std/Test.sol'; import {Helpers} from '../../../utils/Helpers.sol'; -import {IModule} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IModule.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {HttpRequestModule, IHttpRequestModule} from '../../../../contracts/modules/request/HttpRequestModule.sol'; @@ -46,14 +46,14 @@ contract HttpRequestModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleNameReturnsName() public { + function test_moduleNameReturnsName() public view { assertEq(httpRequestModule.moduleName(), 'HttpRequestModule'); } /** * @notice Test that the decodeRequestData function returns the correct values */ - function test_decodeRequestData(string memory _url, string memory _body, uint256 _amount, IERC20 _token) public { + function test_decodeRequestData(string memory _url, string memory _body, uint256 _amount, IERC20 _token) public view { bytes memory _requestData = abi.encode( IHttpRequestModule.RequestParameters({ url: _url, @@ -87,7 +87,7 @@ contract HttpRequestModule_Unit_ModuleData is BaseTest { address _accountingExtension, address _paymentToken, uint256 _paymentAmount - ) public { + ) public view { _method = bound(_method, 0, 1); IHttpRequestModule.RequestParameters memory _params = IHttpRequestModule.RequestParameters({ diff --git a/solidity/test/unit/modules/request/SparseMerkleTreeRequestModule.t.sol b/solidity/test/unit/modules/request/SparseMerkleTreeRequestModule.t.sol index d31d6726..92364234 100644 --- a/solidity/test/unit/modules/request/SparseMerkleTreeRequestModule.t.sol +++ b/solidity/test/unit/modules/request/SparseMerkleTreeRequestModule.t.sol @@ -5,8 +5,8 @@ import 'forge-std/Test.sol'; import {Helpers} from '../../../utils/Helpers.sol'; -import {IModule} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IModule.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import { @@ -80,7 +80,7 @@ contract SparseMerkleTreeRequestModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleNameReturnsName() public { + function test_moduleNameReturnsName() public view { assertEq(sparseMerkleTreeRequestModule.moduleName(), 'SparseMerkleTreeRequestModule', 'Wrong module name'); } @@ -92,7 +92,7 @@ contract SparseMerkleTreeRequestModule_Unit_ModuleData is BaseTest { uint256 _paymentAmount, IAccountingExtension _accounting, ITreeVerifier _treeVerifier - ) public { + ) public view { bytes memory _requestData = abi.encode( ISparseMerkleTreeRequestModule.RequestParameters({ treeData: _treeData, @@ -128,7 +128,7 @@ contract SparseMerkleTreeRequestModule_Unit_ModuleData is BaseTest { /** * @notice Test that the validateParameters function correctly checks the parameters */ - function test_validateParameters(ISparseMerkleTreeRequestModule.RequestParameters calldata _params) public { + function test_validateParameters(ISparseMerkleTreeRequestModule.RequestParameters calldata _params) public view { if ( address(_params.accountingExtension) == address(0) || address(_params.paymentToken) == address(0) || address(_params.treeVerifier) == address(0) || _params.paymentAmount == 0 || _params.treeData.length == 0 diff --git a/solidity/test/unit/modules/resolution/ArbitratorModule.t.sol b/solidity/test/unit/modules/resolution/ArbitratorModule.t.sol index 0e4a3f1e..ef030191 100644 --- a/solidity/test/unit/modules/resolution/ArbitratorModule.t.sol +++ b/solidity/test/unit/modules/resolution/ArbitratorModule.t.sol @@ -5,8 +5,8 @@ import 'forge-std/Test.sol'; import {Helpers} from '../../../utils/Helpers.sol'; -import {IModule} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IModule.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import { ArbitratorModule, @@ -58,14 +58,14 @@ contract ArbitratorModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleNameReturnsName() public { + function test_moduleNameReturnsName() public view { assertEq(arbitratorModule.moduleName(), 'ArbitratorModule'); } /** * @notice Test that the decodeRequestData function returns the correct values */ - function test_decodeRequestData(address _arbitrator) public { + function test_decodeRequestData(address _arbitrator) public view { // Mock data bytes memory _requestData = abi.encode(_arbitrator); @@ -93,7 +93,7 @@ contract ArbitratorModule_Unit_ModuleData is BaseTest { /** * @notice Test that the validateParameters function correctly checks the parameters */ - function test_validateParameters(IArbitratorModule.RequestParameters calldata _params) public { + function test_validateParameters(IArbitratorModule.RequestParameters calldata _params) public view { if (_params.arbitrator == address(0)) { assertFalse(arbitratorModule.validateParameters(abi.encode(_params))); } else { diff --git a/solidity/test/unit/modules/resolution/BondEscalationResolutionModule.t.sol b/solidity/test/unit/modules/resolution/BondEscalationResolutionModule.t.sol index 38d693f5..163bbe66 100644 --- a/solidity/test/unit/modules/resolution/BondEscalationResolutionModule.t.sol +++ b/solidity/test/unit/modules/resolution/BondEscalationResolutionModule.t.sol @@ -9,9 +9,9 @@ import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {Strings} from '@openzeppelin/contracts/utils/Strings.sol'; import {FixedPointMathLib} from 'solmate/utils/FixedPointMathLib.sol'; -import {IModule} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IModule.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IValidator} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IValidator.sol'; +import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {ValidatorLib} from '@defi-wonderland/prophet-core/solidity/libraries/ValidatorLib.sol'; import { BondEscalationResolutionModule, @@ -149,10 +149,9 @@ contract BaseTest is Test, Helpers { return (_pledgers, _pledgedAmounts); } - function _setResolutionModuleData(IBondEscalationResolutionModule.RequestParameters memory _params) - internal - returns (bytes32 _requestId, bytes32 _responseId, bytes32 _disputeId) - { + function _setResolutionModuleData( + IBondEscalationResolutionModule.RequestParameters memory _params + ) internal returns (bytes32 _requestId, bytes32 _responseId, bytes32 _disputeId) { mockRequest.resolutionModuleData = abi.encode(_params); _requestId = _getId(mockRequest); @@ -166,8 +165,11 @@ contract BaseTest is Test, Helpers { vm.mockCall(address(oracle), abi.encodeCall(IOracle.disputeCreatedAt, (_disputeId)), abi.encode(block.timestamp)); } - function _getRequestResponseDispute(IBondEscalationResolutionModule.RequestParameters memory _params) + function _getRequestResponseDispute( + IBondEscalationResolutionModule.RequestParameters memory _params + ) internal + view returns (IOracle.Request memory _request, IOracle.Response memory _response, IOracle.Dispute memory _dispute) { _request = mockRequest; @@ -183,7 +185,7 @@ contract BondEscalationResolutionModule_Unit_ModuleData is BaseTest { uint256 _pledgeThreshold, uint256 _timeUntilDeadline, uint256 _timeToBreakInequality - ) public { + ) public view { // Storing fuzzed data bytes memory _data = abi.encode(accounting, token, _percentageDiff, _pledgeThreshold, _timeUntilDeadline, _timeToBreakInequality); @@ -201,14 +203,14 @@ contract BondEscalationResolutionModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleName() public { + function test_moduleName() public view { assertEq(module.moduleName(), 'BondEscalationResolutionModule'); } /** * @notice Test that the validateParameters function correctly checks the parameters */ - function test_validateParameters(IBondEscalationResolutionModule.RequestParameters calldata _params) public { + function test_validateParameters(IBondEscalationResolutionModule.RequestParameters calldata _params) public view { if ( address(_params.accountingExtension) == address(0) || address(_params.bondToken) == address(0) || _params.percentageDiff == 0 || _params.pledgeThreshold == 0 || _params.timeUntilDeadline == 0 @@ -270,7 +272,7 @@ contract BondEscalationResolutionModule_Unit_PledgeForDispute is BaseTest { ) public assumeFuzzable(address(_params.accountingExtension)) { // Check: does it revert if the dispute body is invalid? mockDispute.requestId = bytes32(0); - vm.expectRevert(IValidator.Validator_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); module.pledgeForDispute(mockRequest, mockDispute, _pledgeAmount); // 1. BondEscalationResolutionModule_NotEscalated @@ -556,7 +558,7 @@ contract BondEscalationResolutionModule_Unit_PledgeAgainstDispute is BaseTest { ) public assumeFuzzable(address(_params.accountingExtension)) { // Check: does it revert if the dispute body is invalid? mockDispute.requestId = bytes32(0); - vm.expectRevert(IValidator.Validator_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); module.pledgeAgainstDispute(mockRequest, mockDispute, _pledgeAmount); // 1. BondEscalationResolutionModule_NotEscalated @@ -835,10 +837,9 @@ contract BondEscalationResolutionModule_Unit_ResolveDispute is BaseTest { the disputer. */ - function test_resolveDisputeReverts(IBondEscalationResolutionModule.RequestParameters memory _params) - public - assumeFuzzable(address(_params.accountingExtension)) - { + function test_resolveDisputeReverts( + IBondEscalationResolutionModule.RequestParameters memory _params + ) public assumeFuzzable(address(_params.accountingExtension)) { // 1. BondEscalationResolutionModule_AlreadyResolved (bytes32 _requestId, bytes32 _responseId, bytes32 _disputeId) = _setResolutionModuleData(_params); @@ -1030,7 +1031,7 @@ contract BondEscalationResolutionModule_Unit_ClaimPledge is BaseTest { ) public assumeFuzzable(address(_params.accountingExtension)) { // Check: does it revert if the dispute body is invalid? mockDispute.requestId = bytes32(0); - vm.expectRevert(IValidator.Validator_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); module.claimPledge(mockRequest, mockDispute); (,, bytes32 _disputeId) = _setResolutionModuleData(_params); diff --git a/solidity/test/unit/modules/resolution/ERC20ResolutionModule.t.sol b/solidity/test/unit/modules/resolution/ERC20ResolutionModule.t.sol index 7eb76aea..1ea5bba7 100644 --- a/solidity/test/unit/modules/resolution/ERC20ResolutionModule.t.sol +++ b/solidity/test/unit/modules/resolution/ERC20ResolutionModule.t.sol @@ -8,9 +8,9 @@ import {Helpers} from '../../../utils/Helpers.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; -import {IModule} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IModule.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IValidator} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IValidator.sol'; +import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {ValidatorLib} from '@defi-wonderland/prophet-core/solidity/libraries/ValidatorLib.sol'; import { ERC20ResolutionModule, @@ -82,7 +82,7 @@ contract ERC20ResolutionModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleName() public { + function test_moduleName() public view { assertEq(module.moduleName(), 'ERC20ResolutionModule'); } @@ -93,7 +93,7 @@ contract ERC20ResolutionModule_Unit_ModuleData is BaseTest { address _token, uint256 _minVotesForQuorum, uint256 _votingTimeWindow - ) public { + ) public view { // Mock data bytes memory _requestData = abi.encode(address(accountingExtension), _token, _minVotesForQuorum, _votingTimeWindow); @@ -110,7 +110,7 @@ contract ERC20ResolutionModule_Unit_ModuleData is BaseTest { /** * @notice Test that the validateParameters function correctly checks the parameters */ - function test_validateParameters(IERC20ResolutionModule.RequestParameters calldata _params) public { + function test_validateParameters(IERC20ResolutionModule.RequestParameters calldata _params) public view { if ( address(_params.accountingExtension) == address(0) || address(_params.votingToken) == address(0) || _params.minVotesForQuorum == 0 || _params.timeUntilDeadline == 0 @@ -168,7 +168,6 @@ contract ERC20ResolutionModule_Unit_CastVote is BaseTest { ); // Compute proper IDs - bytes32 _requestId = _getId(mockRequest); IOracle.Response memory _response = _getResponse(mockRequest, proposer); IOracle.Dispute memory _dispute = _getDispute(mockRequest, _response); bytes32 _disputeId = _getId(_dispute); @@ -216,7 +215,7 @@ contract ERC20ResolutionModule_Unit_CastVote is BaseTest { function test_revertIfInvalidDisputeBody(uint256 _numberOfVotes) public { // Check: does it revert if the dispute body is invalid? mockDispute.requestId = bytes32(0); - vm.expectRevert(IValidator.Validator_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); module.castVote(mockRequest, mockDispute, _numberOfVotes); } @@ -225,7 +224,6 @@ contract ERC20ResolutionModule_Unit_CastVote is BaseTest { */ function test_revertIfNotEscalated(uint256 _numberOfVotes) public { // Compute proper IDs - bytes32 _requestId = _getId(mockRequest); IOracle.Response memory _response = _getResponse(mockRequest, proposer); IOracle.Dispute memory _dispute = _getDispute(mockRequest, _response); bytes32 _disputeId = _getId(_dispute); @@ -252,7 +250,6 @@ contract ERC20ResolutionModule_Unit_CastVote is BaseTest { ); // Compute proper IDs - bytes32 _requestId = _getId(mockRequest); IOracle.Response memory _response = _getResponse(mockRequest, proposer); IOracle.Dispute memory _dispute = _getDispute(mockRequest, _response); bytes32 _disputeId = _getId(_dispute); @@ -288,7 +285,6 @@ contract ERC20ResolutionModule_Unit_CastVote is BaseTest { ); // Compute proper IDs - bytes32 _requestId = _getId(mockRequest); IOracle.Response memory _response = _getResponse(mockRequest, proposer); IOracle.Dispute memory _dispute = _getDispute(mockRequest, _response); bytes32 _disputeId = _getId(_dispute); @@ -420,7 +416,7 @@ contract ERC20ResolutionModule_Unit_ClaimVote is BaseTest { function test_revertIfInvalidDisputeBody() public { // Check: does it revert if the dispute body is invalid? mockDispute.requestId = bytes32(0); - vm.expectRevert(IValidator.Validator_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); module.claimVote(mockRequest, mockDispute); } @@ -438,7 +434,6 @@ contract ERC20ResolutionModule_Unit_ClaimVote is BaseTest { ); // Compute proper IDs - bytes32 _requestId = _getId(mockRequest); IOracle.Response memory _response = _getResponse(mockRequest, proposer); IOracle.Dispute memory _dispute = _getDispute(mockRequest, _response); bytes32 _disputeId = _getId(_dispute); @@ -469,7 +464,6 @@ contract ERC20ResolutionModule_Unit_ClaimVote is BaseTest { ); // Compute proper IDs - bytes32 _requestId = _getId(mockRequest); IOracle.Response memory _response = _getResponse(mockRequest, proposer); IOracle.Dispute memory _dispute = _getDispute(mockRequest, _response); bytes32 _disputeId = _getId(_dispute); diff --git a/solidity/test/unit/modules/resolution/PrivateERC20ResolutionModule.t.sol b/solidity/test/unit/modules/resolution/PrivateERC20ResolutionModule.t.sol index 5b4d6264..09cb0530 100644 --- a/solidity/test/unit/modules/resolution/PrivateERC20ResolutionModule.t.sol +++ b/solidity/test/unit/modules/resolution/PrivateERC20ResolutionModule.t.sol @@ -5,9 +5,10 @@ import 'forge-std/Test.sol'; import {Helpers} from '../../../utils/Helpers.sol'; -import {IModule} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IModule.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; -import {IValidator} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IValidator.sol'; +import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; +import {IValidator} from '@defi-wonderland/prophet-core/solidity/interfaces/IValidator.sol'; +import {ValidatorLib} from '@defi-wonderland/prophet-core/solidity/libraries/ValidatorLib.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import { @@ -115,14 +116,14 @@ contract PrivateERC20ResolutionModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleName() public { + function test_moduleName() public view { assertEq(module.moduleName(), 'PrivateERC20ResolutionModule'); } /** * @notice Test that the validateParameters function correctly checks the parameters */ - function test_validateParameters(IPrivateERC20ResolutionModule.RequestParameters calldata _params) public { + function test_validateParameters(IPrivateERC20ResolutionModule.RequestParameters calldata _params) public view { if ( address(_params.accountingExtension) == address(0) || address(_params.votingToken) == address(0) || _params.minVotesForQuorum == 0 || _params.committingTimeWindow == 0 || _params.revealingTimeWindow == 0 @@ -232,7 +233,7 @@ contract PrivateERC20ResolutionModule_Unit_CommitVote is BaseTest { function test_revertIfInvalidDisputeBody(bytes32 _commitment) public { // Check: does it revert if the dispute body is invalid? mockDispute.requestId = bytes32(0); - vm.expectRevert(IValidator.Validator_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); module.commitVote(mockRequest, mockDispute, _commitment); } @@ -241,7 +242,6 @@ contract PrivateERC20ResolutionModule_Unit_CommitVote is BaseTest { */ function test_revertIfNonExistentDispute(bytes32 _commitment) public { // Compute proper IDs - bytes32 _requestId = _getId(mockRequest); IOracle.Response memory _response = _getResponse(mockRequest, proposer); IOracle.Dispute memory _dispute = _getDispute(mockRequest, _response); bytes32 _disputeId = _getId(_dispute); @@ -345,7 +345,6 @@ contract PrivateERC20ResolutionModule_Unit_CommitVote is BaseTest { */ function test_revertIfNotEscalated(bytes32 _commitment) public { // Compute proper IDs - bytes32 _requestId = _getId(mockRequest); IOracle.Response memory _response = _getResponse(mockRequest, proposer); IOracle.Dispute memory _dispute = _getDispute(mockRequest, _response); bytes32 _disputeId = _getId(_dispute); @@ -420,7 +419,6 @@ contract PrivateERC20ResolutionModule_Unit_RevealVote is BaseTest { ); // Compute proper IDs - bytes32 _requestId = _getId(mockRequest); IOracle.Response memory _response = _getResponse(mockRequest, proposer); IOracle.Dispute memory _dispute = _getDispute(mockRequest, _response); bytes32 _disputeId = _getId(_dispute); @@ -468,7 +466,7 @@ contract PrivateERC20ResolutionModule_Unit_RevealVote is BaseTest { function test_revertIfInvalidDisputeBody(uint256 _numberOfVotes, bytes32 _salt) public { // Check: does it revert if the dispute body is invalid? mockDispute.requestId = bytes32(0); - vm.expectRevert(IValidator.Validator_InvalidDisputeBody.selector); + vm.expectRevert(ValidatorLib.ValidatorLib_InvalidDisputeBody.selector); module.revealVote(mockRequest, mockDispute, _numberOfVotes, _salt); } @@ -477,7 +475,6 @@ contract PrivateERC20ResolutionModule_Unit_RevealVote is BaseTest { */ function test_revertIfNotEscalated(uint256 _numberOfVotes, bytes32 _salt) public { // Compute proper IDs - bytes32 _requestId = _getId(mockRequest); IOracle.Response memory _response = _getResponse(mockRequest, proposer); IOracle.Dispute memory _dispute = _getDispute(mockRequest, _response); bytes32 _disputeId = _getId(_dispute); @@ -508,7 +505,6 @@ contract PrivateERC20ResolutionModule_Unit_RevealVote is BaseTest { ); // Compute proper IDs - bytes32 _requestId = _getId(mockRequest); IOracle.Response memory _response = _getResponse(mockRequest, proposer); IOracle.Dispute memory _dispute = _getDispute(mockRequest, _response); bytes32 _disputeId = _getId(_dispute); @@ -559,7 +555,6 @@ contract PrivateERC20ResolutionModule_Unit_RevealVote is BaseTest { ); // Compute proper IDs - bytes32 _requestId = _getId(mockRequest); IOracle.Response memory _response = _getResponse(mockRequest, proposer); IOracle.Dispute memory _dispute = _getDispute(mockRequest, _response); bytes32 _disputeId = _getId(_dispute); diff --git a/solidity/test/unit/modules/response/BondedResponseModule.t.sol b/solidity/test/unit/modules/response/BondedResponseModule.t.sol index bb299960..ca7b7387 100644 --- a/solidity/test/unit/modules/response/BondedResponseModule.t.sol +++ b/solidity/test/unit/modules/response/BondedResponseModule.t.sol @@ -51,14 +51,19 @@ contract BondedResponseModule_Unit_ModuleData is BaseTest { /** * @notice Test that the moduleName function returns the correct name */ - function test_moduleNameReturnsName() public { + function test_moduleNameReturnsName() public view { assertEq(bondedResponseModule.moduleName(), 'BondedResponseModule'); } /** * @notice Test that the decodeRequestData function returns the correct values */ - function test_decodeRequestData(IERC20 _token, uint256 _bondSize, uint256 _deadline, uint256 _disputeWindow) public { + function test_decodeRequestData( + IERC20 _token, + uint256 _bondSize, + uint256 _deadline, + uint256 _disputeWindow + ) public view { // Create and set some mock request data bytes memory _data = abi.encode(accounting, _token, _bondSize, _deadline, _disputeWindow); @@ -76,7 +81,7 @@ contract BondedResponseModule_Unit_ModuleData is BaseTest { /** * @notice Test that the validateParameters function correctly checks the parameters */ - function test_validateParameters(IBondedResponseModule.RequestParameters calldata _params) public { + function test_validateParameters(IBondedResponseModule.RequestParameters calldata _params) public view { if ( address(_params.accountingExtension) == address(0) || address(_params.bondToken) == address(0) || _params.bondSize == 0 || _params.disputeWindow == 0 || _params.deadline == 0 diff --git a/solidity/test/utils/Helpers.sol b/solidity/test/utils/Helpers.sol index 993d8aac..0e12e549 100644 --- a/solidity/test/utils/Helpers.sol +++ b/solidity/test/utils/Helpers.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.19; import {TestConstants} from './TestConstants.sol'; -import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol'; +import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol'; import {DSTestPlus} from '@defi-wonderland/solidity-utils/solidity/test/DSTestPlus.sol'; contract Helpers is DSTestPlus, TestConstants { @@ -25,17 +25,17 @@ contract Helpers is DSTestPlus, TestConstants { requester: address(this), nonce: 1 }); - bytes32 _mockRequestId = keccak256(abi.encode(mockRequest)); + bytes32 internal _mockRequestId = keccak256(abi.encode(mockRequest)); IOracle.Response public mockResponse = IOracle.Response({proposer: proposer, requestId: _mockRequestId, response: bytes('')}); - bytes32 _mockResponseId = keccak256(abi.encode(mockResponse)); + bytes32 internal _mockResponseId = keccak256(abi.encode(mockResponse)); IOracle.Dispute public mockDispute = IOracle.Dispute({disputer: disputer, responseId: _mockResponseId, proposer: proposer, requestId: _mockRequestId}); - bytes32 _mockDisputeId = keccak256(abi.encode(mockDispute)); + bytes32 internal _mockDisputeId = keccak256(abi.encode(mockDispute)); // Shared events that all modules emit event RequestFinalized(bytes32 indexed _requestId, IOracle.Response _response, address _finalizer); @@ -64,10 +64,9 @@ contract Helpers is DSTestPlus, TestConstants { }); } - function _getResponseAndDispute(IOracle _oracle) - internal - returns (IOracle.Response memory _response, IOracle.Dispute memory _dispute) - { + function _getResponseAndDispute( + IOracle _oracle + ) internal returns (IOracle.Response memory _response, IOracle.Dispute memory _dispute) { // Compute proper IDs _response = _getResponse(mockRequest, proposer); _dispute = _getDispute(mockRequest, _response); diff --git a/yarn.lock b/yarn.lock index 68ccce90..9799278c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -193,10 +193,10 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@defi-wonderland/prophet-core-contracts@0.0.0-d01bc1a0": - version "0.0.0-d01bc1a0" - resolved "https://registry.yarnpkg.com/@defi-wonderland/prophet-core-contracts/-/prophet-core-contracts-0.0.0-d01bc1a0.tgz#ee4e8d970289a26966f6565b2f691d68d7b4232a" - integrity sha512-n4Dl1QgQAZafOtV7ef/fSoew2qlxWSdS389Z6PdIn7LxrHrzzRJi+nmJ1DJazMvMuhk/0dZbMhnaXMBi05E1zQ== +"@defi-wonderland/prophet-core@0.0.0-2e39539b": + version "0.0.0-2e39539b" + resolved "https://registry.yarnpkg.com/@defi-wonderland/prophet-core/-/prophet-core-0.0.0-2e39539b.tgz#dbf01ed05a9af302841123c77e84bc0b3b4a6176" + integrity sha512-EdYpDEO1XeO08uQikhOQ6NzG0LWYxANFk272j4vCyLSJ8kRyJNMv69JJCLcq5kV0B9IzXybmqjreemkZ05z3kQ== "@defi-wonderland/solidity-utils@0.0.0-3e9c8e8b": version "0.0.0-3e9c8e8b"