The SOR Version 1.0.0-0 introduces breaking changes but should be fairly easy to update. Benefits of updating include - support for multihop swaps and an easier to use wrapper interface as well as more efficient/faster processing.
The SOR is now instantiated as an object:
Find further details on parameters here.
SOR now has three main functions:
Calculates gas cost for swapping token on Balancer.
The result is used to make more gas efficient swap recommendations.
Result is cached for future use but can be updated by re-calling.
Notice that outputToken is tokenOut if swapType == 'swapExactIn' and tokenIn if swapType == 'swapExactOut'
This fetches all Balancer pool information and on-chain balances.
Retrieves pool information from static IPFS file rather than Subgraph.
Retrieves on-chain balances using custom multicall contract.
Returns true on success or false on error.
Information is cached and used for all future processing, this results in fast processing of swaps, i.e. useful when changing swap amounts or types in a UI.
Accurate/valid swaps rely on upM to date balance information so it is recommended this function is re-called to refresh as needed.
Main function to process trade.
Will return amount expected and a list of swaps that can be executed on-chain.
A new ExchangeProxy contract that supports multihop swaps has been deployed to the addresses below. For contract details please see Exchange Proxy.