Skip to content
CERQAVAJoin waitlist

EVM transaction decoding

What calldata can tell you before you sign, and what it can’t

Calldata says what a transaction asks a contract to do. This page lists the calls CERQAVA decodes, how it reads them, and where decoding stops being certain.

In developmentNo public API yet

Intent is not outcome

Decoding reads calldata and nothing else. It answers one question: what does this transaction ask for? Approve this spender, or swap at most this much for at least that much. It doesn’t run anything, so it can’t say what will actually move. That’s what simulation is for, and the two are reported separately: decodedAction holds the intent, and effects holds the predicted outcome. Three examples of the gap between them:

  • An ERC-20 approval moves no tokens. It grants a permission that can be used later: in the same transaction, a year from now, or never.
  • Staking ETH with Lido mints stETH shares at the pool’s rate, and shares are rounded. So the stETH received isn’t promised to equal the ETH sent, and only a simulation shows how much it is.
  • A swap’s calldata bounds it: the most the sender pays and the least they receive. The minimum isn’t a price. What’s actually received depends on the pool when the transaction runs.

Reading an approval

A call starts with a four-byte selector: the first four bytes of the Keccak-256 hash of the function’s signature. The arguments follow in 32-byte words, as the Solidity ABI specification describes. Here’s an unlimited approval, split into its parts:

Illustrative · calldata
095ea7b3                                                          approve(address,uint256)
0000000000000000000000003333333333333333333333333333333333333333  spender
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff  amount: 2^256 − 1

Sent to the token contract, it decodes to:

Illustrative · decoded action
{
  "kind": "token_approve",
  "contract": "0x2222222222222222222222222222222222222222",
  "value": "0",
  "spender": "0x3333333333333333333333333333333333333333",
  "amountOrTokenId": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
  "standard": "unknown",
  "standardEvidence": null
}

standard is unknown because ERC-721 has a function with the same signature. There, the number is a token ID, and one NFT is approved. Calldata can’t tell the two apart. When the chain can be read and the difference matters, the contract is asked whether it claims ERC-721 over ERC-165, and its answer is recorded alongside, as a claim rather than proof. The same ambiguity applies to transferFrom, and to setApprovalForAll, which ERC-721 and ERC-1155 share.

Token and NFT calls

These are decoded on any contract, because they’re the token standards’ own functions:

Call, and what it decodes toWhat to know
(no calldata)→ native_transferSends ETH. A contract recipient can still run code when it receives it.
transfer(address,uint256)→ erc20_transferOnly ERC-20 has this function.
approve(address,uint256)→ token_approveAn ERC-20 allowance, or approval of a single ERC-721 token.
transferFrom(address,address,uint256)→ token_transfer_fromMoves tokens under an existing allowance or approval. It has the same ambiguity as approve.
safeTransferFrom(address,address,uint256[,bytes])→ erc721_safe_transfer_fromThe bytes payload is passed to the recipient’s hook. Only its length is reported.
setApprovalForAll(address,bool)→ set_approval_for_allThe operator can move every NFT in the collection, including ones acquired later. false revokes it.
safeTransferFrom(address,address,uint256,uint256,bytes)→ erc1155_transferOne ERC-1155 token ID and amount.
safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)→ erc1155_batch_transferSeveral IDs and amounts. Every item is counted, even when the list is too long to show in full.

Badly encoded arguments are reported as a malformed call, with the problem named, and are never decoded as if they were fine. That includes truncated calldata and addresses with non-zero padding. Bytes after the arguments are flagged too, because a contract may read them.

Protocol calls, recognized by deployment

A function’s name says nothing about a contract nobody has reviewed. So protocol calls are decoded only when they go to that protocol’s reviewed deployment on Ethereum mainnet. The same selector on any other address stays an unknown call.

ProtocolCalls decoded
WETH9deposit(), a plain ETH transfer (which deposits), and withdraw(uint256)
Lido stETHsubmit(address), and a plain ETH transfer (which submits)
Aave v3 Poolsupply, withdraw, borrow and repay. The Pool’s other functions, including the permit variants, stay unknown.
Seaport 1.6Both forms of fulfillBasicOrder, plus fulfillAdvancedOrder, fulfillAvailableAdvancedOrders and matchAdvancedOrders
Uniswap Universal Router 2.0 and 2.1.2Command plans through V2, V3 and V4 pools, including wrapping, sweeps, fees and Permit2 steps
1inch Aggregation Router v6swap, the unoswap family, and cancelOrder / cancelOrders

Lido’s stETH and Aave’s Pool are upgradeable, so recognizing the call isn’t enough. CERQAVA reads the proxy’s current implementation and compares it with the one that was reviewed. Until they match, the scan can’t come back clear. WETH9 is immutable and needs no such check.

Swaps: bounds, not outcomes

A router call is read against the router’s source code at the deployed version. What CERQAVA reports is what that code guarantees from calldata alone:

  • Pays: for each currency, the most the sender can pay.
  • Receives: for each currency, the least the sender receives.
  • Pays others: fees, and any recipient other than the sender.
  • Left in the router: what may stay in the router once the call is done, where anyone’s sweep can take it. This happens, for instance, when an exact-input swap stops at its price limit, or when a multi-hop swap leaves a token between hops.
  • Grants: Permit2 allowances the plan submits along the way.

Decoding is complete only when all of these hold:

  • every command is interpreted;
  • what the sender pays is bounded;
  • everything goes to the sender, and nothing is left behind;
  • any permission granted is one that a rule judges.

A complete decode means the call was fully interpreted. It isn’t a judgment that the trade is fair.

Some 1inch routes stay partial by design:

  • swap hands the route to an executor whose steps aren’t interpreted. The router itself guarantees only that it takes the stated amount and pays at least the minimum.
  • The unoswap family names pools rather than the currency that comes out.

Seaport orders

  • Basic orders state every amount and recipient, so what moves is exact. Each transfer names who funds it. It also says whether the offerer signed it into the order or the person filling it added it as a tip.
  • Advanced orders can fill in part, change price over time, and name items by criteria. Their amounts are bounded with Seaport’s own arithmetic, as an at-least and an at-most, and never promised. Merkle proofs for criteria are verified the way Seaport verifies them.
  • Batches (fulfillAvailableAdvancedOrders) skip orders that can’t fill, so a successful call may have filled any of them. Each order is marked as never filling, certain to fill, or filling if it’s still available. Which ones actually fill, only execution shows.
  • Matches (matchAdvancedOrders) fill every order or none, and each transfer says whose assets fund it.

Two things keep a Seaport call partial, because each runs code no one reviewed:

  • a restricted order whose zone Seaport calls before and after the transfers;
  • a contract order, whose items its own contract generates when it runs.

Aave v3: acting for someone else

Aave’s Pool lets a call act on behalf of another account, and the risk is often in who that is. So each party is named by its role:

  • supply mints the position to an aTokenRecipient, who may not be the sender.
  • withdraw sends the underlying asset to a recipient.
  • borrow puts the debt on a debtor, and the funds go to the sender. The debtor can be another account only if it has delegated credit to the sender.
  • repay reduces a debtBeneficiary’s debt. That’s a debt reduction, not a transfer.

The reviewed implementation accepts only the variable interest-rate mode. A call with any other mode is decoded as written and flagged as unsupported, and it’s never described as the operation it names. How much is actually received, and what interest accrues, only simulation shows.

Signing requests

Many drains need no transaction. Someone signs a permit or an order, and someone else submits it. Typed data (EIP-712) is recognized only when its types match a known schema exactly, under that protocol’s own domain:

Recognized asSchema
EIP-2612 permitPermit, verified by the token itself
DAI permitDAI’s own Permit
Permit2 allowancePermitSingle, PermitBatch
Permit2 transferPermitTransferFrom, PermitBatchTransferFrom, and their witness forms
Seaport orderOrderComponents, and bulk orders that sign a whole tree of orders at once

Permit2’s types under any contract but Permit2 are reported as a lookalike, and so are Seaport’s under a domain no Seaport deployment would verify. Decoded typed data includes its EIP-712 digest, so a wallet can confirm that what was analyzed is what it’s about to sign.

For messages, a Sign-In with Ethereum message is parsed, and its domain is compared with the site asking for the signature. An eth_sign request for a bare 32-byte hash is blind signing, because that hash can be a transaction’s. Any other message is reported as one CERQAVA doesn’t interpret.

Where decoding stays partial

When decoding can’t finish, it says why, with one of these reasons. A partial decode can never produce a clean verdict: see the security model.

ReasonWhen
ABI_UNKNOWNThe function isn’t one the decoder knows, at this address.
CALLDATA_MALFORMEDThe arguments don’t validly encode the function they name.
CALLDATA_TRAILING_BYTESExtra bytes follow the arguments, and the contract may read them.
CALL_PARTLY_INTERPRETEDThe function is known, but a command, route or amount in it isn’t interpreted or bounded.
ACTION_EFFECT_UNJUDGEDThe call is interpreted, but part of what it does isn’t judged by any rule yet, such as paying someone other than the sender.
PROTOCOL_PARAMETER_UNSUPPORTEDAn argument isn’t one the reviewed deployment accepts.
ZONE_HOOK_UNREVIEWEDSeaport will call an unreviewed zone contract.
ORDER_GENERATED_AT_EXECUTIONA Seaport contract order: its items are generated when it runs.
TOKEN_SIDE_EFFECT_UNJUDGEDA token the call names is known to move more than its standard transfer. One example is a hybrid NFT whose transfers also move a paired ERC-20.
SIGNATURE_SCHEMA_UNKNOWNTyped data in a schema CERQAVA doesn’t recognize.

Not decoded yet

  • Other protocols. A call to any contract that isn’t a reviewed deployment is an unknown call, however familiar its function looks.
  • Aave v3 Pool functions other than the four above.
  • Transactions that deploy a contract.
  • Chains other than Ethereum mainnet.
  • EIP-7702 delegations.