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

# Zap to Collateral

> Automatically zap any input token as collateral to arbitrary vault tokens

Automatically convert any token into the required vault token and deposit as collateral in a single transaction.

In this example, we're zapping WETH to an AAVE `aUSDT` position.

```mermaid theme={null}
flowchart LR
    WETH((WETH)) -->|barter<br/>swap| USDT((USDT))
    USDT -->|aave-v3<br/>deposit| aUSDT((aUSDT))
```

```typescript lines theme={null}
const WETH: Address = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; // WETH
const aUSDT: Address = "0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a";
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;

const routeParams: RouteParams = {
  tokenIn: [WETH],
  tokenOut: [aUSDT],
  amountIn: ["1000000000000000000"],
  chainId: 1,
  routingStrategy: "router",
  fromAddress,
};

const approvalData = await client.getApprovalData({
  amount: routeParams.amountIn[0],
  chainId: 1,
  tokenAddress: WETH,
  fromAddress,
});

const route = await client.getRouteData(routeParams);
await sendEoa(approvalData.tx, approvalData.gas);
await sendEoa(route.tx, route.gas);
```

## Zap Deposits

### **Zap ETH to lend on Aave V3 on Arbitrum**

Deposit WETH into Aave on Arbitrum.

[Try this route →](https://happypath.enso.build/?tokenIn=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1\&outChainId=42161\&chainId=42161\&tokenOut=0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8\&amountIn=1000000000000000000)

**Route Mechanics:**

* **Deposit into Aave V3**: The input `WETH` is deposited into the Aave V3 protocol, and in return, you receive `aWETH`, representing your lending position.

```mermaid theme={null}
flowchart LR
    WETH((WETH)) -->|aave-v3<br/>deposit| aWETH((aWETH))
```

```javascript lines theme={null}
const WETH = "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1";
const aWETH = "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8";

const routeParams = {
  fromAddress: userAddress,
  receiver: userAddress,
  chainId: 42161, // Arbitrum
  amountIn: ["1000000000000000000"], // 1 WETH
  tokenIn: [WETH],
  tokenOut: [aWETH],
  routingStrategy: "router",
};

const route = await client.getRouteData(routeParams);

const approval = await client.getApprovalData({
  chainId: 42161,
  fromAddress: userAddress,
  amount: "1000000000000000000",
  tokenAddress: WETH,
});

// Approval transaction for `router` strategy
await sendEoa(approval.tx, approval.gas);
// Sending the actual transaction
await sendEoa(route.tx, route.gas);
```

***

### **Zap ETH to lend on Euler V2 on Mainnet**

Supply ETH to the Euler V2 lending market on the Ethereum Mainnet. This route provides a seamless way to start earning interest on your ETH.

[Try this route →](https://happypath.enso.build/?tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&outChainId=1\&chainId=1\&tokenOut=0xb3b36220fA7d12f7055dab5c9FD18E860e9a6bF8\&amountIn=1000000000000000000)

**Route Mechanics:**

* **Wrap**: The input `ETH` is first wrapped into `WETH`.
* **Deposit**: The `WETH` is then deposited into the Euler V2 protocol, and you receive `eWETH` in return.

```mermaid theme={null}
flowchart LR
    ETH((ETH)) -->|wrapped-native<br/>deposit| WETH((WETH))
    WETH -->|euler-v2<br/>deposit| eWETH((eWETH))
```

```javascript lines theme={null}
const ETH = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const eWETH = "0xb3b36220fA7d12f7055dab5c9FD18E860e9a6bF8";

const routeParams = {
  fromAddress: userAddress,
  receiver: userAddress,
  chainId: 1, // Ethereum
  amountIn: ["1000000000000000000"], // 1 ETH
  tokenIn: [ETH],
  tokenOut: [eWETH],
  routingStrategy: "router",
};

const route = await client.getRouteData(routeParams);
// Approval transaction for `router` strategy

const approval = await client.getApprovalData({
  chainId: 1,
  fromAddress: userAddress,
  amount: "1000000000000000000",
  tokenAddress: ETH,
});

// Approval transaction for `router` strategy
await sendEoa(approval.tx, approval.gas);

// Sending the actual transaction
await sendEoa(route.tx, route.gas);
```

***

### **Lend USDC on Spark on Gnosis**

Supply USDC to Spark's money market on the Gnosis chain. This route provides a direct way to enter a lending position.

[Try this route →](https://happypath.enso.build/?tokenIn=0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83\&outChainId=100\&chainId=100\&tokenOut=0x5850d127a04ed0b4f1fcdfb051b3409fb9fe6b90\&amountIn=100000000)

**Route Mechanics:**

* **Deposit into Spark**: Your `USDC` is deposited into the Spark-lend protocol, and you receive `spUSDC` in return, which represents your share in the lending pool.

```mermaid theme={null}
flowchart LR
    USDC((USDC)) -->|spark-lend<br/>deposit| spUSDC((spUSDC))
```

```javascript lines theme={null}
const USDC = "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83";
const spUSDC = "0x5850d127a04ed0b4f1fcdfb051b3409fb9fe6b90";

const routeParams = {
  fromAddress: userAddress,
  receiver: userAddress,
  chainId: 100, // Gnosis
  amountIn: ["100000000"], // 100 USDC
  tokenIn: [USDC],
  tokenOut: [spUSDC],
  routingStrategy: "router",
};


const route = await client.getRouteData(routeParams);

// approval TX
const approvalData = await client.getApprovalData({
  chainId: 100,
  fromAddress: userAddress,
  amount: "100000000",
  tokenAddress: USDC,
});
await sendEoa(approvalData.tx, approvalData.gas);



// Sending the actual transaction
await sendEoa(route.tx, route.gas);
```

***
