`tokenInfo(null)` answered `{symbol: "ETH", decimals: 18}`, so a swap whose
calldata never named an input currency rendered `Token In: ETH (native)` and
titled itself `Swap ETH -> X`. The approval screen asserted the user was paying
native ETH when nothing had established it.
Null is not how native ETH arrives. v4-core declares `type Currency is address`
and wraps `address(0)` for it; a user-defined value type over `address` carries
the plain `address` ABI encoding, so a native-ETH currency reaches every decode
site here as the truthy string
`0x0000000000000000000000000000000000000000`, and WRAP_ETH sets that same
explicit zero address. A null token means undetermined, on the input side as on
the output side.
The collapse is removed from `tokenInfo()` itself rather than guarded at each
call site, so both sides of the screen answer the same condition the same way:
null refuses, the zero address is still ETH at 18 decimals. `Token In` gains
the refusal branch `Unknown (not named in the calldata)`, now a shared constant
with the `Token Out` branch it must match.
7.1 KiB
7.1 KiB