0

Lets say we have something like this as a given:

bytes20 b = bytes20(someAddress);
uint8[] memory array = new uint8[](b.length);
for (uint256 n = 0; n < b.length; n++) {
  array[n] = uint8(uint160(b) / (2 ** (8 * (19 - n))));
}

After performing operations on the array (which would change the casing) I would like to bring it back to an address with the correct checksum, without converting it to a string with a proper casing, and then the string to address. In other words, I am looking for a clean solution. Solidity version is 5.0

1

A variable of type address in the EVM is stored as raw bytes so they do not have case.

For an addres to have case it only make sense when the address is stored as hexadecimal string.

Usually it is responsibility of the library/framework you are using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.