ain icon indicating copy to clipboard operation
ain copied to clipboard

Disregard direct path for composite swaps when a better path is available

Open pawn-police opened this issue 3 years ago • 1 comments

What would you like to be added:

I want compositeswap to take the most profitable path

Why is this needed:

All DFI to DUSD swaps could have been up to 18.5% more profitable at the time of writing if the user had first swapped to USDC through USDC-DFI and finally to DUSD through USDC-DUSD.

All composite swaps for DFI to DUSD automatically go through DUSD-DFI since this is a direct path. A lot of users don't realise this and assume that the best path is automatically selected. This is illustrated by the large amount of DFI that is still swapped to DUSD directly.

I also think that it is confusing because choosing the best path is implemented by compositeswap for all cases where a direct path is not available. And when a direct path available all this logic is abandoned and you end up with the worst possible path in the DFI to DUSD case.

In hindsight I think https://github.com/DeFiCh/ain/issues/1397 made this less obvious since testpoolswap does not work properly for DFI to DUSD, USDT to DUSD and USDC to DUSD right now. This image illustrates how USDC-DFI -> USDC-DUSD compares to DUSD-DFI. The +17% is the additonal DUSD that a user would get if the best path had been taken.

image

pawn-police avatar Oct 06 '22 21:10 pawn-police

@pawn-police: Thanks for opening an issue, it is currently awaiting triage.

The triage/accepted label can be added by foundation members by writing /triage accepted in a comment.

Details

I am a bot created to help the DeFiCh developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the DeFiCh/oss-governance-bot repository.

defichain-bot avatar Oct 06 '22 21:10 defichain-bot