Skip to content

Commit ab8ecd3

Browse files
committed
Make proper use of the term spender...
... in ERC20WithPermit. Closes #15
1 parent c315b9d commit ab8ecd3

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

contracts/token/ERC20WithPermit.sol

+15-15
Original file line numberDiff line numberDiff line change
@@ -73,29 +73,29 @@ contract ERC20WithPermit is IERC20WithPermit, Ownable {
7373
return true;
7474
}
7575

76-
/// @notice Moves `amount` tokens from `spender` to `recipient` using the
76+
/// @notice Moves `amount` tokens from `owner` to `recipient` using the
7777
/// allowance mechanism. `amount` is then deducted from the caller's
7878
/// allowance unless the allowance was made for `type(uint256).max`.
7979
/// @return True if the operation succeeded, reverts otherwise.
8080
/// @dev Requirements:
81-
/// - `spender` and `recipient` cannot be the zero address,
82-
/// - `spender` must have a balance of at least `amount`,
83-
/// - the caller must have allowance for `spender`'s tokens of at least
81+
/// - `owner` and `recipient` cannot be the zero address,
82+
/// - `owner` must have a balance of at least `amount`,
83+
/// - the caller must have allowance for `owner`'s tokens of at least
8484
/// `amount`.
8585
function transferFrom(
86-
address spender,
86+
address owner,
8787
address recipient,
8888
uint256 amount
8989
) external override returns (bool) {
90-
uint256 currentAllowance = allowance[spender][msg.sender];
90+
uint256 currentAllowance = allowance[owner][msg.sender];
9191
if (currentAllowance != type(uint256).max) {
9292
require(
9393
currentAllowance >= amount,
9494
"Transfer amount exceeds allowance"
9595
);
96-
_approve(spender, msg.sender, currentAllowance - amount);
96+
_approve(owner, msg.sender, currentAllowance - amount);
9797
}
98-
_transfer(spender, recipient, amount);
98+
_transfer(owner, recipient, amount);
9999
return true;
100100
}
101101

@@ -289,21 +289,21 @@ contract ERC20WithPermit is IERC20WithPermit, Ownable {
289289
}
290290

291291
function _transfer(
292-
address spender,
292+
address owner,
293293
address recipient,
294294
uint256 amount
295295
) private {
296-
require(spender != address(0), "Transfer from the zero address");
296+
require(owner != address(0), "Transfer from the zero address");
297297
require(recipient != address(0), "Transfer to the zero address");
298298
require(recipient != address(this), "Transfer to the token address");
299299

300-
beforeTokenTransfer(spender, recipient, amount);
300+
beforeTokenTransfer(owner, recipient, amount);
301301

302-
uint256 spenderBalance = balanceOf[spender];
303-
require(spenderBalance >= amount, "Transfer amount exceeds balance");
304-
balanceOf[spender] = spenderBalance - amount;
302+
uint256 ownerBalance = balanceOf[owner];
303+
require(ownerBalance >= amount, "Transfer amount exceeds balance");
304+
balanceOf[owner] = ownerBalance - amount;
305305
balanceOf[recipient] += amount;
306-
emit Transfer(spender, recipient, amount);
306+
emit Transfer(owner, recipient, amount);
307307
}
308308

309309
function _approve(

0 commit comments

Comments
 (0)