In the functions MidasAccessControl::grantRoleMult, MidasAccessControl::revokeRoleMult, and MidasAccessControl::_setupRoles, the variable sender is redundantly defined as address sender = msg.sender;. This redundancy can be removed by directly using msg.sender instead.
Vulnerability Detail
The functions grantRoleMult, revokeRoleMult, and _setupRoles in the MidasAccessControl contract unnecessarily define a local variable sender to hold the value of msg.sender. This redundant declaration does not provide any benefit and can be avoided by using msg.sender directly in the code.
Unneeded Variable Sender
Low/Info issue submitted by petarP1998
Summary
In the functions
MidasAccessControl::grantRoleMult
,MidasAccessControl::revokeRoleMult
, andMidasAccessControl::_setupRoles
, the variablesender
is redundantly defined asaddress sender = msg.sender;
. This redundancy can be removed by directly usingmsg.sender
instead.Vulnerability Detail
The functions
grantRoleMult
,revokeRoleMult
, and_setupRoles
in theMidasAccessControl
contract unnecessarily define a local variablesender
to hold the value ofmsg.sender
. This redundant declaration does not provide any benefit and can be avoided by usingmsg.sender
directly in the code.https://github.com/sherlock-audit/2024-05-midas/blob/main/midas-contracts/contracts/access/MidasAccessControl.sol#L34-L44
Impact
Code Snippet
Tool used
Manual Review
Recommendation
Refactor the code to remove the unnecessary
sender
variable and usemsg.sender
directly to simplify and improve code readability and maintainability.