fix: Fix bug with token indexing when wrapping/unwrapping

The issue was that we weren't indexing WETH properly since it was looking for the WETH address in tokens, when only native ETH would be in there

- Found by adding integration tests for the wrapping and unwrapping cases.
This commit is contained in:
TAMARA LIPOWSKI
2025-02-03 22:40:43 -05:00
parent 4bc615913e
commit 3f4e27a348
3 changed files with 177 additions and 10 deletions

View File

@@ -207,6 +207,7 @@ contract TychoRouter is
tokenInIndex = swapData.tokenInIndex();
tokenOutIndex = swapData.tokenOutIndex();
split = swapData.splitPercentage();
currentAmountIn = split > 0
? (amounts[tokenInIndex] * split) / 0xffffff
: remainingAmounts[tokenInIndex];