Uniswap / smart-order-router

GNU General Public License v3.0
406 stars 404 forks source link

Different swap routes for EXACT_OUTPUT vs EXACT_INPUT #642

Closed yodlmeister closed 2 months ago

yodlmeister commented 2 months ago

The router suggests wildly different routes depending on TradeType: EXACT_OUTPUT vs EXACT_INPUT.

The routes for EXACT_OUTPUT are particularly inefficient.

Example output comparing the two modes:

* EXACT_OUTPUT route
[V3] 100.00% = FRAX -- 0.3% [0x49..B9] --> ARB -- 1% [0x7F..c1] --> DAI

* EXACT_INPUT route
[V3] 100.00% = FRAX -- 0.05% [0x1E..22] --> USDT -- 0.01% [0x7f..a9] --> DAI

Sample code to reproduce: https://github.com/yodlmeister/smart-order-router-bug

yodlmeister commented 2 months ago

Solved by using the parseAmount method.