Skip to content

Commit

Permalink
Rename Strings.fromUint256 to Strings.toString (#2188)
Browse files Browse the repository at this point in the history
* rename Strings.fromUint256 to Strings.toString

* add changelog entry

* fix conflict with js toString method
  • Loading branch information
frangio committed Apr 15, 2020
1 parent 3e139ba commit 8b10cb3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* `ERC721`: added a constructor for `name` and `symbol`. ([#2160](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2160))
* `ERC20Detailed`: this contract was removed and its functionality merged into `ERC20`. ([#2161](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2161))
* `ERC20`: added a constructor for `name` and `symbol`. `decimals` now defaults to 18. ([#2161](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2161))
* `Strings`: renamed `fromUint256` to `toString` ([#2188](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2188))

## 2.5.0 (2020-02-04)

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/StringsMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import "../utils/Strings.sol";

contract StringsMock {
function fromUint256(uint256 value) public pure returns (string memory) {
return Strings.fromUint256(value);
return Strings.toString(value);
}
}
2 changes: 1 addition & 1 deletion contracts/token/ERC721/ERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
return string(abi.encodePacked(_baseURI, _tokenURI));
}
// If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
return string(abi.encodePacked(_baseURI, Strings.fromUint256(tokenId)));
return string(abi.encodePacked(_baseURI, Strings.toString(tokenId)));
}

/**
Expand Down
3 changes: 1 addition & 2 deletions contracts/utils/Strings.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
pragma solidity ^0.6.0;

/**
* @title Strings
* @dev String operations.
*/
library Strings {
/**
* @dev Converts a `uint256` to its ASCII `string` representation.
*/
function fromUint256(uint256 value) internal pure returns (string memory) {
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

Expand Down

0 comments on commit 8b10cb3

Please sign in to comment.