@abi.encode
ABI-encode values given a comma-separated type list, like Solidity abi.encode.
Returns: bytes
Syntax
Section titled “Syntax”@abi.encode(types ...values)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
types | string | Comma-separated Solidity types (e.g. uint256,address) |
[...values] | any | Values to encode, one per type |
Examples
Section titled “Examples”# Encode values without a selectorset $data @abi.encode("uint256,address" 100e18 0x44fA8E6f47987339850636F88629646662444217)print $dataSee Also
Section titled “See Also”- @abi.decode — the inverse: decode ABI-encoded data
- @abi.encodeCall — encode a full function call (with selector)
- @abi.encodePacked — packed encoding