Strange conversion ratios for swaps made using MultiHop exchange route

This issue has been tracked since 2023-03-17.

I noticed that when we try to swap small amounts of assets, sometimes the exchange route get's set to MultiHp and the conversion ratio then is better than the ratio offered by Uniswap when swapping bigger amounts. Generally, for MultiHop the ratio gets better as the swapped asset's amount gets smaller. I'm not sure if that's how the MultiHop actually works or if there's a bug somewhere.

For example, this is what I noticed when swapping 1 KEEP to T:

image
image

The conversion ratio is 1 KEEP = 4.719088792228573651 T (which seems right, as the official KEEP to T upgrade ratio is ~4.78).

But when I tried to swap 0.1 KEEP to T I got:
image
image

The conversion ratio was 1 KEEP = 35.329348041255636102 T (which seems strange).

In those two cases different exchange routes were chosen (Uniswap vs MultiHop). No warning about low liquidity was shown. Nothing suspicious found in logs.

I did some more tests and those are the ratios I got, depending on the amounts I was trying to swap:

Amount   Ratio                              Ex. route
0.01     1 KEEP = 170.872969138191063505 T  MultiHop
0.1      1 KEEP = 35.329348041255636102 T   MultiHop
0.2      1 KEEP = 18.778421810098065841 T   MultiHop
0.3      1 KEEP = 12.787700316251079919 T   MultiHop
0.35     1 KEEP = 4.719089137452873856 T    Uniswap
0.4      1 KEEP = 4.71908911089715682 T     Uniswap
1        1 KEEP = 4.719088792228573651 T    Uniswap

Similar behavior found for other asset pairs. For example we get different ratios when swapping 0.01 and 0.001 DAI to FTM.

Observed on 0.28.0

More Details About Repo
Owner Name tahowallet
Repo Name extension
Full Name tahowallet/extension
Language TypeScript
Created Date 2021-03-07
Updated Date 2023-03-25
Star Count 2757
Watcher Count 50
Fork Count 295
Issue Count 316

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date