Unverified Commit 8b10cb38 by Francisco Giordano Committed by GitHub

Rename Strings.fromUint256 to Strings.toString (#2188)

* rename Strings.fromUint256 to Strings.toString

* add changelog entry

* fix conflict with js toString method
parent 3e139baa
......@@ -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)
......
......@@ -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);
}
}
......@@ -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)));
}
/**
......
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment