Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: capitalize immutable variables #700

Merged
merged 2 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"contract-name-camelcase": "off",
"const-name-snakecase": "off",
"custom-errors": "off",
"immutable-vars-naming": "off",
"func-name-mixedcase": "off",
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 123],
Expand Down
8 changes: 4 additions & 4 deletions src/abstracts/NoDelegateCall.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { Errors } from "../libraries/Errors.sol";
/// @notice This contract implements logic to prevent delegate calls.
abstract contract NoDelegateCall {
/// @dev The address of the original contract that was deployed.
address private immutable _original;
address private immutable ORIGINAL;

/// @dev Sets the original contract address.
constructor() {
_original = address(this);
ORIGINAL = address(this);
}

/// @notice Prevents delegate calls.
Expand All @@ -23,11 +23,11 @@ abstract contract NoDelegateCall {
/// @dev This function checks whether the current call is a delegate call, and reverts if it is.
///
/// - A private function is used instead of inlining this logic in a modifier because Solidity copies modifiers into
/// every function that uses them. The `_original` address would get copied in every place the modifier is used,
/// every function that uses them. The `ORIGINAL` address would get copied in every place the modifier is used,
/// which would increase the contract size. By using a function instead, we can avoid this duplication of code
/// and reduce the overall size of the contract.
function _preventDelegateCall() private view {
if (address(this) != _original) {
if (address(this) != ORIGINAL) {
revert Errors.DelegateCall();
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/fork/Fork.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ abstract contract Fork_Test is Base_Test {
CONSTANTS
//////////////////////////////////////////////////////////////////////////*/

IERC20 internal immutable asset;
address internal immutable holder;
IERC20 internal asset;
address internal holder;
andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved

/*//////////////////////////////////////////////////////////////////////////
VARIABLES
Expand Down