Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
e2fa301b
Unverified
Commit
e2fa301b
authored
Oct 06, 2021
by
Hadrien Croubois
Committed by
GitHub
Oct 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve parameters naming and remove unecessary returns (#2891)
parent
29eeb282
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
28 deletions
+28
-28
ERC1155.sol
contracts/token/ERC1155/ERC1155.sol
+26
-26
ERC20Votes.sol
contracts/token/ERC20/extensions/ERC20Votes.sol
+2
-2
No files found.
contracts/token/ERC1155/ERC1155.sol
View file @
e2fa301b
...
@@ -249,32 +249,32 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
...
@@ -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.
* Emits a {TransferSingle} event.
*
*
* Requirements:
* Requirements:
*
*
* - `
account
` cannot be the zero address.
* - `
to
` cannot be the zero address.
* - If `
account
` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* - If `
to
` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
* acceptance magic value.
*/
*/
function _mint(
function _mint(
address
account
,
address
to
,
uint256 id,
uint256 id,
uint256 amount,
uint256 amount,
bytes memory data
bytes memory data
) internal virtual {
) 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();
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;
_balances[id][
to
] += amount;
emit TransferSingle(operator, address(0),
account
, id, 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 {
...
@@ -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:
* Requirements:
*
*
* - `
account
` cannot be the zero address.
* - `
from
` cannot be the zero address.
* - `
account
` must have at least `amount` tokens of token type `id`.
* - `
from
` must have at least `amount` tokens of token type `id`.
*/
*/
function _burn(
function _burn(
address
account
,
address
from
,
uint256 id,
uint256 id,
uint256 amount
uint256 amount
) internal virtual {
) 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();
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
];
uint256
fromBalance = _balances[id][from
];
require(
account
Balance >= amount, "ERC1155: burn amount exceeds balance");
require(
from
Balance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
unchecked {
_balances[id][
account] = account
Balance - amount;
_balances[id][
from] = from
Balance - 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 {
...
@@ -344,29 +344,29 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
* - `ids` and `amounts` must have the same length.
* - `ids` and `amounts` must have the same length.
*/
*/
function _burnBatch(
function _burnBatch(
address
account
,
address
from
,
uint256[] memory ids,
uint256[] memory ids,
uint256[] memory amounts
uint256[] memory amounts
) internal virtual {
) 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");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
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++) {
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 amount = amounts[i];
uint256
accountBalance = _balances[id][account
];
uint256
fromBalance = _balances[id][from
];
require(
account
Balance >= amount, "ERC1155: burn amount exceeds balance");
require(
from
Balance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
unchecked {
_balances[id][
account] = account
Balance - amount;
_balances[id][
from] = from
Balance - amount;
}
}
}
}
emit TransferBatch(operator,
account
, address(0), ids, amounts);
emit TransferBatch(operator,
from
, address(0), ids, amounts);
}
}
/**
/**
...
...
contracts/token/ERC20/extensions/ERC20Votes.sol
View file @
e2fa301b
...
@@ -134,7 +134,7 @@ abstract contract ERC20Votes is ERC20Permit {
...
@@ -134,7 +134,7 @@ abstract contract ERC20Votes is ERC20Permit {
* @dev Delegate votes from the sender to `delegatee`.
* @dev Delegate votes from the sender to `delegatee`.
*/
*/
function delegate(address delegatee) public virtual {
function delegate(address delegatee) public virtual {
return
_delegate(_msgSender(), delegatee);
_delegate(_msgSender(), delegatee);
}
}
/**
/**
...
@@ -156,7 +156,7 @@ abstract contract ERC20Votes is ERC20Permit {
...
@@ -156,7 +156,7 @@ abstract contract ERC20Votes is ERC20Permit {
s
s
);
);
require(nonce == _useNonce(signer), "ERC20Votes: invalid nonce");
require(nonce == _useNonce(signer), "ERC20Votes: invalid nonce");
return
_delegate(signer, delegatee);
_delegate(signer, delegatee);
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment