Skip to main content

What is DeFi routing?

DeFi routing chooses a path from a source asset to a destination asset or position, often across venues, and returns an executable transaction.

J
Written by Javier Diaz

DeFi routing is choosing a path from a source asset to a destination asset or position, often across venues, and returning an executable transaction.

Definition

A route starts from what the user holds (tokenIn and amountIn) and targets what they want to receive (tokenOut). The routing service searches available paths, simulates the selected one, and returns the expected output plus the transaction the user signs.

How it works

  • The app requests a path for a source asset, amount, destination asset or position, and slippage or minimum output.

  • The service compares candidate paths, including swaps and, when relevant, deposits, withdrawals, or a bridge to another chain.

  • It simulates the chosen path and returns expected output, a minimum output when available, and signer-ready transaction data.

  • The user reviews the quote, then signs and submits that transaction. Routing is the path-finding step; bundling is specifying the action list yourself.

How Enso does this

Call POST https://api.enso.build/api/v1/shortcuts/route with chainId, fromAddress, tokenIn, tokenOut, amountIn, and slippage or minAmountOut (not both). Enso returns amountOut, minAmountOut, priceImpact, gas, and tx. For a fixed action list, use the Bundle API instead. See DeFi and Swap Routing and Core Concepts.

FAQ

Is routing the same as a routing strategy?

No. Routing is the path from source to destination. A routing strategy (router, delegate, or ensowallet-v2) chooses which account executes that path.

Does a route have to be a simple swap?

No. The same Route call can also zap into a position, exit a position, migrate between destinations, or, with destinationChainId, land on another chain.

Related articles

  • What is the difference between routing and bundling?

  • What is a DeFi routing and execution layer?

  • What is a routing strategy?

  • What is the Enso Route API?

  • What is price impact?

Sources

Did this answer your question?