Skip to content

Commit

Permalink
apply changes to IERC20.sol + minor renaming in ERC20.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Feb 7, 2022
1 parent 7003838 commit 2e35d34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions contracts/token/ERC20/ERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ contract ERC20 is Context, IERC20, IERC20Metadata {
address to,
uint256 amount
) public virtual override returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = _allowances[from][owner];
address spender = _msgSender();
uint256 currentAllowance = allowance(from, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(from, owner, currentAllowance - amount);
_approve(from, spender, currentAllowance - amount);
}
}

Expand Down
10 changes: 5 additions & 5 deletions contracts/token/ERC20/IERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ interface IERC20 {
function balanceOf(address account) external view returns (uint256);

/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
function transfer(address to, uint256 amount) external returns (bool);

/**
* @dev Returns the remaining number of tokens that `spender` will be
Expand Down Expand Up @@ -52,7 +52,7 @@ interface IERC20 {
function approve(address spender, uint256 amount) external returns (bool);

/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
Expand All @@ -61,8 +61,8 @@ interface IERC20 {
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
address from,
address to,
uint256 amount
) external returns (bool);

Expand Down

0 comments on commit 2e35d34

Please sign in to comment.