Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45835af561 |
@@ -1067,6 +1067,42 @@ describe("what reaches the UNWRAP_WETH of the swap's WETH", () => {
|
|||||||
expect(detail(result, "Token Out").value).toBe("ETH");
|
expect(detail(result, "Token Out").value).toBe("ETH");
|
||||||
expect(detail(result, "Min. received").value).toBe("1.0000 ETH");
|
expect(detail(result, "Min. received").value).toBe("1.0000 ETH");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// The first swap is for at least 0.5 WETH and the second for at least
|
||||||
|
// 1 WETH. The second sets the output side again, so the first
|
||||||
|
// UNWRAP_WETH into the router no longer bears on it.
|
||||||
|
test.each([
|
||||||
|
{ kind: "a V3 swap step", step: swapToWeth(ADDRESS_THIS) },
|
||||||
|
{
|
||||||
|
kind: "a V4 step that TAKEs its WETH to the router",
|
||||||
|
step: v4Swap(
|
||||||
|
SWAP_USDT_FOR_WETH,
|
||||||
|
SETTLE_USDT,
|
||||||
|
take(WETH, ADDRESS_THIS),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
])(
|
||||||
|
"a swap paying WETH to the router, an UNWRAP_WETH into the router, a SWEEP of its ETH to the user, then $kind and an UNWRAP_WETH to the user, reads as ETH with the second swap's minimum",
|
||||||
|
({ step }) => {
|
||||||
|
const result = decode(
|
||||||
|
execute(
|
||||||
|
v3SwapExactIn(
|
||||||
|
ADDRESS_THIS,
|
||||||
|
USDT_2000,
|
||||||
|
ONE_WETH / 2n,
|
||||||
|
USDT,
|
||||||
|
WETH,
|
||||||
|
),
|
||||||
|
unwrapWeth(ADDRESS_THIS),
|
||||||
|
sweep(ZERO, MSG_SENDER),
|
||||||
|
step,
|
||||||
|
unwrapWeth(MSG_SENDER),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
expect(result.name).toBe("Swap USDT → ETH");
|
||||||
|
expect(detail(result, "Min. received").value).toBe("1.0000 ETH");
|
||||||
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// https://git.eeqj.de/sneak/AutistMask/issues/606: any token a step pays the
|
// https://git.eeqj.de/sneak/AutistMask/issues/606: any token a step pays the
|
||||||
|
|||||||
Reference in new issue
Block a user