> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enso.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Shortcuts Library

> Explore shortcuts for common DeFi workflows.

export const date_0 = "2025-11-03"

The Enso Shortcuts system offers two powerful APIs for building DeFi workflows:

* **Automated Routing**: The [POST `shortcuts/route`](/api-reference/defi-shortcuts/optimal-route-between-two-tokens) 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-reference/defi-shortcuts/bundle-a-list-of-actions) API lets you orchestrate DeFi workflows by composing multi-step sequences of [Actions](/pages/build/reference/actions) of your choosing.

<Tip>
  **Would `route` do the job?** <br />
  The `route` API might be the simpler way to route your assets.
  Before using the bundle API, check if `route` would work using [happypath](https://happypath.enso.build).
</Tip>

Both APIs return a transaction object with calldata representing your workflow, ready to be submitted to [`EnsoShortcutRouter`](https://etherscan.io/address/0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E#code) for execution.

## 1. Automated Routing

The POST `route` 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

<CodeGroup dropdown>
  ```ts Typescript SDK theme={null}
  import { parseUnits } from "ethers/lib/utils";

  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token Addresses
  const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
  const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";

  // Define amount
  const amountInEth = parseUnits("1", 18); // 1 ETH

  const route = await ensoClient.getRouteData({
    chainId,
    fromAddress,
    receiver: fromAddress,
    routingStrategy: "router",
    tokenIn: [ETH],
    tokenOut: [USDC],
    amountIn: [amountInEth],
    slippage: "50" // 0.5%
  });

  ```

  ```bash cURL theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/route' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '{
      "chainId": 1,
      "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "routingStrategy": "router",
      "receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
      "tokenOut": ["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"],
      "amountIn": ["1000000000000000000"],
      "slippage": "50"
    }' | jq
  ```
</CodeGroup>

<div class="border-b border-gray-300 my-4" />

### 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

<CodeGroup dropdown>
  ```ts SDK theme={null}
  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
  const receiver = "0x742d35Cc6634C0532925a3b844Bc454e4438f44e";

  // Token Addresses
  const DAI = "0x6B175474E89094C44Da98b954EedeAC495271d0F";
  const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
  const USDT = "0xdAC17F958D2ee523a2206206994597C13D831ec7";
  const curve3poolLp = "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490";

  // Define amounts
  const amountInDAI = parseUnits("10", 18);
  const amountInUSDC = parseUnits("10", 6);
  const amountInUSDT = parseUnits("10", 6);

  const route = await ensoClient.getRouteData({
    chainId,
    fromAddress,
    receiver,
    routingStrategy: "delegate",
    tokenIn: [DAI, USDC, USDT],
    tokenOut: [curve3poolLp],
    amountIn: [
      amountInDAI,
      amountInUSDC,
      amountInUSDT,
    ],
    slippage: "50" // 0.5%
  });

  ```

  ```bash cURL theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/route' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '{
      "chainId": 1,
      "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "routingStrategy": "delegate",
      "receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
      "tokenIn": [
        "0x6B175474E89094C44Da98b954EedeAC495271d0F",
        "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        "0xdAC17F958D2ee523a2206206994597C13D831ec7"
      ],
      "tokenOut": ["0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490"],
      "amountIn": [
        "10000000000000000000",
        "10000000",
        "10000000"
      ],
      "slippage": "50"
    }' | jq
  ```
</CodeGroup>

### 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

<CodeGroup dropdown>
  ```typescript SDK theme={null}
  import { parseUnits } from "ethers/lib/utils";

  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token Addresses
  const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
  const stETH = "0xae7ab96520de3a18e5e111b5eaab095312d7fe84";

  // Define amount
  const amountIn = parseUnits("1", 18); // 1 ETH

  const route = await ensoClient.getRouteData({
    chainId,
    fromAddress,
    receiver: fromAddress,
    routingStrategy: "router",
    tokenIn: [ETH],
    tokenOut: [stETH],
    amountIn: [amountIn],
    slippage: "50" // 0.5%
  });
  ```

  ```bash theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/route' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '{
      "chainId": 1,
      "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "routingStrategy": "router",
      "receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
      "tokenOut": ["0xae7ab96520de3a18e5e111b5eaab095312d7fe84"],
      "amountIn": ["1000000000000000000"],
      "slippage": "50"
    }'  | jq
  ```
</CodeGroup>

<div class="border-b border-gray-300 my-4" />

### 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%

<CodeGroup dropdown>
  ```ts SDK theme={null}
  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token Addresses
  const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
  const yvWETH = "0xa258c4606ca8206d8aa700ce2143d7db854d168c";

  // Define amount
  const amountIn = parseUnits("1", 18); // 1 WETH

  const route = await ensoClient.getRouteData({
    chainId,
    fromAddress,
    receiver: fromAddress,
    routingStrategy: "router",
    tokenIn: [WETH],
    tokenOut: [yvWETH],
    amountIn: [amountIn],
    slippage: "50" // 0.5%
  });
  ```

  ```bash theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/route' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '{
      "chainId": 1,
      "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "routingStrategy": "router",
      "receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "tokenIn": ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],
      "tokenOut": ["0xa258c4606ca8206d8aa700ce2143d7db854d168c"],
      "amountIn": ["1000000000000000000"],
      "slippage": "50"
    }'  | jq
  ```
</CodeGroup>

<div class="border-b border-gray-300 my-4" />

### 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%

<CodeGroup dropdown>
  ```typescript SDK theme={null}
  import { parseUnits } from "ethers/lib/utils";

  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token Addresses
  const yvWETH = "0xa258c4606ca8206d8aa700ce2143d7db854d168c";
  const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";

  // Define amount
  const amountIn = parseUnits("1", 18); // 1 yvWETH

  const route = await ensoClient.getRouteData({
    chainId,
    fromAddress,
    receiver: fromAddress,
    routingStrategy: "router",
    tokenIn: [yvWETH],
    tokenOut: [WETH],
    amountIn: [amountIn],
    slippage: "50" // 0.5%
  });
  ```

  ```bash cURL theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/route' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '{
      "chainId": 1,
      "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "routingStrategy": "router",
      "receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "tokenIn": ["0xa258c4606ca8206d8aa700ce2143d7db854d168c"],
      "tokenOut": ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],
      "amountIn": ["1000000000000000000"],
      "slippage": "50"
    }'
  ```
</CodeGroup>

<div class="border-b border-gray-300 my-4" />

### 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%

<CodeGroup dropdown>
  ```ts SDK theme={null}
  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token Addresses
  const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
  const uniswap_ETH_USDC_LP = "0x06325440d014e39736583c165c2963ba99faf14e";

  // Define amount
  const amountIn = parseUnits("1", 18); // 1 ETH

  const route = await ensoClient.getRouteData({
    chainId,
    fromAddress,
    receiver: fromAddress,
    routingStrategy: "router",
    tokenIn: [ETH],
    tokenOut: [uniswap_ETH_USDC_LP],
    amountIn: [amountIn],
    slippage: "100" // 1%
  });
  ```

  ```bash cURL theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/route' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '{
      "chainId": 1,
      "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "routingStrategy": "router",
      "receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
      "tokenOut": ["0x06325440d014e39736583c165c2963ba99faf14e"],
      "amountIn": ["1000000000000000000"],
      "slippage": "100"
    }'  | jq
  ```
</CodeGroup>

<div class="border-b border-gray-300 my-4" />

### Zap into a Morpho Blue Vault

Zap a Morpho USDC vault position, represented by `0xc1fc3492f7b9c64871389d2a223eef6ccc165fb0`.

**Example**: Going from 1 ETH to Morpho USDC position

* **Output**: Morpho Blue USDC vault tokens
* **Slippage**: 3%

<CodeGroup dropdown>
  ```typescript SDK theme={null}
  import { parseUnits } from "ethers/lib/utils";

  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token Addresses
  const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
  const morphoUsdcVault = "0xBEeFFF209270748ddd194831b3fa287a5386f5bC";

  // Define amount
  const amountIn = parseUnits("1", 18); // 1 ETH

  const route = await ensoClient.getRouteData({
    chainId,
    fromAddress,
    receiver: fromAddress,
    routingStrategy: "router",
    tokenIn: [ETH],
    tokenOut: [morphoUsdcVault],
    amountIn: [amountIn],
    slippage: "300" // 3%
  });
  ```

  ```bash theme={null}
  curl -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer 1e02632d-6feb-4a75-a157-documentation" \
    -d '{
      "chainId": 1,
      "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "amountIn": ["1000000000000000000"],
      "slippage": "300",
      "tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
      "tokenOut": ["0xBEeFFF209270748ddd194831b3fa287a5386f5bC"],
      "routingStrategy": "router"
    }' \
    "https://api.enso.build/api/v1/shortcuts/route" \
    | jq
  ```
</CodeGroup>

### 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%

<CodeGroup dropdown>
  ```ts SDK theme={null}
  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token Addresses
  const stETH = "0xae7ab96520de3a18e5e111b5eaab095312d7fe84";
  const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";

  // Define amount
  const amountIn = parseUnits("1", 18); // 1 stETH

  const route = await ensoClient.getRouteData({
    chainId,
    fromAddress,
    receiver: fromAddress,
    routingStrategy: "router",
    tokenIn: [stETH],
    tokenOut: [ETH],
    amountIn: [amountIn],
    slippage: "100" // 1%
  });
  ```

  ```bash theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/route' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '{
      "chainId": 1,
      "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "routingStrategy": "router",
      "receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "tokenIn": ["0xae7ab96520de3a18e5e111b5eaab095312d7fe84"],
      "tokenOut": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
      "amountIn": ["1000000000000000000"],
      "slippage": "100"
    }'  | jq
  ```
</CodeGroup>

*Note*: Limited to simple LST interactions without complex staking steps. Use Bundle API for multi-step LST staking flows.

## 2. Bundling DeFi Actions

The Bundle API (POST `/v1/shortcuts/bundle`) excels at orchestrating complex sequences of operations.

<div class="border-b border-gray-300 my-4" />

### 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**:
  1. stETH (Lido Staked ETH)
  2. rETH (Rocket Pool ETH)
  3. cbETH (Coinbase Staked ETH)
* **Process**:
  1. Convert 1/3 ETH (0.333 ETH) to stETH
  2. Convert 1/3 ETH (0.333 ETH) to rETH
  3. Convert 1/3 ETH (0.334 ETH) to cbETH

<CodeGroup dropdown>
  ```typescript SDK theme={null}
  import { parseUnits } from "ethers/lib/utils";

  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token Addresses
  const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
  const stETH = "0xae7ab96520de3a18e5e111b5eaab095312d7fe84";
  const rETH = "0xae78736cd615f374d3085123a210448e74fc6393";
  const cbETH = "0xbe9895146f7af43049ca1c1ae358b0541ea49704";

  // Define amounts
  const amountToStEth = parseUnits("0.333", 18);
  const amountToREth = parseUnits("0.333", 18);
  const amountToCbEth = parseUnits("0.334", 18);

  const bundle = await ensoClient.getBundleData(
  {
    chainId,
    fromAddress,
    routingStrategy: "delegate",
    },
    [
      {
        protocol: "enso",
        action: "route",
        args: {
          tokenIn: ETH,
          tokenOut: stETH,
          amountIn: amountToStEth,
          slippage: "100",
        },
      },
      {
        protocol: "enso",
        action: "route",
        args: {
          tokenIn: ETH,
          tokenOut: rETH,
          amountIn: amountToREth,
          slippage: "100",
        },
      },
      {
        protocol: "enso",
        action: "route",
        args: {
          tokenIn: ETH,
          tokenOut: cbETH,
          amountIn: amountToCbEth,
          slippage: "100",
        },
      },
    ],
  );
  ```

  ```bash theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '[
      {
        "protocol": "enso",
        "action": "route",
        "args": {
          "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
          "tokenOut": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
          "amountIn": "333000000000000000",
          "slippage": "100"
        }
      },
      {
        "protocol": "enso",
        "action": "route",
        "args": {
          "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
          "tokenOut": "0xae78736cd615f374d3085123a210448e74fc6393",
          "amountIn": "333000000000000000",
          "slippage": "100"
        }
      },
      {
        "protocol": "enso",
        "action": "route",
        "args": {
          "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
          "tokenOut": "0xbe9895146f7af43049ca1c1ae358b0541ea49704",
          "amountIn": "334000000000000000",
          "slippage": "100"
        }
      }
    ]' | jq
  ```
</CodeGroup>

<div class="border-b border-gray-300 my-4" />

### 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**:
  1. 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.
  2. The `uniswap-v3.depositclmm` action takes the resulting WETH and AAVE from the previous step.
  3. It deposits both tokens as liquidity into the specified pool within the defined tick range (`25320` to `25980`).

<CodeGroup dropdown>
  ```ts SDK theme={null}
  const chainId = 42161; // Arbitrum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token and Protocol Addresses
  const tokenIn_AAVE = "0xba5ddd1f9d7f570dc94a51479a000e3bce967196";
  const tokenOut_WETH = "0x82af49447d8a07e3bd95bd0d56f35241523fbab1";
  const uniswapManager = "0xc36442b4a4522e871399cd717abdd847ab11fe88";

  // Define amount
  const amountIn = parseUnits("10", 18); // 10 AAVE

  const bundle = await ensoClient.getBundleData(
  {
    chainId,
    fromAddress,
    routingStrategy: "router",
  },
  [
    {
      // Split AAVE into 2 equal parts
      // Converts the first half into WETH
      // needed for AAVE/WETH pool
      protocol: "enso",
      action: "split",
      args: {
        tokenIn: tokenIn_AAVE,
        tokenOut: [tokenOut_WETH, tokenIn_AAVE],
        amountIn: amountIn,
      },
    },
    {
      protocol: "uniswap-v3",
      action: "depositclmm",
      args: {
        tokenOut: uniswapManager,
        ticks: [25320, 25980],
        tokenIn: [tokenOut_WETH, tokenIn_AAVE],
        poolFee: "3000",
        amountIn: [
          // use output from the split call
          { useOutputOfCallAt: 0, index: 0 },
          { useOutputOfCallAt: 0, index: 1 },
        ],
      },
    },
  ]);

  const approvalData = await client.getApprovalData({
    amount: amountIn,
    chainId,
    fromAddress,
    tokenAddress: tokenIn_AAVE,
  });

  // Approve Enso Router contract (bundle.tx.to) to operate with tokens
  await signEoa(approvalData.tx, approvalData.gas);

  // Sign and send transaction with simulated gas to out-of-gas errors
  await signEoa(bundle.tx, bundle.gas);
  ```

  ```bash cURL theme={null}
  curl -X POST \
    "https://api.enso.build/api/v1/shortcuts/bundle?chainId=42161&amp;fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&amp;routingStrategy=router" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d "[
      {
        "protocol": "enso",
        "action": "split",
        "args": {
          "tokenIn": "0xba5ddd1f9d7f570dc94a51479a000e3bce967196",
          "tokenOut": [
            "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
            "0xba5ddd1f9d7f570dc94a51479a000e3bce967196"
          ],
          "amountIn": "10000000000000000000"
        }
      },
      {
        "protocol": "uniswap-v3",
        "action": "depositclmm",
        "args": {
          "tokenOut": "0xc36442b4a4522e871399cd717abdd847ab11fe88",
          "ticks": [
            25320,
            25980
          ],
          "tokenIn": [
            "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
            "0xba5ddd1f9d7f570dc94a51479a000e3bce967196"
          ],
          "poolFee": "3000",
          "amountIn": [
            {
              "useOutputOfCallAt": 0,
              "index": 0
            },
            {
              "useOutputOfCallAt": 0,
              "index": 1
            }
          ]
        }
      }
    ]" | jq
  ```
</CodeGroup>

### Multiple-Asset Zap to SushiSwap V3 LP

To deposit into Sushiswap V3 `AUSD/USDC` poool, you need to use the `bundle` API.

```mermaid theme={null}
flowchart LR
    A((USDC)) --> B{enso.split}
    
    subgraph split ["enso.split"]
        B -->|<b>swap</b> via<br/>enso| E((AUSD))
        B -->|<b>keep as</b><br/>USDC| F((USDC))
    end
    
    E -->|<b>depositclmm</b> via<br/>sushiswap-v3| G((LP NFT))
    F -->|<b>depositclmm</b> via<br/>sushiswap-v3| G
```

**Bundle Design**:

* Input of 100 `USDC` must be split into 2 tokens: `AUSD` and `USDC`, using Enso's `split` action that converts 50% of USDC into AUSD, and keeps the rest untouched
* Deposit using `depositclmm` action of `sushiswap-v3` protocol.
  * `tokenIn` are the pool's tokens (`USDC/AUSD`)
  * `amountIn` is an array of amounts obtained from the split into `USDC` and `AUSD` respectively, using dynamic quantity reference (`useOutputOfCallAt`).
  * The `tokenOut` value is the address of Sushiswap's position manager contract.
  * Provide correct fee and ticks.

```ts linenums="1"  theme={null}
export async function sushiswapV3() {
  const chainId = 747474;
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  const tokenIn_USDC = "0x203A662b0BD271A6ed5a60EdFbd04bFce608FD36";
  const tokenOut_AUSD = "0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a";
  const sushiswapManager = "0x2659C6085D26144117D904C46B48B6d180393d27";

  const amountIn = parseUnits("100", 6); // 100 USDC

  const bundle = await client.getBundleData(
    {
      chainId,
      fromAddress,
      routingStrategy: "router",
    },
    [
      {
        // Split USDC into 2 parts for the LP position
        protocol: "enso",
        action: "split",
        args: {
          tokenIn: tokenIn_USDC,
          tokenOut: [tokenOut_AUSD, tokenIn_USDC],
          amountIn: amountIn.toString(),
        },
      },
      {
        protocol: "sushiswap-v3", 
        action: "depositclmm",
        args: {
          tokenOut: sushiswapManager,
          ticks: [-114, -86],
          poolFee: "100", 
          tokenIn: [tokenOut_AUSD, tokenIn_USDC],
          amountIn: [
            { useOutputOfCallAt: 0, index: 0 }, // AUSD from split
            { useOutputOfCallAt: 0, index: 1 }, // USDC from split
          ],
        },
      },
    ]
  );

  const approvalData = await client.getApprovalData({
    amount: amountIn.toString(),
    chainId,
    fromAddress,
    tokenAddress: tokenIn_USDC,
  });

  // Approve Enso Router contract to operate with USDC
  await sendEoa(approvalData.tx, approvalData.gas);

  // Execute the bundle transaction
  await sendEoa(bundle.tx, bundle.gas);
  return bundle;
}
```

### 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**:
  1. Swap 1 ETH to USDC
  2. Deposit USDC into Curve 3pool to get 3pool LP tokens
  3. Stake 3pool LP tokens in the Curve gauge

<CodeGroup dropdown>
  ```typescript SDK theme={null}
  import { parseUnits } from "ethers/lib/utils";

  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token and Protocol Addresses
  const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
  const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
  const curve3poolLp = "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490";
  const curve3poolGauge = "0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A";
  const curve3pool = "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7";

  // Define amount
  const amountIn = parseUnits("1", 18); // 1 ETH

  const bundle = await ensoClient.getBundleData(
  {
    chainId,
    fromAddress,
    routingStrategy: "delegate",
  },
  [
    {
      protocol: "enso",
      action: "route",
      args: {
        tokenIn: ETH,
        tokenOut: USDC,
        amountIn: amountIn,
        slippage: "300",
      },
    },
    {
      protocol: "curve",
      action: "deposit",
      args: {
        tokenIn: USDC,
        tokenOut: curve3poolLp,
        amountIn: { useOutputOfCallAt: 0 },
        primaryAddress: curve3pool,
      },
    },
    {
    protocol: "curve-gauge",
    action: "deposit",
      args: {
        tokenIn: curve3poolLp,
        tokenOut: curve3poolGauge,
        amountIn: { useOutputOfCallAt: 1 },
        primaryAddress: curve3poolGauge,
      },
    },
  ]);
  ```

  ```bash theme={null}
  curl -X 'POST' \
    "https://api.enso.build/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate" \
    -H 'accept: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '[
      {
        "protocol": "enso",
        "action": "route",
        "args": {
          "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
          "tokenOut": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
          "amountIn": '1000000000000000000',
          "slippage": "300"
        }
      },
      {
        "protocol": "curve",
        "action": "deposit",
        "args": {
          "tokenIn": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
          "tokenOut": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
          "amountIn": {
            "useOutputOfCallAt": 0
          },
          "primaryAddress": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7"
        }
      },
      {
        "protocol": "curve-gauge",
        "action": "deposit",
        "args": {
          "tokenIn": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
          "tokenOut": "0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A",
          "amountIn": {
            "useOutputOfCallAt": 1
          },
          "primaryAddress": "0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A"
        }
      }
    ]' | jq
  ```
</CodeGroup>

<div class="border-b border-gray-300 my-4" />

### 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**:
  1. 0.4 WETH deposited to Aave (aWETH)
  2. \~\$580 USDC (from 0.2 WETH) deposited to Aave (aUSDC)
* **Process**:
  1. Convert 0.2 WETH to USDC
  2. Deposit 0.4 WETH into Aave (aWETH position)
  3. Deposit the acquired USDC into Aave (aUSDC position)

<CodeGroup dropdown>
  ```ts SDK theme={null}
  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token and Protocol Addresses
  const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
  const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
  const aWETH = "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8";
  const aUSDC = "0xbcca60bb61934080951369a648fb03df4f96263c";
  const aaveV3Pool = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";

  // Define amounts
  const amountToSwap = parseUnits("0.2", 18);
  const amountToDeposit = parseUnits("0.4", 18);

  const bundle = await ensoClient.getBundleData(
  {
    chainId,
    fromAddress,
    routingStrategy: "delegate",
  },
  [
    {
      protocol: "enso",
      action: "route",
      args: {
        tokenIn: WETH,
        tokenOut: USDC,
        amountIn: amountToSwap,
        slippage: "100",
      },
    },
    {
      protocol: "aave-v3",
      action: "deposit",
      args: {
        tokenIn: WETH,
        tokenOut: aWETH,
        amountIn: amountToDeposit,
        primaryAddress: aaveV3Pool,
      },
    },
    {
      protocol: "aave-v3",
      action: "deposit",
      args: {
        tokenIn: USDC,
        tokenOut: aUSDC,
        amountIn: { useOutputOfCallAt: 0 },
        primaryAddress: aaveV3Pool,
      },
    },
  ]);
  ```

  ```bash theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '[
      {
        "protocol": "enso",
        "action": "route",
        "args": {
          "tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
          "tokenOut": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
          "amountIn": "200000000000000000",
          "slippage": "100"
        }
      },
      {
        "protocol": "aave-v3",
        "action": "deposit",
        "args": {
          "tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
          "tokenOut": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
          "amountIn": "400000000000000000",
          "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
        }
      },
      {
        "protocol": "aave-v3",
        "action": "deposit",
        "args": {
          "tokenIn": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
          "tokenOut": "0xbcca60bb61934080951369a648fb03df4f96263c",
          "amountIn": {
            "useOutputOfCallAt": 0
          },
          "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
        }
      }
    ]' | jq
  ```
</CodeGroup>

<div class="border-b border-gray-300 my-4" />

### 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**:
  1. Withdraw 1 WETH from Aave by redeeming aWETH
  2. Unwrap WETH to ETH
  3. Deposit ETH into Compound to get cETH

<CodeGroup dropdown>
  ```typescript SDK theme={null}
  import { parseUnits } from "ethers/lib/utils";

  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token and Protocol Addresses
  const aWETH = "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8";
  const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
  const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
  const cETH = "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5";
  const aaveV3Pool = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";
  const compoundCEth = "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5";

  // Define amount
  const amountIn = parseUnits("1", 18); // 1 aWETH

  const bundle = await ensoClient.getBundleData(
  {
    chainId,
    fromAddress,
    routingStrategy: "delegate",
  },
  [
  {
    protocol: "aave-v3",
    action: "redeem",
      args: {
        tokenIn: aWETH,
        tokenOut: WETH,
        amountIn: amountIn,
        primaryAddress: aaveV3Pool,
      },
    },
    {
    protocol: "wrapped-native",
    action: "redeem",
      args: {
        tokenIn: WETH,
        tokenOut: ETH,
        amountIn: { useOutputOfCallAt: 0 },
        primaryAddress: WETH,
      },
    },
    {
    protocol: "compound-v2",
    action: "deposit",
      args: {
        tokenIn: ETH,
        tokenOut: cETH,
        amountIn: { useOutputOfCallAt: 1 },
        primaryAddress: compoundCEth,
      },
    },
    ],
  );
  ```

  ```bash theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '[
    {
      "protocol": "aave-v3",
      "action": "redeem",
      "args": {
        "tokenIn": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
        "tokenOut": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "amountIn": "1000000000000000000",
        "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
      }
    },
    {
      "protocol": "wrapped-native",
      "action": "redeem",
      "args": {
        "tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "tokenOut": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "amountIn": {
          "useOutputOfCallAt": 0
        },
        "primaryAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
      }
    },
    {
      "protocol": "compound-v2",
      "action": "deposit",
      "args": {
        "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "tokenOut": "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5",
        "amountIn": {
          "useOutputOfCallAt": 1
        },
        "primaryAddress": "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5"
      }
    }
  ]' | jq
  ```
</CodeGroup>

<div class="border-b border-gray-300 my-4" />

### 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**:
  1. Deposit 1 WETH as collateral in Aave
  2. Borrow \~1,000 USDC against the WETH collateral
  3. Swap the borrowed 1,000 USDC back to \~0.35 WETH
  4. Deposit the additional WETH back into Aave as more collateral

<CodeGroup dropdown>
  ```ts SDK theme={null}

  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token and Protocol Addresses
  const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
  const aWETH = "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8";
  const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
  const aaveV3Pool = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";

  // Define amounts
  const initialDeposit = parseUnits("1", 18);
  const borrowAmount = parseUnits("1000", 6);

  const bundle = await ensoClient.getBundleData(
  {
    chainId,
    fromAddress,
    routingStrategy: "delegate",
  },
  [
    {
      protocol: "aave-v3",
      action: "deposit",
      args: {
        tokenIn: WETH,
        tokenOut: aWETH,
        amountIn: initialDeposit,
        primaryAddress: aaveV3Pool,
      },
    },
    {
      protocol: "aave-v3",
      action: "borrow",
      args: {
        collateral: WETH,
        tokenOut: USDC,
        amountOut: borrowAmount,
        primaryAddress: aaveV3Pool,
      },
    },
    {
      protocol: "enso",
      action: "route",
      args: {
        tokenIn: USDC,
        tokenOut: WETH,
        amountIn: { useOutputOfCallAt: 1 },
        slippage: "100",
      },
    },
    {
      protocol: "aave-v3",
      action: "deposit",
      args: {
        tokenIn: WETH,
        tokenOut: aWETH,
        amountIn: { useOutputOfCallAt: 2 },
        primaryAddress: aaveV3Pool,
      },
    },
  ],
  );
  ```

  ```bash cURL theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '[
      {
        "protocol": "aave-v3",
        "action": "deposit",
        "args": {
          "tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
          "tokenOut": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
          "amountIn": "1000000000000000000",
          "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
        }
      },
      {
        "protocol": "aave-v3",
        "action": "borrow",
        "args": {
          "collateral": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
          "tokenOut": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
          "amountOut": "1000000000",
          "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
        }
      },
      {
        "protocol": "enso",
        "action": "route",
        "args": {
          "tokenIn": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
          "tokenOut": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
          "amountIn": {
            "useOutputOfCallAt": 1
          },
          "slippage": "100"
        }
      },
      {
        "protocol": "aave-v3",
        "action": "deposit",
        "args": {
          "tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
          "tokenOut": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
          "amountIn": {
            "useOutputOfCallAt": 2
          },
          "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
        }
      }
    ]' | jq
  ```
</CodeGroup>

<div class="border-b border-gray-300 my-4" />

### 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**:
  1. Convert 0.5 ETH to stETH/ETH Curve LP tokens
  2. Convert 0.5 ETH to BAL/WETH Balancer LP tokens

<CodeGroup dropdown>
  ```ts SDK theme={null}
  import { parseUnits } from "ethers/lib/utils";

  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token Addresses
  const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
  const curve_stETH_ETH_Lp = "0x06325440D014e39736583c165C2963BA99fAf14E";
  const balancer_BAL_WETH_Lp = "0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56";

  // Define amount
  const amountIn = parseUnits("0.5", 18);

  const bundle = await ensoClient.getBundleData(
  {
    chainId,
    fromAddress,
    routingStrategy: "delegate",
  },
  [
    {
      protocol: "enso",
      action: "route",
      args: {
        tokenIn: ETH,
        tokenOut: curve_stETH_ETH_Lp,
        amountIn: amountIn,
        slippage: "300",
      },
    },
    {
      protocol: "enso",
      action: "route",
        args: {
          tokenIn: ETH,
          tokenOut: balancer_BAL_WETH_Lp,
          amountIn: amountIn,
          slippage: "300",
        },
    },
  ]);
  ```

  ```bash theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '[
      {
        "protocol": "enso",
        "action": "route",
        "args": {
          "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
          "tokenOut": "0x06325440D014e39736583c165C2963BA99fAf14E",
          "amountIn": "500000000000000000",
          "slippage": "300"
        }
      },
      {
        "protocol": "enso",
        "action": "route",
        "args": {
          "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
          "tokenOut": "0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56",
          "amountIn": "500000000000000000",
          "slippage": "300"
        }
      }
    ]' | jq
  ```
</CodeGroup>

<div class="border-b border-gray-300 my-4" />

### 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**:
  1. Harvest accumulated wstETH rewards from the Curve gauge
  2. Convert wstETH rewards to stETH
  3. Deposit stETH back into the stETH/ETH Curve pool

<CodeGroup dropdown>
  ```ts SDK theme={null}
  // Token and Protocol Addresses
  const rewardToken_wstETH = "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0";
  const depositToken_stETH = "0xae7ab96520de3a18e5e111b5eaab095312d7fe84";
  const lpToken_curve_stETH_ETH = "0x06325440d014e39736583c165c2963ba99faf14e";
  const curveGauge = "0x182B723a58739a9c974cFDB385ceaDb237453c28";
  const curvePool = "0xDC24316b9AE028F1497c275EB9192a3Ea0f67022";

  const bundle = await ensoClient.getBundleData(
  {
    chainId,
    fromAddress,
    receiver: fromAddress,
    routingStrategy: "delegate",
  },
  [
    {
      protocol: "curve-gauge",
      action: "harvest",
      args: {
        token: rewardToken_wstETH,
        primaryAddress: curveGauge,
      },
    },
    {
      protocol: "enso",
      action: "route",
      args: {
        tokenIn: rewardToken_wstETH,
        tokenOut: depositToken_stETH,
        amountIn: { useOutputOfCallAt: 0 },
        slippage: "300",
      },
    },
    {
      protocol: "curve",
      action: "deposit",
      args: {
        tokenIn: depositToken_stETH,
        tokenOut: lpToken_curve_stETH_ETH,
        amountIn: { useOutputOfCallAt: 1 },
        primaryAddress: curvePool,
      },
    },
  ],
  );
  ```

  ```bash theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate&receiver=0xd8da6bf26964af9d7eed9e03e53415d37aa96045' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '[
        {
          "protocol": "curve-gauge",
          "action": "harvest",
          "args": {
            "token": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
            "primaryAddress": "0x182B723a58739a9c974cFDB385ceaDb237453c28"
          }
        },
        {
          "protocol": "enso",
          "action": "route",
          "args": {
            "tokenIn": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
            "tokenOut": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
            "amountIn": { "useOutputOfCallAt": 0 },
            "slippage": "300"
          }
        },
        {
          "protocol": "curve",
          "action": "deposit",
          "args": {
            "tokenIn": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
            "tokenOut": "0x06325440d014e39736583c165c2963ba99faf14e",
            "amountIn": { "useOutputOfCallAt": 1 },
            "primaryAddress": "0xDC24316b9AE028F1497c275EB9192a3Ea0f67022"
          }
        }
      ]
    ' | jq
  ```
</CodeGroup>

### 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**:
  1. Deposit 10 wstETH as collateral into Aave V3
  2. Borrow 5.4 wstETH against your deposited collateral
  3. Deposit the borrowed wstETH back as additional collateral
  4. Borrow 2.916 wstETH against your increased collateral
  5. Deposit this amount back again as additional collateral

<CodeGroup dropdown>
  ```typescript SDK theme={null}
  import { parseUnits } from "ethers/lib/utils";

  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token and Protocol Addresses
  const wstETH = "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0";
  const aWstETH = "0x0B925eD163218f6662a35E0F0371Ac234F9E9371";
  const aaveV3Pool = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";

  // Define amounts
  const initialDeposit = parseUnits("10", 18);
  const firstBorrow = parseUnits("5.4", 18);
  const secondBorrow = parseUnits("2.916", 18);

  const bundle = await ensoClient.getBundleData(
  {
    chainId,
    fromAddress,
    routingStrategy: "delegate",
  },
  [
  {
      protocol: "aave-v3",
      action: "deposit",
      args: {
        tokenIn: wstETH,
        tokenOut: aWstETH,
        amountIn: initialDeposit,
        primaryAddress: aaveV3Pool,
      },
    },
    {
      protocol: "aave-v3",
      action: "borrow",
      args: {
        collateral: wstETH,
        tokenOut: wstETH,
        amountOut: firstBorrow,
        primaryAddress: aaveV3Pool,
      },
    },
    {
      protocol: "aave-v3",
      action: "deposit",
      args: {
        tokenIn: wstETH,
        tokenOut: aWstETH,
        amountIn: firstBorrow,
        primaryAddress: aaveV3Pool,
      },
    },
    {
      protocol: "aave-v3",
      action: "borrow",
      args: {
        collateral: wstETH,
        tokenOut: wstETH,
        amountOut: secondBorrow,
        primaryAddress: aaveV3Pool,
      },
    },
    {
    protocol: "aave-v3",
    action: "deposit",
    args: {
      tokenIn: wstETH,
      tokenOut: aWstETH,
      amountIn: secondBorrow,
      primaryAddress: aaveV3Pool,
    },
  },
  ],
  );

  ```

  ```bash cURL theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '[
      {
        "protocol": "aave-v3",
        "action": "deposit",
        "args": {
          "tokenIn": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
          "tokenOut": "0x0B925eD163218f6662a35E0F0371Ac234F9E9371",
          "amountIn": "10000000000000000000",
          "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
        }
      },
      {
        "protocol": "aave-v3",
        "action": "borrow",
        "args": {
          "collateral": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
          "tokenOut": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
          "amountOut": "5400000000000000000",
          "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
        }
      },
      {
        "protocol": "aave-v3",
        "action": "deposit",
        "args": {
          "tokenIn": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
          "tokenOut": "0x0B925eD163218f6662a35E0F0371Ac234F9E9371",
          "amountIn": "5400000000000000000",
          "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
        }
      },
      {
        "protocol": "aave-v3",
        "action": "borrow",
        "args": {
          "collateral": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
          "tokenOut": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
          "amountOut": "2916000000000000000",
          "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
        }
      },
      {
        "protocol": "aave-v3",
        "action": "deposit",
        "args": {
          "tokenIn": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
          "tokenOut": "0x0B925eD163218f6662a35E0F0371Ac234F9E9371",
          "amountIn": "2916000000000000000",
          "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
        }
      }
    ]' | jq
  ```
</CodeGroup>

<div class="border-b border-gray-300 my-4" />

### Cross-Chain Route-Bridge

Execute a route and bridge tokens to another chain in a single transaction using the route-bridge functionality.

**Example**: Bridging 1 ETH from Ethereum to Optimism and converting to USDT

* **Input**: 1 ETH on Ethereum
* **Output**: USDT on Optimism
* **Process**:
  1. Route 1 ETH to USDT on Ethereum
  2. Bridge the resulting USDT to Optimism
  3. Receive USDT on Optimism

<Warning>
  **Important**: When using `destinationChainId`, you **must** include `refundReceiver` to handle any potential refunds from failed bridge operations.
</Warning>

<CodeGroup dropdown>
  ```ts SDK theme={null}
  const chainId = 1; // Ethereum
  const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  // Token Addresses
  const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
  const USDT_optimism = "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58";

  // Define amount
  const amountIn = parseUnits("1", 18); // 1 ETH

  const bundle = await ensoClient.getBundleData(
    {
      chainId,
      fromAddress,
      routingStrategy: "delegate",
    },
    [
      {
        protocol: "enso",
        action: "route",
        args: {
          tokenIn: ETH, // ETH on Ethereum
          tokenOut: USDT_optimism, // USDT on Optimism
          amountIn: amountIn,
          destinationChainId: 10, // Optimism
          refundReceiver: fromAddress, // Required for route-bridge
        },
      },
    ],
  );
  ```

  ```bash cURL theme={null}
  curl -X POST \
    'https://api.enso.build/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -d '[
      {
        "protocol": "enso",
        "action": "route",
        "args": {
          "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
          "tokenOut": "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58",
          "amountIn": "1000000000000000000",
          "destinationChainId": 10,
        }
      }
    ]' | jq
  ```
</CodeGroup>

<div className="text-right text-xs gray-200 font-semibold w-full" style={{marginTop: '0'}}>
  <p style={{
        color: "#b2b2b2"  
    }}>Updated {date_0}</p>
</div>
