Comment on page

Swap Aggregation


In Rango, we batch multiple transactions in a single transaction whenever possible.
For example, imagine the user wants to swap its MATIC on Polygon to USDC on Osmosis. The usual route would be to first swap MATIC to AXLUSDC and then bridge it using Satellite(Axelar) to Osmosis.
But Rango can aggregate these two steps in a single step, enabling to swap and bridge in the same transaction as it can be seen in image below:
Using an aggregator in Rango, swapping MATIC on polygon to USDC on osmosis in a single transaction.
To enable this feature, Rango uses smart contracts. Also message passing protocols are used to batch three step transactions into a single transaction.
For example, in the case below, IBC+Osmosis+IBC steps are batched into a single transaction. IBC protocol is used for both bridging and message passing. As a result, the user can convert its native ATOM to native JUNO in a single transaction using trust-less protocols.
Using an aggregator in Rango, swapping ATOM on cosmos to JUNO on juno in a single transaction, using IBC and osmosis swaps.

Slippage Handling

Since aggregations batch multiple transactions into a single transaction, the slippage could be applied at each step. There is a trade-off between slippage and transaction failure rate in the case of on-chain swaps. To reduce failure rate without exposing the user to higher slippage, in case of three-step aggregations, we try to use half the slippage for the initial step to leave enough room for the third step transaction.
For example if the user sets max slippage tolerance of 3% for a batch of swap+bridge+swap aggregation, on the first swap we only use 1.5% slippage tolerance. This both helps prevent MEV in the first step and also reduce error rates in the third step.