-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lint: Ignore solhint issues for mock contracts
Most of these issues are intentional and are okay to ignore. This also sets the solhint ignoreConstructors option to true for the func-visibility rule, as we are using solidity >=0.7.0
- Loading branch information
Showing
3 changed files
with
25 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"extends": "solhint:recommended" | ||
"extends": "solhint:recommended", | ||
"rules": { | ||
"func-visibility": ["warn", { "ignoreConstructors": true }] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,38 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import "./ABI_BasicTests.sol"; | ||
import "./ABI_BasicTests.sol" as ABI_BasicTests; | ||
|
||
// | ||
// Disabled contract that is payable and callable with any calldata (receive + fallback) | ||
// | ||
contract NoopDisabledMock is NoopReceivePayableFallback{ | ||
contract NoopDisabledMock is ABI_BasicTests.NoopReceivePayableFallback { | ||
// solc-ignore-next-line func-mutability | ||
function noopNonpayable() external { | ||
mockRevert(); | ||
mockRevert(); | ||
} | ||
function noopPayable() external payable { | ||
mockRevert(); | ||
mockRevert(); | ||
} | ||
// solc-ignore-next-line func-mutability | ||
function noopView() external view { | ||
mockRevert(); | ||
mockRevert(); | ||
} | ||
function noopPure() external pure { | ||
mockRevert(); | ||
mockRevert(); | ||
} | ||
receive() external payable { | ||
mockRevert(); | ||
mockRevert(); | ||
} | ||
fallback() external payable { | ||
mockRevert(); | ||
mockRevert(); | ||
} | ||
|
||
// | ||
// Mimic revert + revert reason | ||
// | ||
function mockRevert() private pure { | ||
revert("call not allowed to disabled contract"); | ||
// solhint-disable-next-line reason-string, gas-custom-errors | ||
revert("call not allowed to disabled contract"); | ||
} | ||
} |