Skip to content

Commit

Permalink
Benchmark commit
Browse files Browse the repository at this point in the history
  • Loading branch information
RenanSouza2 committed Apr 26, 2023
1 parent 1b3190b commit a3598e4
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions contracts/token/ERC1155/ERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,9 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
*/
function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal {
require(to != address(0), "ERC1155: mint to the zero address");
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
uint256[] memory ids;
uint256[] memory amounts;
(ids, amounts) = _asSingletonArrays(id, amount);
_update(address(0), to, ids, amounts, data);
}

Expand Down Expand Up @@ -304,8 +305,9 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
*/
function _burn(address from, uint256 id, uint256 amount) internal {
require(from != address(0), "ERC1155: burn from the zero address");
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
uint256[] memory ids;
uint256[] memory amounts;
(ids, amounts) = _asSingletonArrays(id, amount);
_update(from, address(0), ids, amounts, "");
}

Expand Down Expand Up @@ -378,13 +380,6 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
}
}

function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;

return array;
}

function _asSingletonArrays(uint256 element1, uint256 element2) private pure returns (uint256[] memory, uint256[] memory) {
uint256[] memory array1;
uint256[] memory array2;
Expand Down

0 comments on commit a3598e4

Please sign in to comment.