Blog

@Uniswap 's Universal Router simply explained

Uniswap has a Universal Router which allows users to execute different operations, including but not limited to:

- v2 swaps

- v3 swaps

- wrap/unwrap ETH

All of these different operations and more can be invoked the same way:

The dispatch function you can see here might look a bit complex on the first view, but actually it is pretty trivial.

The caller can simply invoke the execute function by providing an argument of different operations and a corresponding array of calldatas:

It will simply loop over all commands, execute each command following the approach above with the corresponding input/calldata.

That means you can combine several operations (v2Swaps, v3Swaps, refunds, etc) in one single transaction.

There's a lot more to tell about this architecture so if you're interested leave a comment.