@abi.encodeCall
ABI-encode a function call from its signature and arguments.
On-chain (@abi.encodeCall!): The signature must be a constant; live arguments must be elementary static types, each contributing its 32-byte word (at most 4 per call).
Returns: bytes
Syntax
Section titled “Syntax”@abi.encodeCall(signature ...params)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
signature | write-abi | Function signature (e.g. transfer(address,uint256)) |
[...params] | any | Arguments to encode |
Examples
Section titled “Examples”# Encode a transfer callset $data @abi.encodeCall("transfer(address,uint256)" 0x44fA8E6f47987339850636F88629646662444217 100e18)On-chain face (@abi.encodeCall!)
Section titled “On-chain face (@abi.encodeCall!)”The signature is a constant, so the selector seeds the first constant run
and each argument appends its 32-byte head word — one concat for the
whole calldata value. Live arguments must be elementary static types, at
most 4 per call; all-constant calls fold at composition.
This is not the ::! chain operator wearing a new name: ::! PERFORMS a
constructed read, while this face produces the calldata as a bytes VALUE —
for comparing against stored payloads (a timelock's queued call, a
multisig's proposed transaction) rather than executing anything.
See Also
Section titled “See Also”- @abi.decodeCall — the inverse: decode calldata into
[contract sig [args]] - send — send pre-encoded calldata
- exec — call by signature (auto-encodes)
- @hash — compute a function selector