Improve parameters naming and remove unecessary returns (#2891)
This commit is contained in:
@ -249,32 +249,32 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Creates `amount` tokens of token type `id`, and assigns them to `account`.
|
||||
* @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
|
||||
*
|
||||
* Emits a {TransferSingle} event.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - `account` cannot be the zero address.
|
||||
* - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
|
||||
* - `to` cannot be the zero address.
|
||||
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
|
||||
* acceptance magic value.
|
||||
*/
|
||||
function _mint(
|
||||
address account,
|
||||
address to,
|
||||
uint256 id,
|
||||
uint256 amount,
|
||||
bytes memory data
|
||||
) internal virtual {
|
||||
require(account != address(0), "ERC1155: mint to the zero address");
|
||||
require(to != address(0), "ERC1155: mint to the zero address");
|
||||
|
||||
address operator = _msgSender();
|
||||
|
||||
_beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);
|
||||
_beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);
|
||||
|
||||
_balances[id][account] += amount;
|
||||
emit TransferSingle(operator, address(0), account, id, amount);
|
||||
_balances[id][to] += amount;
|
||||
emit TransferSingle(operator, address(0), to, id, amount);
|
||||
|
||||
_doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data);
|
||||
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -309,31 +309,31 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Destroys `amount` tokens of token type `id` from `account`
|
||||
* @dev Destroys `amount` tokens of token type `id` from `from`
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - `account` cannot be the zero address.
|
||||
* - `account` must have at least `amount` tokens of token type `id`.
|
||||
* - `from` cannot be the zero address.
|
||||
* - `from` must have at least `amount` tokens of token type `id`.
|
||||
*/
|
||||
function _burn(
|
||||
address account,
|
||||
address from,
|
||||
uint256 id,
|
||||
uint256 amount
|
||||
) internal virtual {
|
||||
require(account != address(0), "ERC1155: burn from the zero address");
|
||||
require(from != address(0), "ERC1155: burn from the zero address");
|
||||
|
||||
address operator = _msgSender();
|
||||
|
||||
_beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");
|
||||
_beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");
|
||||
|
||||
uint256 accountBalance = _balances[id][account];
|
||||
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
|
||||
uint256 fromBalance = _balances[id][from];
|
||||
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
|
||||
unchecked {
|
||||
_balances[id][account] = accountBalance - amount;
|
||||
_balances[id][from] = fromBalance - amount;
|
||||
}
|
||||
|
||||
emit TransferSingle(operator, account, address(0), id, amount);
|
||||
emit TransferSingle(operator, from, address(0), id, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -344,29 +344,29 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
|
||||
* - `ids` and `amounts` must have the same length.
|
||||
*/
|
||||
function _burnBatch(
|
||||
address account,
|
||||
address from,
|
||||
uint256[] memory ids,
|
||||
uint256[] memory amounts
|
||||
) internal virtual {
|
||||
require(account != address(0), "ERC1155: burn from the zero address");
|
||||
require(from != address(0), "ERC1155: burn from the zero address");
|
||||
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
|
||||
|
||||
address operator = _msgSender();
|
||||
|
||||
_beforeTokenTransfer(operator, account, address(0), ids, amounts, "");
|
||||
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
|
||||
|
||||
for (uint256 i = 0; i < ids.length; i++) {
|
||||
uint256 id = ids[i];
|
||||
uint256 amount = amounts[i];
|
||||
|
||||
uint256 accountBalance = _balances[id][account];
|
||||
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
|
||||
uint256 fromBalance = _balances[id][from];
|
||||
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
|
||||
unchecked {
|
||||
_balances[id][account] = accountBalance - amount;
|
||||
_balances[id][from] = fromBalance - amount;
|
||||
}
|
||||
}
|
||||
|
||||
emit TransferBatch(operator, account, address(0), ids, amounts);
|
||||
emit TransferBatch(operator, from, address(0), ids, amounts);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -134,7 +134,7 @@ abstract contract ERC20Votes is ERC20Permit {
|
||||
* @dev Delegate votes from the sender to `delegatee`.
|
||||
*/
|
||||
function delegate(address delegatee) public virtual {
|
||||
return _delegate(_msgSender(), delegatee);
|
||||
_delegate(_msgSender(), delegatee);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,7 +156,7 @@ abstract contract ERC20Votes is ERC20Permit {
|
||||
s
|
||||
);
|
||||
require(nonce == _useNonce(signer), "ERC20Votes: invalid nonce");
|
||||
return _delegate(signer, delegatee);
|
||||
_delegate(signer, delegatee);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user