import { EthAddress, LeverageType, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber, } from './common'; export enum CompoundVersions { 'CompoundV2' = 'v2', 'CompoundV3USDC' = 'v3-USDC', 'CompoundV3USDCe' = 'v3-USDC.e', 'CompoundV3ETH' = 'v3-ETH', 'CompoundV3USDbC' = 'v3-USDbC', 'CompoundV3USDT' = 'v3-USDT', 'CompoundV3USDS' = 'v3-USDS', 'CompoundV3wstETH' = 'v3-wstETH', 'CompoundV3InstitutionalUSDC' = 'v3-institutional-USDC', } export enum CompoundVersionType { V2 = 'v2', V3 = 'v3', } export interface CompoundBulkerOptions { supply: number | string, withdraw: number | string, } export interface CompoundMarketData { chainIds: NetworkNumber[], label: string, shortLabel: string, url: string, value: CompoundVersions, baseAsset: string, collAssets: readonly string[], baseMarket: string, baseMarketAddress: EthAddress, secondLabel: string, bulkerName: string, bulkerAddress: EthAddress, bulkerOptions: CompoundBulkerOptions, // icon: Function, } export interface CompoundUsedAsset extends MMUsedAsset { collateral: boolean, limit?: string, } export interface CompoundV2UsedAsset extends CompoundUsedAsset { } export interface CompoundV3UsedAsset extends CompoundUsedAsset { } export interface CompoundUsedAssets { [token: string]: T, } export type CompoundV2UsedAssets = CompoundUsedAssets; export type CompoundV3UsedAssets = CompoundUsedAssets; export interface CompoundAssetData extends MMAssetData { supplyCapAlternative?: string, totalSupplyAlternative?: string, sortIndex?: number, } export interface CompoundV2AssetData extends CompoundAssetData { // Set by _getCompoundV2MarketsData. Optional, so objects built by hand still type-check. exchangeRate?: string, } export interface CompoundV3AssetData extends CompoundAssetData { borrowCollateralFactor: string, liquidateCollateralFactor: string, liquidationFactor: string, minDebt: string, supplyReserved: string, liquidationRatio: string, supplyCap: string, priceInBaseAsset: string, canBeWithdrawn: boolean, // The rest are set by formatMarketData and formatBaseData, which also spread in the view contract's raw asset // data. Optional, so objects built by hand still type-check. tokenAddr?: EthAddress, // The base asset's only. isBase?: boolean, baseBorrowMin?: string, baseTrackingBorrowRewardsSpeed?: string, baseTrackingSupplyRewardsSpeed?: string, borrowIndex?: string, supplyIndex?: string, trackingBorrowIndex?: string, trackingSupplyIndex?: string, rewardSupplySpeed?: string, rewardBorrowSpeed?: string, } export interface CompoundAssetsData { [token: string]: T } export type CompoundV2AssetsData = CompoundAssetsData; export type CompoundV3AssetsData = CompoundAssetsData; export type CompoundMarketsData = { assetsData: T }; export type CompoundV2MarketsData = CompoundMarketsData; export type CompoundV3MarketsData = CompoundMarketsData & { isMarketSupplyPaused: boolean, isMarketWithdrawPaused: boolean, isMarketBorrowPaused: boolean }; export interface BaseAdditionalAssetData { totalBorrow: string, utilization: string, marketLiquidity: string, rewardSupplySpeed: string, rewardBorrowSpeed: string, minDebt: string, isBase: boolean, } export interface CompoundAggregatedPositionData { suppliedUsd: string, suppliedCollateralUsd: string, borrowedUsd: string, borrowLimitUsd: string, liquidationLimitUsd: string, leftToBorrowUsd: string, ratio: string, collRatio: string, safetyRatio: string, netApy: string, incentiveUsd: string, totalInterestUsd: string, liqRatio: string, liqPercent: string, leveragedType: LeverageType, leveragedAsset?: string, currentVolatilePairRatio?: string, liquidationPrice?: string, minRatio: string, debtTooLow: boolean, minDebt: string, minCollRatio: string, collLiquidationRatio: string, exposure: string, } export interface CompoundPositionData extends MMPositionData { ratio: string, minRatio: string, safetyRatio?: string, suppliedUsd: string, borrowedUsd: string, borrowLimitUsd: string, incentiveUsd: string, totalInterestUsd: string, isSubscribedToAutomation?: boolean, automationResubscribeRequired?: boolean, } /** * Fields getCompoundV2AggregatedData adds to every Compound V2 position at runtime — a subset of * CompoundAggregatedPositionData. Optional, so code that builds a position by hand keeps compiling. */ export type CompoundV2PositionAggregatedFields = Partial>; /** * Fields getCompoundV3AggregatedData adds to every Compound V3 position at runtime, on top of those declared in * CompoundPositionData. Optional, so code that builds a position by hand keeps compiling. */ export type CompoundV3PositionAggregatedFields = Partial>; export interface CompoundV2PositionData extends CompoundPositionData, CompoundV2PositionAggregatedFields { usedAssets: CompoundV2UsedAssets, // Always false: _getCompoundV2AccountData starts from EMPTY_COMPOUND_DATA, which carries it. borrowStableSupplyUnstable?: boolean, } export interface CompoundV3PositionData extends CompoundPositionData, CompoundV3PositionAggregatedFields { usedAssets: CompoundV3UsedAssets, // Whether the user's smart wallet is allowed to manage the account on Comet (Comet.isAllowed). isAllowed?: boolean, }