Skip to content

Instantly share code, notes, and snippets.

@PaulRBerg
Created February 25, 2023 21:36
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 PaulRBerg/34112227fac32d413c44b9fc5b9f86d4 to your computer and use it in GitHub Desktop.
Save PaulRBerg/34112227fac32d413c44b9fc5b9f86d4 to your computer and use it in GitHub Desktop.
Toy example to see how `abi.encode` works with zero values
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.19;
contract Contract {
function foo(bytes32 seed) external view returns (bytes memory) {
return abi.encode(tx.origin, seed);
}
function getBytes32(uint256 number) external pure returns (bytes32) {
return bytes32(number);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment