diff --git a/contracts/mocks/tokens/MintableERC20.sol b/contracts/mocks/tokens/MintableERC20.sol index 394bcde2d..2c79d9713 100644 --- a/contracts/mocks/tokens/MintableERC20.sol +++ b/contracts/mocks/tokens/MintableERC20.sol @@ -22,7 +22,7 @@ contract MintableERC20 is ERC20 { * @return A boolean that indicates if the operation was successful. */ function mint(uint256 value) public returns (bool) { - _mint(msg.sender, value); + _mint(_msgSender(), value); return true; } } diff --git a/contracts/tokenization/AToken.sol b/contracts/tokenization/AToken.sol index bee1184db..5641ebf82 100644 --- a/contracts/tokenization/AToken.sol +++ b/contracts/tokenization/AToken.sol @@ -40,7 +40,7 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken { bytes32 public DOMAIN_SEPARATOR; modifier onlyLendingPool { - require(msg.sender == address(POOL), Errors.CALLER_MUST_BE_LENDING_POOL); + require(_msgSender() == address(POOL), Errors.CALLER_MUST_BE_LENDING_POOL); _; } @@ -108,7 +108,7 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken { //transfer event to track balances emit Transfer(user, address(0), amount); - emit Burn(msg.sender, receiverOfUnderlying, amount, index); + emit Burn(_msgSender(), receiverOfUnderlying, amount, index); } /** diff --git a/contracts/tokenization/IncentivizedERC20.sol b/contracts/tokenization/IncentivizedERC20.sol index 771a8202e..68b470df5 100644 --- a/contracts/tokenization/IncentivizedERC20.sol +++ b/contracts/tokenization/IncentivizedERC20.sol @@ -73,14 +73,14 @@ contract IncentivizedERC20 is Context, IERC20, IERC20Detailed { } /** - * @dev executes a transfer of tokens from msg.sender to recipient + * @dev executes a transfer of tokens from _msgSender() to recipient * @param recipient the recipient of the tokens * @param amount the amount of tokens being transferred * @return true if the transfer succeeds, false otherwise **/ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); - emit Transfer(msg.sender, recipient, amount); + emit Transfer(_msgSender(), recipient, amount); return true; } @@ -101,8 +101,8 @@ contract IncentivizedERC20 is Context, IERC20, IERC20Detailed { } /** - * @dev allows spender to spend the tokens owned by msg.sender - * @param spender the user allowed to spend msg.sender tokens + * @dev allows spender to spend the tokens owned by _msgSender() + * @param spender the user allowed to spend _msgSender() tokens * @return true **/ function approve(address spender, uint256 amount) public virtual override returns (bool) { @@ -111,7 +111,7 @@ contract IncentivizedERC20 is Context, IERC20, IERC20Detailed { } /** - * @dev executes a transfer of token from sender to recipient, if msg.sender is allowed to do so + * @dev executes a transfer of token from sender to recipient, if _msgSender() is allowed to do so * @param sender the owner of the tokens * @param recipient the recipient of the tokens * @param amount the amount of tokens being transferred @@ -133,8 +133,8 @@ contract IncentivizedERC20 is Context, IERC20, IERC20Detailed { } /** - * @dev increases the allowance of spender to spend msg.sender tokens - * @param spender the user allowed to spend on behalf of msg.sender + * @dev increases the allowance of spender to spend _msgSender() tokens + * @param spender the user allowed to spend on behalf of _msgSender() * @param addedValue the amount being added to the allowance * @return true **/ @@ -144,8 +144,8 @@ contract IncentivizedERC20 is Context, IERC20, IERC20Detailed { } /** - * @dev decreases the allowance of spender to spend msg.sender tokens - * @param spender the user allowed to spend on behalf of msg.sender + * @dev decreases the allowance of spender to spend _msgSender() tokens + * @param spender the user allowed to spend on behalf of _msgSender() * @param subtractedValue the amount being subtracted to the allowance * @return true **/ diff --git a/contracts/tokenization/base/DebtTokenBase.sol b/contracts/tokenization/base/DebtTokenBase.sol index fc43e770c..0dddb431e 100644 --- a/contracts/tokenization/base/DebtTokenBase.sol +++ b/contracts/tokenization/base/DebtTokenBase.sol @@ -23,7 +23,7 @@ abstract contract DebtTokenBase is IncentivizedERC20, VersionedInitializable { * @dev Only lending pool can call functions marked by this modifier **/ modifier onlyLendingPool { - require(msg.sender == address(POOL), Errors.CALLER_MUST_BE_LENDING_POOL); + require(_msgSender() == address(POOL), Errors.CALLER_MUST_BE_LENDING_POOL); _; }