EXAMPLES
ABI-encode the arguments for a call to someFunc(address,uint256):
cast abi-encode "someFunc(address,uint256)" 0xbd20e68967fc2a813356bff4754bba48692d8e0d 123
0x000000000000000000000000bd20e68967fc2a813356bff4754bba48692d8e0d000000000000000000000000000000000000000000000000000000000000007b
Parameters as a tuple:
cast abi-encode "someFunc((string,uint256))" "(myString,1)"
0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000086d79537472696e67000000000000000000000000000000000000000000000000
DOCUMENTATION
cast abi-encode
NAME
cast-abi-encode - ABI encode the given function arguments, excluding the selector.
SYNOPSIS
cast abi-encode
[options] sig [args...]
DESCRIPTION
ABI encode the given function, excluding the selector.
The signature (sig) is a fragment in the form <function name>(<types...>)
.
OPTIONS
Common Options
-h
--help
Prints help information.
EXAMPLES
-
ABI-encode the arguments for a call to
someFunc(address,uint256)
:cast abi-encode "someFunc(address,uint256)" 0x... 1
-
For encoding a type with components (as a tuple, or custom struct):
cast abi-encode "someFunc((string,uint256))" "(myString,1)"