Skip to content

Instantly share code, notes, and snippets.

@PatrickAlphaC
Created November 24, 2021 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatrickAlphaC/211e1bb0548c80944ee57be6d6a28c3f to your computer and use it in GitHub Desktop.
Save PatrickAlphaC/211e1bb0548c80944ee57be6d6a28c3f to your computer and use it in GitHub Desktop.
// This example code is designed to quickly deploy an example contract using Remix.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract EncodingFun {
function encodeThenDecode(uint256 value) public pure returns (uint256) {
bytes memory encodedData = abi.encodePacked(value);
uint256 decodedData = abi.decode(encodedData, (uint256));
return decodedData;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment