Skip to main content

Earn Yield

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

Supported protocols

ProtocolNetworksAssets
CompoundBase, MainnetUSDC, WETH
MorphoBase, MainnetUSDC, WETH
AaveBase, Mainnet, Arbitrum, OptimismUSDC, WETH
Use List Assets and List Networks for the full 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

const plan = await client.plan.earn(account.external_id, {
  amount: "1000000",   // 1 USDC
  asset: "USDC",
  network: "base",
  protocol: "compound",
});

3. Sign and execute

See the Plan-Sign-Execute concept guide for the full signing flow.
const signer = privateKeyToAccount(privateKey);
const signature = await signer.sign({ hash: plan.chart.eip712_data.digest });

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

4. Monitor

Poll activities to confirm the deposit:
const { activities } = await client.accounts.activities(account.external_id);
// Look for activity_type: "quark_operation_executed"
// with activity_metadata containing action_type: "COMET_SUPPLY"