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

# Deposit Examples

> Deposit into Composer-supported protocols through the LI.FI API: one end-to-end flow and the quote parameters for each protocol.

Every Composer deposit, into a vault, staking protocol or lending market, uses the same `GET /quote` request with `toToken` set to the protocol's position token. This page shows the full flow once, then lists the parameters for each protocol. The same `toToken` addresses work with `POST /advanced/routes` and the [LI.FI SDK](https://docs.li.fi/composer/lifi-api/guides/sdk-integration.md). The routing engine may return a DEX route into the same token instead of Composer; either way, the user receives the requested token.

***

## Deposit flow

This script deposits 1 USDC into the Spark-curated Morpho USDC vault on Base: quote, approve, send, and poll status when the route is cross-chain. To use another protocol, replace the quote parameters with a row from [Protocol parameters](#protocol-parameters) and set `chain` to the viem chain of `fromChain`.

```bash curl theme={"system"}
curl -X GET 'https://li.quest/v1/quote?fromChain=8453&toChain=8453&fromToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&toToken=0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A&fromAddress=0xYOUR_WALLET_ADDRESS&toAddress=0xYOUR_WALLET_ADDRESS&fromAmount=1000000&slippage=0.005'
```

```ts TypeScript theme={"system"}
import axios from "axios";
import {
  createPublicClient,
  createWalletClient,
  erc20Abi,
  http,
  zeroAddress,
  type Address,
  type Hex,
} from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const API_URL = "https://li.quest/v1";
const chain = base; // viem chain of fromChain

// Read the key from an environment variable; never hard-code it.
const account = privateKeyToAccount(process.env.PRIVATE_KEY as Hex);
const publicClient = createPublicClient({ chain, transport: http() });
const walletClient = createWalletClient({ account, chain, transport: http() });

const params = {
  fromChain: 8453, // Base
  toChain: 8453, // Base
  fromToken: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC on Base
  toToken: "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A", // Morpho vault token (sparkUSDC)
  fromAddress: account.address,
  toAddress: account.address, // receives the position tokens
  fromAmount: "1000000", // 1 USDC (6 decimals)
  slippage: 0.005,
};
const getQuote = async () =>
  (await axios.get(`${API_URL}/quote`, { params })).data;

// 1. Get a quote
let quote = await getQuote();
const usesComposer = quote.includedSteps.some(
  (step: { tool: string }) => step.tool === "composer",
);
console.log("Composer route:", usesComposer, "| output:", quote.estimate.toAmount);

// 2. Approve the address from the quote (native tokens need no approval),
//    then re-fetch the quote for fresh gas data
const fromToken = quote.action.fromToken.address as Address;
const approvalAddress = quote.estimate.approvalAddress as Address;
const amount = BigInt(quote.action.fromAmount);
if (fromToken !== zeroAddress) {
  const allowance = await publicClient.readContract({
    address: fromToken,
    abi: erc20Abi,
    functionName: "allowance",
    args: [account.address, approvalAddress],
  });
  if (allowance < amount) {
    const approveHash = await walletClient.writeContract({
      address: fromToken,
      abi: erc20Abi,
      functionName: "approve",
      args: [approvalAddress, amount],
    });
    await publicClient.waitForTransactionReceipt({ hash: approveHash });
    quote = await getQuote();
  }
}

// 3. Send the transaction
const hash = await walletClient.sendTransaction({
  to: quote.transactionRequest.to as Address,
  data: quote.transactionRequest.data as Hex,
  value: BigInt(quote.transactionRequest.value),
  gas: BigInt(quote.transactionRequest.gasLimit),
  gasPrice: BigInt(quote.transactionRequest.gasPrice),
});
const receipt = await publicClient.waitForTransactionReceipt({ hash });
console.log("Confirmed in block:", receipt.blockNumber);

// 4. Cross-chain only: poll status until the transfer finishes
if (quote.action.fromChainId !== quote.action.toChainId) {
  let status;
  do {
    await new Promise((r) => setTimeout(r, 5000));
    const { data } = await axios.get(`${API_URL}/status`, {
      params: {
        txHash: hash,
        fromChain: quote.action.fromChainId,
        toChain: quote.action.toChainId,
      },
    });
    status = data;
  } while (status.status !== "DONE" && status.status !== "FAILED");
  // DONE + PARTIAL: the bridge delivered, but the deposit did not run
  console.log("Final status:", status.status, status.substatus);
}
```

For cross-chain status values and `PARTIAL` handling, see [Cross-chain deposits](https://docs.li.fi/composer/lifi-api/guides/cross-chain-compose.md#status-tracking).

***

## Protocol parameters

Replace `fromChain`, `toChain`, `fromToken`, `toToken` and `fromAmount` in the script with a row below. For every supported position token, see [Supported Protocols & Chains](https://docs.li.fi/composer/protocols-and-chains.md).

| Deposit | `fromChain` → `toChain` | `fromToken` | `toToken` | Example `fromAmount` |
| - | - | - | - | - |
| USDC → Morpho vault (sparkUSDC) | `8453` → `8453` (Base) | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` (USDC) | `0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A` | `1000000` (1 USDC) |
| USDC → Aave V3 (aEthUSDC) | `1` → `1` (Ethereum) | `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48` (USDC) | `0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c` | `1000000000` (1,000 USDC) |
| USDe → Ethena (sUSDe) | `1` → `1` (Ethereum) | `0x4c9EDD5852cd905f086C759E8383e09bff1E68B3` (USDe) | `0x9D39A5DE30e57443BfF2A8307A4256c8797A3497` | `1000000000000000000000` (1,000 USDe, 18 decimals) |
| USDC → Euler V2 (eUSDC-2) | `1` → `1` (Ethereum) | `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48` (USDC) | `0x797DD80692c3b2dAdabCe8e30C07fDE5307D48a9` | `1000000000` (1,000 USDC) |
| USDC → Maple (syrupUSDC) | `1` → `1` (Ethereum) | `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48` (USDC) | `0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b` | `1000000000` (1,000 USDC) |
| USDT0 → Felix Vanilla (feUSDT0) | `999` → `999` (HyperEVM) | `0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb` (USDT0) | `0xFc5126377F0efc0041C0969Ef9BA903Ce67d151e` | `1000000000` (1,000 USDT0) |
| USDC → Neverland (nUSDC) | `143` → `143` (Monad) | `0x754704Bc059F8C67012fEd69BC8A327a5aafb603` (USDC) | `0x38648958836eA88b368b4ac23b86Ad44B0fe7508` | `1000000000` (1,000 USDC) |
| ETH → Morpho vault on Base (cross-chain) | `1` (Ethereum) → `8453` (Base) | `0x0000000000000000000000000000000000000000` (native ETH) | `0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A` | `100000000000000000` (0.1 ETH) |
| USDC → Morpho vault on Base (cross-chain) | `1` (Ethereum) → `8453` (Base) | `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48` (USDC) | `0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A` | `1000000000` (1,000 USDC) |

For the cross-chain rows, use slippage `0.01` and set `chain` to `mainnet`. The ETH row needs no approval. For both, the route bridges to Base, then deposits through Composer or buys the vault token on a DEX if that is cheaper; `includedSteps` shows which. `GET /quote` returns a one-transaction route in which the bridge runs the deposit on Base.

### Maple (syrupUSDC)

> [!NOTE]
>
> syrupUSDC is a permissioned pool: Maple must authorize the depositing address.
> See [Permissioned Products & Compliance](https://docs.li.fi/composer/permissioned-products-and-compliance.md)
> for how Composer handles the authorization. This applies when the quote uses
> Composer; a DEX route into syrupUSDC needs no authorization.

### Pendle yield tokens

Composer supports [Pendle](https://www.pendle.finance/) deposits and withdrawals. Pendle PT and YT tokens expire, so take a current market token from [Supported Protocols & Chains](https://docs.li.fi/composer/protocols-and-chains.md) (filter by `pendle`) and use it as `toToken`, with `fromChain` and `toChain` set to the market's chain.

***

## Depositing on behalf of another address

Set `toAddress` to the recipient. The sender pays from `fromAddress`; the position tokens go to `toAddress`.

> [!NOTE]
>
> For cross-chain deposits with a different `toAddress`, LI.FI by default only
> returns routes where the bridge runs the deposit as a destination call (one
> transaction). Two-transaction routes are not offered in this case.

***

## Deposit-only protocols

Some protocols, for example Ethena (sUSDe), Kinetiq and Maple, support deposits but not withdrawals through Composer. In [Supported Protocols & Chains](https://docs.li.fi/composer/protocols-and-chains.md), a protocol with `enter-position` edges but no `exit-position` edges is deposit-only.

***

## Next steps

> [card] [Withdrawals](https://docs.li.fi/composer/lifi-api/guides/withdrawals.md)
>
> Withdraw from protocol positions via Composer

> [card] [Cross-chain deposits](https://docs.li.fi/composer/lifi-api/guides/cross-chain-compose.md)
>
> Route shapes, status polling and partial failure handling


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.