|
@@ -8,6 +8,7 @@ pragma solidity ^0.8.0;
|
|
|
*/
|
|
|
library Strings {
|
|
|
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
|
|
|
+ uint8 private constant _ADDRESS_LENGTH = 20;
|
|
|
|
|
|
/**
|
|
|
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
|
|
@@ -64,4 +65,11 @@ library Strings {
|
|
|
require(value == 0, "Strings: hex length insufficient");
|
|
|
return string(buffer);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
|
|
|
+ */
|
|
|
+ function toHexString(address addr) internal pure returns (string memory) {
|
|
|
+ return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
|
|
|
+ }
|
|
|
}
|