Looking at EIP-55, there are quite a few client-side address checksum implementations provided but no Solidity implementation. Are there any existing examples of computing address checksums directly in Solidity? Not only could an implementing contract be called by clients as a convenience function, but it would also allow for employing on-chain logic based on address checksums. For the latter case, gas efficiency would likely be an important consideration.
Here's an example of an interface that said implementation would inherit:
interface AddressChecksum {
function getChecksum(address account) external pure returns (string accountChecksum);
function getChecksumCapitalizedDigits(address account) external pure returns (bool[40] digitCapitalized);
function isChecksumValid(string accountChecksum) external pure returns (bool ok);
}
Best Answer
I went ahead and put together a working example of EIP-55 in Solidity in case it's useful to anyone that comes across this. It should also be pretty straightforward to create a library that extends
address
with a few of these methods.