/compound-v3-comet:comet-architecturefrom compound-v3-comet
This skill should be used when the user asks about "Compound V3", "Comet", "protocol architecture", "monolithic", or needs a high-level understanding of the Compound V3 Comet protocol.
Ships in compound-v3-comet. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Compound V3 (Comet) is a monolithic money market protocol optimized for borrowing a single base asset (e.g., USDC) against multiple collateral assets. Unlike V2's per-asset markets, Comet consolidates everything into one efficient contract.
┌──────────────────────────────────────────────────────────────┐
│ COMET ARCHITECTURE │
├──────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Comet Proxy │ │
│ │ (TransparentProxy) │ │
│ └────────────────────────┬────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Comet.sol │ │
│ │ • Supply/Withdraw base token │ │
│ │ • Supply/Withdraw collateral │ │
│ │ • Transfer assets │ │
│ │ • Absorb (liquidate) accounts │ │
│ │ • Buy collateral from reserves │ │
│ │ • Interest accrual │ │
│ └────────────────────────┬────────────────────────────────┘ │
│ │ fallback() │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ CometExt.sol │ │
│ │ • ERC20 approve/allowance │ │
│ │ • allowBySig (EIP-712) │ │
│ │ • View functions (name, symbol) │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
│ Supplementary Contracts: │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Bulker │ Batch multiple actions in one tx │ │
│ │ CometRewards │ Claim COMP rewards │ │
│ │ Configurator │ Governance configuration │ │
│ │ CometFactory │ Deploy new Comet implementations │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────┘
allow// Comet.sol - Main protocol implementation
contract Comet is CometMainInterface {
// Immutable configuration (set at deploy, never changes)
address public immutable governor;
address public immutable pauseGuardian;
address public immutable baseToken; // e.g., USDC
address public immutable baseTokenPriceFeed; // Chainlink oracle
address public immutable extensionDelegate; // CometExt address
// Interest rate model (kinked)
uint public immutable supplyKink;
uint public immutable supplyPerSecondInterestRateSlopeLow;
uint public immutable supplyPerSecondInterestRateSlopeHigh;
uint public immutable borrowKink;
uint public immutable borrowPerSecondInterestRateSlopeLow;
uint public immutable borrowPerSecondInterestRateSlopeHigh;
// Collateral configuration (packed for gas)
uint8 public immutable numAssets; // Up to 12 assets
}
// CometExt.sol - Extension for additional functions
contract CometExt is CometExtInterface {
function approve(address spender, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function allow(address manager, bool isAllowed_) external;
function allowBySig(...) external; // EIP-712 signatures
}
// CometStorage.sol
contract CometStorage {
// Global market state (packed into 2 slots)
uint64 internal baseSupplyIndex; // Interest index for suppliers
uint64 internal baseBorrowIndex; // Interest index for borrowers
uint64 internal trackingSupplyIndex; // Reward tracking for suppliers
uint64 internal trackingBorrowIndex; // Reward tracking for borrowers
uint104 internal totalSupplyBase; // Total base principal supplied
uint104 internal totalBorrowBase; // Total base principal borrowed
uint40 internal lastAccrualTime; // Last interest accrual timestamp
uint8 internal pauseFlags; // Pause state for functions
// Per-collateral totals
mapping(address => TotalsCollateral) public totalsCollateral;
// User state
mapping(address => UserBasic) public userBasic;
mapping(address => mapping(address => UserCollateral)) public userCollateral;
mapping(address => mapping(address => bool)) public isAllowed;
}
struct UserBasic {
int104 principal; // Base balance (+ = supply, - = borrow)
uint64 baseTrackingIndex; // User's last tracking index
uint64 baseTrackingAccrued; // Accumulated reward points
uint16 assetsIn; // Bit vector of collateral assets
uint8 _reserved;
}
// CometConfiguration.sol
struct Configuration {
address governor;
address pauseGuardian;
address baseToken;
address baseTokenPriceFeed;
address extensionDelegate;
// Interest rate model parameters
uint64 supplyKink;
uint64 supplyPerYearInterestRateSlopeLow;
uint64 supplyPerYearInterestRateSlopeHigh;
uint64 supplyPerYearInterestRateBase;
uint64 borrowKink;
uint64 borrowPerYearInterestRateSlopeLow;
uint64 borrowPerYearInterestRateSlopeHigh;
uint64 borrowPerYearInterestRateBase;
// Other parameters
uint64 storeFrontPriceFactor;
uint64 trackingIndexScale;
uint64 baseTrackingSupplySpeed;
uint64 baseTrackingBorrowSpeed;
uint104 baseMinForRewards;
uint104 baseBorrowMin;
uint104 targetReserves;
AssetConfig[] assetConfigs; // Collateral assets
}
struct AssetConfig {
address asset;
address priceFeed;
uint8 decimals;
uint64 borrowCollateralFactor; // CF for initiating borrows
uint64 liquidateCollateralFactor; // CF for liquidation check
uint64 liquidationFactor; // Penalty applied at liquidation
uint128 supplyCap;
}
Comet uses principal (day-zero balances) for efficient storage:
// Present Value = Principal × Index
// Principal = Present Value / Index
// Supply balance: principal is positive
int presentValue = presentValue(principal);
// If principal > 0: presentValue = principal * baseSupplyIndex
// If principal < 0: presentValue = principal * baseBorrowIndex
// Converting back
int104 principalNew = principalValue(presentValue);
This allows a single signed integer to represent both supply and borrow positions.
Users can delegate account management to other addresses:
// Allow manager to act on behalf of owner
function allow(address manager, bool isAllowed_) external;
// EIP-712 gasless signature-based approval
function allowBySig(
address owner,
address manager,
bool isAllowed_,
uint256 nonce,
uint256 expiry,
uint8 v, bytes32 r, bytes32 s
) external;
// Check permission
function hasPermission(address owner, address manager) public view returns (bool) {
return owner == manager || isAllowed[owner][manager];
}
Comet uses Chainlink price feeds:
function getPrice(address priceFeed) public view returns (uint256) {
(, int price, , , ) = IPriceFeed(priceFeed).latestRoundData();
if (price <= 0) revert BadPrice();
return uint256(price);
}
// All price feeds must return 8 decimals (PRICE_FEED_DECIMALS = 8)
Specific functions can be paused by governor or pause guardian:
function pause(
bool supplyPaused,
bool transferPaused,
bool withdrawPaused,
bool absorbPaused,
bool buyPaused
) external {
if (msg.sender != governor && msg.sender != pauseGuardian) revert Unauthorized();
pauseFlags = ...;
}
// Check pause state
function isSupplyPaused() public view returns (bool);
function isTransferPaused() public view returns (bool);
function isWithdrawPaused() public view returns (bool);
function isAbsorbPaused() public view returns (bool);
function isBuyPaused() public view returns (bool);
int104 for both supply and borrow positionsuint16 assetsIn tracks which collaterals a user has (up to 16 assets, limited to 12)contracts/Comet.sol - Main protocol implementationcontracts/CometExt.sol - Extension delegate for ERC20/approvalcontracts/CometStorage.sol - Storage layoutcontracts/CometConfiguration.sol - Configuration structscontracts/CometCore.sol - Shared functions and constantsWhat SKILL.md sets; muted values are Claude Code's defaults
compound-v3-comet@cyotee is listed by cyotee/cyotee-claude-plugins — review the source before installing
npx claudepluginhub cyotee/cyotee-claude-plugins --plugin compound-v3-comet8 skills in this plugin
/comet-bulkerComet BulkerThis skill should be used when the user asks about "Bulker", "batch operations", "invoke", "native token", "wrap ETH", "multicall", or needs to understand Comet's batching functionality./comet-collateralComet CollateralThis skill should be used when the user asks about "collateral", "collateral factor", "borrowCollateralFactor", "liquidateCollateralFactor", "assetsIn", "supplyCap", or needs to understand Comet's collateral system./comet-configuratorComet ConfiguratorThis skill should be used when the user asks about "Configurator", "governance", "governor", "setConfiguration", "deploy", "CometFactory", "market admin", or needs to understand Comet's governance and upgrade system./comet-coreComet Core OperationsThis skill should be used when the user asks about "supply", "withdraw", "borrow", "repay", "transfer", "supplyTo", "withdrawFrom", or needs to understand Comet's core user operations./comet-interest-ratesComet Interest RatesThis skill should be used when the user asks about "interest rates", "APR", "APY", "utilization", "kink", "supply rate", "borrow rate", "accrueInternal", or needs to understand Comet's interest rate model./comet-liquidationComet LiquidationThis skill should be used when the user asks about "liquidation", "absorb", "absorbInternal", "buyCollateral", "quoteCollateral", "protocol reserves", "storeFrontPriceFactor", or needs to understand Comet's liquidation mechanics.