Skip to content

Instantly share code, notes, and snippets.

@ltfschoen
Last active June 20, 2020 12:47
Show Gist options
  • Save ltfschoen/6729b192119314de0d789a1b1859f52e to your computer and use it in GitHub Desktop.
Save ltfschoen/6729b192119314de0d789a1b1859f52e to your computer and use it in GitHub Desktop.
EncodeAndDecode
pragma solidity ^0.5.16;
contract EncodeAndDecode {
function encode() public view returns(bytes memory hash) {
return abi.encode(msg.sender, bytes("0xF785DaB2Cd075dC0a8011249357f2332972319fd"));
}
function decode(bytes memory hash) public view returns(address a, bytes memory b) {
(a,b) = abi.decode(hash, (address, bytes));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment