Uniswap / v3-sdk

🛠 An SDK for building applications on top of Uniswap V3
MIT License
554 stars 430 forks source link

Trade supports multiple routes #55

Closed willpote closed 3 years ago

willpote commented 3 years ago

Trade updated to support multiple routes. Change is back in a backward compatible way to avoid a major version bump: you will hit an error if you try and access the 'route' property when your Trade consists of multiple routes

I previously made a change to the SwapRouter to support multiple Trade objects being provided to swapCallParameters. With this change that is no longer necessary, but I left it in anyway.

willpote commented 3 years ago

I've changed the approach here, decided to remove all percentages and just use the actual amounts for each split

The routing api will handle potential loss of precision from doing splits and return amounts per route s.t. they add up correctly