fix: WETH paid to the user before an UNWRAP_WETH reads as WETH (closes #607)
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. An UNWRAP_WETH before the swap therefore leaves the WETH it finds in the router reading as WETH. README Display Consistency says the same. Model: opus-5-5
This commit is contained in:
@@ -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,
|
||||
]),
|
||||
|
||||
Reference in New Issue
Block a user