fix: WETH paid to the user before an UNWRAP_WETH reads as WETH (closes #607)
check / check (push) Canceled after 0s
e2e / e2e-chrome (push) Canceled after 0s
e2e / e2e-firefox (push) Canceled after 0s

An UNWRAP_WETH made Token Out ETH whenever the output side was WETH, so
a swap that paid its WETH to the user before it read as ETH, though the
user receives WETH. decode() now turns the output into ETH only when the
router holds the output side's WETH when the step runs, which it reads
from what it already follows the router to hold; a later step that sets
the output side sets it anew. So an UNWRAP_WETH that runs before the
swap no longer makes the WETH the swap leaves in the router read as ETH.
README Display Consistency says the same.

Model: opus-5-5
This commit is contained in:
2026-10-20 10:52:09 +00:00
parent 070ad82338
commit e3745a2acf
4 changed files with 98 additions and 16 deletions
+2 -2
View File
@@ -875,7 +875,7 @@ describe("uniswap decoder", () => {
const data = buildExecute(
solidityPacked(["uint8", "uint8"], [0x08, 0x0c]),
[
encodeV2SwapExactIn(USER_ADDR, 1000000n, 500000000000000n, [
encodeV2SwapExactIn(ROUTER_ADDR, 1000000n, 500000000000000n, [
USDC_ADDR,
SEPOLIA_WETH_ADDR,
]),
@@ -958,7 +958,7 @@ describe("uniswap decoder", () => {
const data = buildExecute(
solidityPacked(["uint8", "uint8"], [0x08, 0x0c]),
[
encodeV2SwapExactIn(USER_ADDR, 1000000n, 500000000000000n, [
encodeV2SwapExactIn(ROUTER_ADDR, 1000000n, 500000000000000n, [
USDT_ADDR,
WETH_ADDR,
]),