Let users supply USDC directly to Morpho or Aave lending markets on Base.
Let users supply USDC to a third-party money market and manage the resulting protocol position from your app. Your app prepares and simulates each call; the user signs from their own wallet.
clients.ts creates Base mainnet public and wallet clients from a server-side PRIVATE_KEY that every example imports.
These snippets are illustrative. They show the shape of a supply integration on Base, not production-ready code. Follow each protocol’s own documentation for current addresses, SDK details, and risk parameters: Morpho and Aave.
Morpho
Aave
Supply to Morpho’s WETH/USDC market. Fetching by market ID avoids hardcoding its oracle, interest-rate model, and LLTV parameters.
supply-morpho.ts
import { publicClient, walletClient } from './clients.js';import { type MarketId } from '@morpho-org/blue-sdk';import { fetchMarketParams } from '@morpho-org/blue-sdk-viem';import { isRequirementSignature, morphoViemExtension,} from '@morpho-org/morpho-sdk';import { parseUnits } from 'viem';import { base } from 'viem/chains';const marketId = '0x8793cf302b8ffd655ab97bd1c695dbd967807e8367a65cb2f4edaf1380ba1bda' as MarketId;const user = walletClient.account.address;const client = publicClient.extend(morphoViemExtension());const params = await fetchMarketParams(marketId, publicClient);const market = client.morpho.blue(params, base.id);const action = market.supply({ amount: parseUnits('1000', 6), userAddress: user, marketData: await market.getMarketData(),});const signatures = [];for (const requirement of await action.getRequirements()) { if (isRequirementSignature(requirement)) { signatures.push(await requirement.sign(walletClient, user)); } else { const hash = await walletClient.sendTransaction(requirement); await publicClient.waitForTransactionReceipt({ hash }); }}const request = action.buildTx(signatures);await publicClient.call({ account: user, ...request });const hash = await walletClient.sendTransaction(request);await publicClient.waitForTransactionReceipt({ hash });
Resolve the Base Pool and asset addresses from Aave’s official address book, then approve and supply through the Aave V3 Pool with viem.
Supply rates are variable, withdrawals depend on market liquidity, and every integration inherits protocol, oracle, and approval risk. Display current terms and simulate the exact transaction before asking the user to sign.