This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addressToChecksumString(address tempaddr) public view returns (string memory) { | |
bytes memory lowercase = addressToLowercaseBytes(tempaddr); // get address in lowercase hex without '0x' | |
bytes32 hashed_addr = keccak256(abi.encodePacked(lowercase)); // get the hash of the lowercase address | |
bytes memory result = new bytes(42); // store checksum address with '0x' prepended in this. | |
result[0] = '0'; | |
result[1] = 'x'; | |
uint160 addrValue = uint160(tempaddr); | |
uint160 hashValue = uint160(bytes20(hashed_addr)); |