- Automated Routing: The POST
shortcuts/route
API calculates optimized multi-step paths for entering/exiting DeFi positions or swapping ERC20 tokens. It automatically creates a path between two positions specified in the request. - Bundling DeFi Actions: The POST
shortcuts/bundle
API lets you orchestrate DeFi workflows by composing multi-step sequences of Actions of your choosing.
Would
The
route
do the job? The
route
API might be the simpler way to route your assets.
Before using the bundle API, check if route
would work using happypath.EnsoShortcutRouter
for execution.
1. Automated Routing
The POSTroute
API is suitable for single-path operations with automatic optimization.
Token Swaps
Optimize conversions between tokens by leveraging automated routing across DEXs. Example: Swapping 1 ETH to USDC with the best execution price and 0.5% slippage- Input: 1 ETH
- Slippage: 0.5%
- Output: USDC worth of 1 ETH
Typescript SDK
Multi-Token Deposits
Deposit multiple tokens simultaneously into a liquidity pool to receive LP tokens in a single transaction. Example: Depositig 10 DAI + 10 USDC + 10 USDT to 3Crv LP tokens (Curve 3pool) in one step- Input: 10 DAI, 10 USDC, 10 USDT
- Slippage: 0.5%
- Output: 3Crv LP tokens
SDK
LST Staking Entry
Transform base tokens directly into staked liquid staking positions with a single call. Example: Converting 1 ETH to stETH (Lido Staked ETH) in one step- Input: 1 ETH
- Slippage: 0.5%
- Output: stETH
SDK
Yield Position Entry
Enter yield-generating positions from base assets. Example: Moving from 1 WETH to a Yearn vault (yvWETH)- Input: 1 WETH Output: yvWETH (exact amount depends on the vault’s share price)
- Slippage: 0.5%
SDK
Position Exit (Single Token)
Exit completely from a DeFi position back to a single base token. Example: Converting 1 yvWETH (Yearn ETH vault) back to WETH- Input: 1 yvWETH
- Output: WETH (actual amount depends on accrued yield)
- Slippage: 0.5%
SDK
LP Position Entry
Enter into LP token positions with automatic routing and slippage protection. Example: Going from 1 ETH to ETH/USDC Uniswap LP tokens- Output: ~0.92 ETH/USDC LP tokens (varies with pool composition)
- Slippage: 1%
SDK
Zap into a Morpho Blue Vault
Zap a Morpho USDC vault position, represented by0xc1fc3492f7b9c64871389d2a223eef6ccc165fb0
.
Example: Going from 1 ETH to Morpho USDC position
- Output: Morpho Blue USDC vault tokens
- Slippage: 3%
SDK
Simple LST Zapping
Direct entry into or exit from liquid staking tokens. Example: Converting 1 stETH back to ETH- Input: 1 stETH (Lido Staked ETH)
- Output: ETH (varies with current discount/premium)
- Slippage: 1%
SDK
2. Bundling DeFi Actions
The Bundle API (POST/v1/shortcuts/bundle
) excels at orchestrating complex sequences of operations.
Multi-Position Entry
Splitting funds across several positions simultaneously Example: Distributing 1 ETH into three LST tokens in one transaction- Input: 1 ETH
- Slippage: 1% for each conversion
- Outputs:
- stETH (Lido Staked ETH)
- rETH (Rocket Pool ETH)
- cbETH (Coinbase Staked ETH)
- Process:
- Convert 1/3 ETH (0.333 ETH) to stETH
- Convert 1/3 ETH (0.333 ETH) to rETH
- Convert 1/3 ETH (0.334 ETH) to cbETH
SDK
Single-Asset Zap into Uniswap V3 Concentrated Liquidity
Provide liquidity to a two-asset Uniswap V3 pool using a single token as input. Enso automatically handles swapping for the second token and balancing the pair before depositing. Example: Use AAVE to provide concentrated liquidity to a WETH/AAVE pool on Uniswap v3 on Arbitrum.- Input: 10 AAVE
- Output token: the
NonfungiblePositionManager
that mints and manages NFT-based receipts for provided liquidity. - Final Result: A Uniswap V3 NFT representing a concentrated liquidity position in the WETH/AAVE pool.
- Process:
- The
enso.split
action takes the input AAVE and swaps the optimal amount for WETH to create a balanced pair required by the Uniswap pool. - The
uniswap-v3.depositclmm
action takes the resulting WETH and AAVE from the previous step. - It deposits both tokens as liquidity into the specified pool within the defined tick range (
25320
to25980
).
- The
SDK
Multiple-Asset Zap to SushiSwap V3 LP
To deposit into Sushiswap V3AUSD/USDC
poool, you need to use the bundle
API.
Bundle Design:
- Input of 100
USDC
must be split into 2 tokens:AUSD
andUSDC
, using Enso’ssplit
action that converts 50% of USDC into AUSD, and keeps the rest untouched - Deposit using
depositclmm
action ofsushiswap-v3
protocol.tokenIn
are the pool’s tokens (USDC/AUSD
)amountIn
is an array of amounts obtained from the split intoUSDC
andAUSD
respectively, using dynamic quantity reference (useOutputOfCallAt
).- The
tokenOut
value is the address of Sushiswap’s position manager contract. - Provide correct fee and ticks.
Staking Pipeline
Chain multiple actions together to create a complete Curve LP staking workflow. Example: Creating a staked Curve 3pool position starting with 1 ETH- Input: 1 ETH
- Final Output: 3pool LP tokens staked in Curve gauge
- Process:
- Swap 1 ETH to USDC
- Deposit USDC into Curve 3pool to get 3pool LP tokens
- Stake 3pool LP tokens in the Curve gauge
SDK
Portfolio Rebalancing
Adjusting position sizes across multiple protocols. Example: Rebalancing from 70%ETH
+ 30% USDC
to 50% ETH
+ 50% USDC
across Aave positions
- Input: 0.6 WETH (for reallocation)
- Output:
- 0.4 WETH deposited to Aave (aWETH)
- ~$580 USDC (from 0.2 WETH) deposited to Aave (aUSDC)
- Process:
- Convert 0.2 WETH to USDC
- Deposit 0.4 WETH into Aave (aWETH position)
- Deposit the acquired USDC into Aave (aUSDC position)
SDK
Position Migration
Moving from one protocol to another Example: Migrating 1 aWETH from Aave to Compound’s cETH- Input: 1 aWETH (Aave WETH)
- Output: cETH (Compound ETH)
- Process:
- Withdraw 1 WETH from Aave by redeeming aWETH
- Unwrap WETH to ETH
- Deposit ETH into Compound to get cETH
SDK
Leveraged Positions
Creating leveraged positions through multiple actions Example: Creating a 2x ETH position using Aave- Input: 1 WETH initial collateral
- Final Result: WETH worth of collateral in Aave
- Process:
- Deposit 1 WETH as collateral in Aave
- Borrow ~1,000 USDC against the WETH collateral
- Swap the borrowed 1,000 USDC back to ~0.35 WETH
- Deposit the additional WETH back into Aave as more collateral
SDK
Zap into multiple LPs
Multi-step entry into or exit from liquid staking tokens with additional operations. Example: Creating diversified LP and LST positions with 1 ETH- Input: 1 ETH split evenly
- Slippage: 3% for each conversion
- Process:
- Convert 0.5 ETH to stETH/ETH Curve LP tokens
- Convert 0.5 ETH to BAL/WETH Balancer LP tokens
SDK
Yield Compounding Flow
Automate yield compounding by harvesting rewards, swapping, and redepositing in a single transaction. Example: Compounding Curve gauge rewards back into the stETH/ETH pool- Input: Existing position in stETH/ETH Curve gauge
- Slippage: 3%
- Process:
- Harvest accumulated wstETH rewards from the Curve gauge
- Convert wstETH rewards to stETH
- Deposit stETH back into the stETH/ETH Curve pool
SDK
Liquid Staking Derivative Looping
Create a leveraged position with liquid staking tokens through recursive borrowing and depositing in a lending protocol. Example: Implement a multi-loop leveraged position on Lido Staked ETH (wstETH) using Aave V3 as the lending platform.- Input: 10 wstETH
- Final Result: ~18.32 wstETH deposited with ~8.32 wstETH borrowed (1.83x leverage)
- Process:
- Deposit 10 wstETH as collateral into Aave V3
- Borrow 5.4 wstETH against your deposited collateral
- Deposit the borrowed wstETH back as additional collateral
- Borrow 2.916 wstETH against your increased collateral
- Deposit this amount back again as additional collateral
SDK
Updated