CompoundClient
The CompoundClient provides direct access to Compound V3 (Comet) markets on Base and Ethereum. Each Comet market has a single base (borrowable) asset and multiple collateral assets.
Compound V3’s architecture differs from Aave and Morpho. Each Comet contract is a standalone market with one borrowable asset. Supplying the base asset earns yield; supplying collateral enables borrowing.
Constructor
import { CompoundClient } from '@agether/sdk';
const compound = new CompoundClient({
privateKey: process.env.AGENT_PRIVATE_KEY!,
rpcUrl: 'https://base-rpc.publicnode.com',
agentId: '42',
chainId: 8453,
});
Configuration
| Parameter | Type | Required | Description |
|---|
privateKey | string | Yes | Agent wallet private key |
rpcUrl | string | Yes | RPC endpoint |
agentId | string | No | ERC-8004 agent ID |
chainId | number | No | Chain ID (default: 8453) |
Comet Markets
Each Comet contract is a standalone lending market with one base (borrowable) asset. Compound V3 dynamically discovers all available markets and their collateral assets on-chain.
Base (8453)
| Base Asset | Comet Address |
|---|
| USDC | 0xb125E6687d4313864e53df431d5425969c15Eb2F |
| WETH | 0x46e6b214b524310239732D51387075E0e70970bf |
| AERO | 0x784efeB622244d2348d4F2522f8860B96fbEcE89 |
| USDbC | 0x9c4ec768c28520B50860ea7a15ff6CBB6c323c |
Ethereum (1)
| Base Asset | Comet Address |
|---|
| USDC | 0xc3d688B66703497DAA19211EEdff47f25384cdc3 |
| WETH | 0xA17581A9E3356d9A858b789D68B4d866e593aE94 |
| USDS | 0x5D409e56D886231aDAf00c8775665AD0f9897b56 |
Methods
Supply collateral to a specific Comet market.
await compound.supplyCollateral(
'0xb125E6687d4313864e53df431d5425969c15Eb2F', // USDC Comet
'0x4200000000000000000000000000000000000006', // WETH
parseEther('0.1'),
);
Withdraw collateral from a Comet market.
await compound.withdrawCollateral(
'0xb125E6687d4313864e53df431d5425969c15Eb2F',
wethAddress,
parseEther('0.05'),
);
Borrow the base asset from a Comet market against deposited collateral.
await compound.borrow(
'0xb125E6687d4313864e53df431d5425969c15Eb2F', // USDC Comet
parseUnits('100', 6), // 100 USDC
);
Repay borrowed base asset.
await compound.repay(
'0xb125E6687d4313864e53df431d5425969c15Eb2F',
parseUnits('50', 6), // Repay 50 USDC
);
getPositions()
Get all positions across all Comet markets.
const positions = await compound.getPositions();
// Returns: { comet, baseToken, collateral, debt, ltv, healthFactor }[]
getMarkets()
Discover all Comet markets and their collateral assets dynamically.
const markets = await compound.getMarkets();
// Returns market info with base asset, collateral assets, APYs, utilization
Compound V3 vs Aave V3 vs Morpho Blue
| Feature | Compound V3 | Aave V3 | Morpho Blue |
|---|
| Architecture | Per-base-asset Comets | Single pool | Isolated markets |
| Borrowable assets | 1 per Comet | Many | 1 per market |
| Collateral types | Multiple per Comet | Multiple (pooled) | 1 per market |
| Health Factor | Per-Comet | Global | Per-market |
| Governance | COMP governance | AAVE governance | None (immutable) |
| Rewards | COMP token | None on Base | None |
| Liquidation | Absorbed by protocol | Auctioned | Oracle-based |
Compound V3 uses an “absorption” model for liquidation. When an account is underwater, the protocol absorbs the collateral and debt — no third-party liquidators needed.
Using via Plugin
The unified plugin tools support Compound as a protocol option:
agether_deposit(protocol="compound", token="WETH", amount="0.1")
agether_borrow(protocol="compound", token="USDC", amount="100")
agether_repay(protocol="compound", token="USDC", amount="all")
agether_withdraw(protocol="compound", token="WETH", amount="all")
Compound is also included in cross-protocol aggregation tools:
agether_status — shows Compound positions alongside Morpho and Aave
agether_markets — includes Compound markets in rate comparison
agether_health — checks Compound positions for liquidation risk
agether_yield_spread — compares yield opportunities across all three protocols