Rename Strings.fromUint256 to Strings.toString (#2188)
* rename Strings.fromUint256 to Strings.toString * add changelog entry * fix conflict with js toString method
This commit is contained in:
committed by
GitHub
parent
3e139baa50
commit
8b10cb38d8
@ -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)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user