Created
May 16, 2023 23:51
-
-
Save Aviksaikat/cfd09cfc16c429dc4f6326d9347c6c56 to your computer and use it in GitHub Desktop.
How to do `abi.encodeWithSignature` in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
value = Contract.methodName.encode_input() | |
print(value) | |
# wrong | |
# >> '0xa7a7e4e8' | |
value = Contract.methodName.encode_input() | |
# add padding to make it 32 bytes | |
value = value + "0" * (66 - len(value)) | |
print(value) | |
# correct | |
#>> '0xa7a7e4e800000000000000000000000000000000000000000000000000000000' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment