-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forbid most uses of
msg.sender
in favor of _msgSender()
- Loading branch information
Showing
4 changed files
with
21 additions
and
12 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,16 +1,24 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.21; | ||
|
||
abstract contract Context { | ||
function _msgSender() internal view virtual returns (address) { | ||
abstract contract ContextAbstract { | ||
function _msgSender() internal view virtual returns (address); | ||
|
||
function _msgData() internal view virtual returns (bytes calldata); | ||
|
||
function _isForwarded() internal view virtual returns (bool); | ||
} | ||
|
||
abstract contract Context is ContextAbstract { | ||
function _msgSender() internal view virtual override returns (address) { | ||
return msg.sender; | ||
} | ||
|
||
function _msgData() internal view virtual returns (bytes calldata) { | ||
function _msgData() internal view virtual override returns (bytes calldata) { | ||
return msg.data; | ||
} | ||
|
||
function _isForwarded() internal view virtual returns (bool) { | ||
function _isForwarded() internal view virtual override returns (bool) { | ||
return false; | ||
} | ||
} |
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
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