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

# Earn Yield

> Deploy assets into DeFi yield protocols

# Earn Yield

This guide walks through depositing assets into a DeFi protocol to earn yield. For a complete quickstart, see the [Quickstart](/quickstart).

## Supported markets

### Compound

| Network  | Market  | Asset |
| -------- | ------- | ----- |
| Mainnet  | cUSDCv3 | USDC  |
| Mainnet  | cWETHv3 | WETH  |
| Mainnet  | cUSDTv3 | USDT  |
| Base     | cUSDCv3 | USDC  |
| Base     | cWETHv3 | WETH  |
| Arbitrum | cUSDCv3 | USDC  |
| Arbitrum | cUSDTv3 | USDT  |
| Arbitrum | cWETHv3 | WETH  |
| Optimism | cUSDCv3 | USDC  |
| Optimism | cUSDTv3 | USDT  |
| Optimism | cWETHv3 | WETH  |
| Unichain | cUSDCv3 | USDC  |
| Polygon  | cUSDTv3 | USDT  |

### Aave

| Network  | Market               | Asset                                                                           |
| -------- | -------------------- | ------------------------------------------------------------------------------- |
| Base     | Aave V3 BASE Market  | WETH, cbETH, wstETH, USDC, weETH, cbBTC, ezETH, GHO, wrsETH, EURC, AAVE         |
| Arbitrum | Arbitrum Aave Market | LINK, WBTC, WETH, USDT, AAVE, wstETH, rETH, USDC, ARB, weETH, GHO, ezETH, rsETH |
| Optimism | Optimism Aave Market | LINK, WBTC, WETH, USDT, AAVE, OP, wstETH, rETH, USDC                            |

### Morpho

| Network     | Vault      | Asset |
| ----------- | ---------- | ----- |
| Mainnet     | gtUSDCcore | USDC  |
| Base        | mwUSDC     | USDC  |
| World Chain | Re7USDC    | USDC  |
| World Chain | Re7WETH    | WETH  |
| World Chain | Re7WBTC    | WBTC  |
| World Chain | Re7WLD     | WLD   |
| Unichain    | gtusdt0c   | USDT  |
| Unichain    | gtwethc    | WETH  |
| Unichain    | gtusdcc    | USDC  |
| HyperEVM    | feUSDC     | USDC  |
| HyperEVM    | feUSDH     | USDH  |

Use [List Assets](/api-reference/list-assets) and [List Networks](/api-reference/list-networks) for the full programmatic list.

## Steps

### 1. Ensure the wallet is funded

The sub-account's `legend_wallet_address` must hold the asset you want to earn with. Transfer USDC (or another supported asset) to this address on the target network before creating a plan.

### 2. Create the earn plan

<CodeGroup>
  ```typescript TypeScript theme={null}
  const plan = await client.plan.earn(account.account_id, {
    amount: "1000000",   // 1 USDC
    asset: "USDC",
    network: "base",
    protocol: "compound",
  });
  ```

  ```python Python theme={null}
  plan = await client.plan.earn(
      account["account_id"],
      amount="1000000",   # 1 USDC
      asset="USDC",
      network="base",
      protocol="compound",
  )
  ```

  ```rust Rust theme={null}
  let plan = client
      .plan()
      .earn(
          &account.account_id,
          EarnParams {
              amount: "1000000".to_string(),   // 1 USDC
              asset: "USDC".to_string(),
              network: "base".to_string(),
              protocol: "compound".to_string(),
          },
      )
      .await?;
  ```
</CodeGroup>

### 3. Sign and execute

See the [Plan-Sign-Execute](/concepts/plan-execute-flow) concept guide for the full signing flow.

<CodeGroup>
  ```typescript TypeScript theme={null}
  const signer = privateKeyToAccount(privateKey);
  const signature = await signer.sign({ hash: plan.details.eip712_data.digest });

  const result = await client.plan.execute(account.account_id, {
    planId: plan.plan_id,
    signature,
  });
  ```

  ```python Python theme={null}
  signer = Account.from_key(private_key)
  digest = plan["details"]["eip712_data"]["digest"]
  sig = signer.unsafe_sign_hash(bytes.fromhex(digest[2:]))
  signature = "0x" + sig.signature.hex()

  result = await client.plan.execute(
      account["account_id"],
      plan_id=plan["plan_id"],
      signature=signature,
  )
  ```

  ```rust Rust theme={null}
  let digest = plan.digest().expect("Plan missing digest");
  let signature = signer.sign_hash(&digest)?;

  let result = client
      .plan()
      .execute(
          &account.account_id,
          ExecuteParams {
              plan_id: plan.plan_id.clone(),
              signature,
          },
      )
      .await?;
  ```
</CodeGroup>

### 4. Monitor

Poll activities to confirm the deposit:

<CodeGroup>
  ```typescript TypeScript theme={null}
  const { activities } = await client.accounts.activities(account.account_id);
  // Look for activity_type: "quark_operation_executed"
  // with activity_metadata containing action_type: "COMET_SUPPLY"
  ```

  ```python Python theme={null}
  result = await client.accounts.activities(account["account_id"])
  # Look for activity_type: "quark_operation_executed"
  # with activity_metadata containing action_type: "COMET_SUPPLY"
  ```

  ```rust Rust theme={null}
  let result = client
      .accounts()
      .activities(&account.account_id)
      .await?;
  // Look for activity_type: "quark_operation_executed"
  // with activity_metadata containing action_type: "COMET_SUPPLY"
  ```
</CodeGroup>
