79149161

Date: 2024-11-01 19:17:17
Score: 1
Natty:
Report link

Wonder if people are still looking for something that works for abi.encode vs abi.encodePacked

I have done a detailed answer in Case 3. https://ethereum.stackexchange.com/a/166536/144566

TLDR, You can check the code out at https://go.dev/play/p/V3artUBQMUe I have tried to structure it in a way folks using ethers are encoding. And you can just start using it as any function

For abi.encodePacked, you just need to append the bytes.

For abi.encode, you do what OP has answered or you need to do what I have done in the go-playground link, basically create a arguments object that matches the data you need to encode, and pass the arguments to the arguments.Pack(...) method

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Puneet