@continuumdao/ctm-mpc-defi 0.2.34 → 0.2.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/catalog.cjs +1562 -45
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +5995 -2960
- package/dist/agent/catalog.js +1502 -46
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/aave-v4/SKILL.md +19 -4
- package/dist/agent/skills/aerodrome/SKILL.md +2 -2
- package/dist/agent/skills/compound-v3/SKILL.md +2 -2
- package/dist/agent/skills/curve-dao/SKILL.md +14 -0
- package/dist/agent/skills/ethena/SKILL.md +3 -1
- package/dist/agent/skills/euler-v2/SKILL.md +1 -1
- package/dist/agent/skills/gmx/SKILL.md +1 -1
- package/dist/agent/skills/hyperliquid/SKILL.md +7 -5
- package/dist/agent/skills/lido/SKILL.md +3 -0
- package/dist/agent/skills/maple-syrup/SKILL.md +35 -3
- package/dist/agent/skills/morpho/SKILL.md +1 -1
- package/dist/agent/skills/pendle/SKILL.md +63 -0
- package/dist/agent/skills/sky/SKILL.md +2 -0
- package/dist/agent/skills/yield-compare/SKILL.md +81 -0
- package/dist/core/index.cjs +2 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +257 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +257 -28
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/aave-v4/index.cjs +170 -0
- package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/aave-v4/index.d.ts +59 -1
- package/dist/protocols/evm/aave-v4/index.js +164 -1
- package/dist/protocols/evm/aave-v4/index.js.map +1 -1
- package/dist/protocols/evm/aerodrome/index.cjs +1308 -901
- package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
- package/dist/protocols/evm/aerodrome/index.d.ts +69 -2
- package/dist/protocols/evm/aerodrome/index.js +1217 -807
- package/dist/protocols/evm/aerodrome/index.js.map +1 -1
- package/dist/protocols/evm/compound-v3/index.cjs +82 -6
- package/dist/protocols/evm/compound-v3/index.cjs.map +1 -1
- package/dist/protocols/evm/compound-v3/index.d.ts +89 -1
- package/dist/protocols/evm/compound-v3/index.js +80 -7
- package/dist/protocols/evm/compound-v3/index.js.map +1 -1
- package/dist/protocols/evm/curve-dao/index.cjs +447 -18
- package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
- package/dist/protocols/evm/curve-dao/index.d.ts +108 -1
- package/dist/protocols/evm/curve-dao/index.js +440 -19
- package/dist/protocols/evm/curve-dao/index.js.map +1 -1
- package/dist/protocols/evm/ethena/index.cjs +89 -0
- package/dist/protocols/evm/ethena/index.cjs.map +1 -1
- package/dist/protocols/evm/ethena/index.d.ts +17 -1
- package/dist/protocols/evm/ethena/index.js +89 -2
- package/dist/protocols/evm/ethena/index.js.map +1 -1
- package/dist/protocols/evm/euler-v2/index.cjs +29 -0
- package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
- package/dist/protocols/evm/euler-v2/index.d.ts +21 -1
- package/dist/protocols/evm/euler-v2/index.js +29 -1
- package/dist/protocols/evm/euler-v2/index.js.map +1 -1
- package/dist/protocols/evm/gmx/index.cjs +83 -1
- package/dist/protocols/evm/gmx/index.cjs.map +1 -1
- package/dist/protocols/evm/gmx/index.d.ts +22 -2
- package/dist/protocols/evm/gmx/index.js +80 -2
- package/dist/protocols/evm/gmx/index.js.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.cjs +67 -11
- package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.d.ts +39 -2
- package/dist/protocols/evm/hyperliquid/index.js +64 -12
- package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
- package/dist/protocols/evm/lido/index.cjs +13 -0
- package/dist/protocols/evm/lido/index.cjs.map +1 -1
- package/dist/protocols/evm/lido/index.d.ts +9 -1
- package/dist/protocols/evm/lido/index.js +13 -1
- package/dist/protocols/evm/lido/index.js.map +1 -1
- package/dist/protocols/evm/maple/index.cjs +129 -1
- package/dist/protocols/evm/maple/index.cjs.map +1 -1
- package/dist/protocols/evm/maple/index.d.ts +45 -1
- package/dist/protocols/evm/maple/index.js +124 -3
- package/dist/protocols/evm/maple/index.js.map +1 -1
- package/dist/protocols/evm/morpho/index.cjs +34 -7
- package/dist/protocols/evm/morpho/index.cjs.map +1 -1
- package/dist/protocols/evm/morpho/index.d.ts +23 -1
- package/dist/protocols/evm/morpho/index.js +34 -8
- package/dist/protocols/evm/morpho/index.js.map +1 -1
- package/dist/protocols/evm/pendle/index.cjs +1530 -0
- package/dist/protocols/evm/pendle/index.cjs.map +1 -0
- package/dist/protocols/evm/pendle/index.d.ts +463 -0
- package/dist/protocols/evm/pendle/index.js +1463 -0
- package/dist/protocols/evm/pendle/index.js.map +1 -0
- package/dist/protocols/evm/sky/index.cjs +52 -0
- package/dist/protocols/evm/sky/index.cjs.map +1 -1
- package/dist/protocols/evm/sky/index.d.ts +16 -1
- package/dist/protocols/evm/sky/index.js +50 -1
- package/dist/protocols/evm/sky/index.js.map +1 -1
- package/package.json +6 -1
|
@@ -326,6 +326,54 @@ declare const cometInterfaceAbi: readonly [{
|
|
|
326
326
|
readonly name: "supplyCap";
|
|
327
327
|
}];
|
|
328
328
|
}];
|
|
329
|
+
}, {
|
|
330
|
+
readonly name: "baseTrackingSupplySpeed";
|
|
331
|
+
readonly type: "function";
|
|
332
|
+
readonly stateMutability: "view";
|
|
333
|
+
readonly inputs: readonly [];
|
|
334
|
+
readonly outputs: readonly [{
|
|
335
|
+
readonly type: "uint256";
|
|
336
|
+
}];
|
|
337
|
+
}, {
|
|
338
|
+
readonly name: "baseTrackingBorrowSpeed";
|
|
339
|
+
readonly type: "function";
|
|
340
|
+
readonly stateMutability: "view";
|
|
341
|
+
readonly inputs: readonly [];
|
|
342
|
+
readonly outputs: readonly [{
|
|
343
|
+
readonly type: "uint256";
|
|
344
|
+
}];
|
|
345
|
+
}, {
|
|
346
|
+
readonly name: "baseIndexScale";
|
|
347
|
+
readonly type: "function";
|
|
348
|
+
readonly stateMutability: "view";
|
|
349
|
+
readonly inputs: readonly [];
|
|
350
|
+
readonly outputs: readonly [{
|
|
351
|
+
readonly type: "uint64";
|
|
352
|
+
}];
|
|
353
|
+
}, {
|
|
354
|
+
readonly name: "trackingIndexScale";
|
|
355
|
+
readonly type: "function";
|
|
356
|
+
readonly stateMutability: "view";
|
|
357
|
+
readonly inputs: readonly [];
|
|
358
|
+
readonly outputs: readonly [{
|
|
359
|
+
readonly type: "uint256";
|
|
360
|
+
}];
|
|
361
|
+
}, {
|
|
362
|
+
readonly name: "totalSupply";
|
|
363
|
+
readonly type: "function";
|
|
364
|
+
readonly stateMutability: "view";
|
|
365
|
+
readonly inputs: readonly [];
|
|
366
|
+
readonly outputs: readonly [{
|
|
367
|
+
readonly type: "uint256";
|
|
368
|
+
}];
|
|
369
|
+
}, {
|
|
370
|
+
readonly name: "totalBorrow";
|
|
371
|
+
readonly type: "function";
|
|
372
|
+
readonly stateMutability: "view";
|
|
373
|
+
readonly inputs: readonly [];
|
|
374
|
+
readonly outputs: readonly [{
|
|
375
|
+
readonly type: "uint256";
|
|
376
|
+
}];
|
|
329
377
|
}];
|
|
330
378
|
declare const cometRewardsAbi: readonly [{
|
|
331
379
|
readonly name: "getRewardOwed";
|
|
@@ -363,6 +411,27 @@ declare const cometRewardsAbi: readonly [{
|
|
|
363
411
|
readonly name: "shouldAccrue";
|
|
364
412
|
}];
|
|
365
413
|
readonly outputs: readonly [];
|
|
414
|
+
}, {
|
|
415
|
+
readonly name: "rewardConfig";
|
|
416
|
+
readonly type: "function";
|
|
417
|
+
readonly stateMutability: "view";
|
|
418
|
+
readonly inputs: readonly [{
|
|
419
|
+
readonly type: "address";
|
|
420
|
+
readonly name: "comet";
|
|
421
|
+
}];
|
|
422
|
+
readonly outputs: readonly [{
|
|
423
|
+
readonly type: "tuple";
|
|
424
|
+
readonly components: readonly [{
|
|
425
|
+
readonly type: "address";
|
|
426
|
+
readonly name: "token";
|
|
427
|
+
}, {
|
|
428
|
+
readonly type: "uint64";
|
|
429
|
+
readonly name: "rescaleFactor";
|
|
430
|
+
}, {
|
|
431
|
+
readonly type: "bool";
|
|
432
|
+
readonly name: "shouldUpscale";
|
|
433
|
+
}];
|
|
434
|
+
}];
|
|
366
435
|
}];
|
|
367
436
|
declare const cometBulkerAbi: readonly [{
|
|
368
437
|
readonly name: "invoke";
|
|
@@ -486,6 +555,23 @@ declare function compoundV3RatePerSecondToAprDecimal(ratePerSecond: bigint): num
|
|
|
486
555
|
declare function compoundV3AprToPercentLabel(aprDecimal: number): string;
|
|
487
556
|
declare function compoundV3UtilizationToDecimal(utilization: bigint): number;
|
|
488
557
|
declare function compoundV3FactorToPercent(factor: bigint): number;
|
|
558
|
+
/** Comet `getPrice` scale (USD, 8 decimals). */
|
|
559
|
+
declare const COMPOUND_V3_PRICE_SCALE = 100000000;
|
|
560
|
+
/** Default tracking index scale when `trackingIndexScale()` is unavailable. */
|
|
561
|
+
declare const COMPOUND_V3_TRACKING_INDEX_SCALE = 1000000000000000;
|
|
562
|
+
/**
|
|
563
|
+
* Forward COMP (or other reward-token) APR from tracking speed.
|
|
564
|
+
* `trackingSpeed` is tokens/second × trackingIndexScale. Prices are Comet `getPrice` (1e8 USD).
|
|
565
|
+
*/
|
|
566
|
+
/** Returns a percent (5 = 5%), or null when unpriced / zero speed. */
|
|
567
|
+
declare function compoundV3TrackingSpeedToRewardAprPercent(args: {
|
|
568
|
+
trackingSpeed: bigint;
|
|
569
|
+
trackingIndexScale: bigint;
|
|
570
|
+
totalBase: bigint;
|
|
571
|
+
baseDecimals: number;
|
|
572
|
+
basePrice: bigint;
|
|
573
|
+
rewardPrice: bigint;
|
|
574
|
+
}): number | null;
|
|
489
575
|
|
|
490
576
|
type CompoundV3SubgraphMarketHint = {
|
|
491
577
|
id: string;
|
|
@@ -517,6 +603,8 @@ type CompoundV3MarketSummary = {
|
|
|
517
603
|
utilization: number | null;
|
|
518
604
|
supplyAprPercent: string | null;
|
|
519
605
|
borrowAprPercent: string | null;
|
|
606
|
+
supplyRewardAprPercent: string | null;
|
|
607
|
+
borrowRewardAprPercent: string | null;
|
|
520
608
|
assets: CompoundV3AssetInfoRow[];
|
|
521
609
|
};
|
|
522
610
|
type CompoundV3AccountSummary = {
|
|
@@ -680,4 +768,4 @@ declare function buildEvmMultisignBodyCompoundV3Bulker(args: {
|
|
|
680
768
|
|
|
681
769
|
declare const compoundV3ProtocolModule: ProtocolModule;
|
|
682
770
|
|
|
683
|
-
export { BULKER_ACTION_CLAIM_REWARD, BULKER_ACTION_SUPPLY_ASSET, BULKER_ACTION_SUPPLY_NATIVE_TOKEN, BULKER_ACTION_TRANSFER_ASSET, BULKER_ACTION_WITHDRAW_ASSET, BULKER_ACTION_WITHDRAW_NATIVE_TOKEN, COMPOUND_V3_CHAIN_IDS, COMPOUND_V3_FACTOR_SCALE, COMPOUND_V3_MARKETS, COMPOUND_V3_PROTOCOL_ID, COMPOUND_V3_SECONDS_PER_YEAR, COMPOUND_V3_WRAPPED_NATIVE, type CompoundJsInstanceId, type CompoundJsKnownComet, type CompoundV3AccountSummary, type CompoundV3AssetInfoRow, type CompoundV3AssetModes, type CompoundV3BuildStep, type CompoundV3BuildStepKind, type CompoundV3BulkerStepInput, type CompoundV3ChainId, type CompoundV3MarketRecord, type CompoundV3MarketSummary, type CompoundV3SubgraphMarketHint, buildEvmMultisignBodyCompoundV3Bulker, buildEvmMultisignBodyCompoundV3ClaimRewards, buildEvmMultisignBodyCompoundV3Repay, buildEvmMultisignBodyCompoundV3Supply, buildEvmMultisignBodyCompoundV3Withdraw, bulkerActionId, cometBulkerAbi, cometInterfaceAbi, cometRewardsAbi, compoundJsAgreesWithOfficial, compoundJsCollateralAddresses, compoundJsCometAddress, compoundV3AprToPercentLabel, compoundV3FactorToPercent, compoundV3FetchAccountSummary, compoundV3FetchMarketSummary, compoundV3FetchMarketsSummary, compoundV3KeyForNodeAssetRow, compoundV3ProtocolModule, compoundV3RatePerSecondToAprDecimal, compoundV3SubgraphIdForChain, compoundV3UtilizationToDecimal, compoundV3WrappedNative, createCompoundV3PublicClient, ensureCompoundV3ChainAssetCache, erc20ApproveAbi, erc20ReadAbi, fetchCompoundV3SubgraphMarkets, getCompoundV3AssetModesFromCache, getCompoundV3MarketByComet, isCompoundV3ChainSupported, isNativeAssetAddress, listCompoundJsCometInstances, listCompoundV3KnownTokenAddresses, listCompoundV3MarketsForAsset, listCompoundV3MarketsForChain, listCompoundV3SupportedChainIds, pushApproveIfNeeded, requireCompoundV3Market, resolveCompoundV3ActionAsset, wethAbi };
|
|
771
|
+
export { BULKER_ACTION_CLAIM_REWARD, BULKER_ACTION_SUPPLY_ASSET, BULKER_ACTION_SUPPLY_NATIVE_TOKEN, BULKER_ACTION_TRANSFER_ASSET, BULKER_ACTION_WITHDRAW_ASSET, BULKER_ACTION_WITHDRAW_NATIVE_TOKEN, COMPOUND_V3_CHAIN_IDS, COMPOUND_V3_FACTOR_SCALE, COMPOUND_V3_MARKETS, COMPOUND_V3_PRICE_SCALE, COMPOUND_V3_PROTOCOL_ID, COMPOUND_V3_SECONDS_PER_YEAR, COMPOUND_V3_TRACKING_INDEX_SCALE, COMPOUND_V3_WRAPPED_NATIVE, type CompoundJsInstanceId, type CompoundJsKnownComet, type CompoundV3AccountSummary, type CompoundV3AssetInfoRow, type CompoundV3AssetModes, type CompoundV3BuildStep, type CompoundV3BuildStepKind, type CompoundV3BulkerStepInput, type CompoundV3ChainId, type CompoundV3MarketRecord, type CompoundV3MarketSummary, type CompoundV3SubgraphMarketHint, buildEvmMultisignBodyCompoundV3Bulker, buildEvmMultisignBodyCompoundV3ClaimRewards, buildEvmMultisignBodyCompoundV3Repay, buildEvmMultisignBodyCompoundV3Supply, buildEvmMultisignBodyCompoundV3Withdraw, bulkerActionId, cometBulkerAbi, cometInterfaceAbi, cometRewardsAbi, compoundJsAgreesWithOfficial, compoundJsCollateralAddresses, compoundJsCometAddress, compoundV3AprToPercentLabel, compoundV3FactorToPercent, compoundV3FetchAccountSummary, compoundV3FetchMarketSummary, compoundV3FetchMarketsSummary, compoundV3KeyForNodeAssetRow, compoundV3ProtocolModule, compoundV3RatePerSecondToAprDecimal, compoundV3SubgraphIdForChain, compoundV3TrackingSpeedToRewardAprPercent, compoundV3UtilizationToDecimal, compoundV3WrappedNative, createCompoundV3PublicClient, ensureCompoundV3ChainAssetCache, erc20ApproveAbi, erc20ReadAbi, fetchCompoundV3SubgraphMarkets, getCompoundV3AssetModesFromCache, getCompoundV3MarketByComet, isCompoundV3ChainSupported, isNativeAssetAddress, listCompoundJsCometInstances, listCompoundV3KnownTokenAddresses, listCompoundV3MarketsForAsset, listCompoundV3MarketsForChain, listCompoundV3SupportedChainIds, pushApproveIfNeeded, requireCompoundV3Market, resolveCompoundV3ActionAsset, wethAbi };
|
|
@@ -360,11 +360,18 @@ var cometInterfaceAbi = parseAbi([
|
|
|
360
360
|
"function isBorrowCollateralized(address account) view returns (bool)",
|
|
361
361
|
"function isLiquidatable(address account) view returns (bool)",
|
|
362
362
|
"function getAssetInfo(uint8 i) view returns ((uint8 offset, address asset, address priceFeed, uint64 scale, uint64 borrowCollateralFactor, uint64 liquidateCollateralFactor, uint64 liquidationFactor, uint128 supplyCap))",
|
|
363
|
-
"function getAssetInfoByAddress(address asset) view returns ((uint8 offset, address asset, address priceFeed, uint64 scale, uint64 borrowCollateralFactor, uint64 liquidateCollateralFactor, uint64 liquidationFactor, uint128 supplyCap))"
|
|
363
|
+
"function getAssetInfoByAddress(address asset) view returns ((uint8 offset, address asset, address priceFeed, uint64 scale, uint64 borrowCollateralFactor, uint64 liquidateCollateralFactor, uint64 liquidationFactor, uint128 supplyCap))",
|
|
364
|
+
"function baseTrackingSupplySpeed() view returns (uint256)",
|
|
365
|
+
"function baseTrackingBorrowSpeed() view returns (uint256)",
|
|
366
|
+
"function baseIndexScale() view returns (uint64)",
|
|
367
|
+
"function trackingIndexScale() view returns (uint256)",
|
|
368
|
+
"function totalSupply() view returns (uint256)",
|
|
369
|
+
"function totalBorrow() view returns (uint256)"
|
|
364
370
|
]);
|
|
365
371
|
var cometRewardsAbi = parseAbi([
|
|
366
372
|
"function getRewardOwed(address comet, address account) view returns ((address token, uint256 owed))",
|
|
367
|
-
"function claim(address comet, address src, bool shouldAccrue)"
|
|
373
|
+
"function claim(address comet, address src, bool shouldAccrue)",
|
|
374
|
+
"function rewardConfig(address comet) view returns ((address token, uint64 rescaleFactor, bool shouldUpscale))"
|
|
368
375
|
]);
|
|
369
376
|
var cometBulkerAbi = parseAbi([
|
|
370
377
|
"function invoke(bytes32[] actions, bytes[] data) payable"
|
|
@@ -468,6 +475,22 @@ function compoundV3UtilizationToDecimal(utilization) {
|
|
|
468
475
|
function compoundV3FactorToPercent(factor) {
|
|
469
476
|
return Number(factor) / 1e16;
|
|
470
477
|
}
|
|
478
|
+
var COMPOUND_V3_PRICE_SCALE = 1e8;
|
|
479
|
+
var COMPOUND_V3_TRACKING_INDEX_SCALE = 1e15;
|
|
480
|
+
function compoundV3TrackingSpeedToRewardAprPercent(args) {
|
|
481
|
+
if (args.trackingSpeed <= 0n || args.totalBase <= 0n || args.basePrice <= 0n || args.rewardPrice <= 0n) {
|
|
482
|
+
return null;
|
|
483
|
+
}
|
|
484
|
+
const scale = Number(args.trackingIndexScale > 0n ? args.trackingIndexScale : BigInt(COMPOUND_V3_TRACKING_INDEX_SCALE));
|
|
485
|
+
if (!Number.isFinite(scale) || scale <= 0) return null;
|
|
486
|
+
const tokensPerYear = Number(args.trackingSpeed) / scale * COMPOUND_V3_SECONDS_PER_YEAR;
|
|
487
|
+
const rewardUsdPerYear = tokensPerYear * (Number(args.rewardPrice) / COMPOUND_V3_PRICE_SCALE);
|
|
488
|
+
const totalUsd = Number(args.totalBase) / 10 ** args.baseDecimals * (Number(args.basePrice) / COMPOUND_V3_PRICE_SCALE);
|
|
489
|
+
if (!Number.isFinite(rewardUsdPerYear) || !Number.isFinite(totalUsd) || totalUsd <= 0) return null;
|
|
490
|
+
const pct = rewardUsdPerYear / totalUsd * 100;
|
|
491
|
+
if (!Number.isFinite(pct) || pct < 0) return null;
|
|
492
|
+
return pct;
|
|
493
|
+
}
|
|
471
494
|
|
|
472
495
|
// src/protocols/evm/compound-v3/subgraph.ts
|
|
473
496
|
var COMPOUND_V3_SUBGRAPH_BY_CHAIN = {
|
|
@@ -526,7 +549,7 @@ async function enrichMarketOnChain(client, market) {
|
|
|
526
549
|
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "numAssets" }),
|
|
527
550
|
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "decimals" })
|
|
528
551
|
]);
|
|
529
|
-
const [supplyRate, borrowRate, baseMeta, baseFeed] = await Promise.all([
|
|
552
|
+
const [supplyRate, borrowRate, baseMeta, baseFeed, supplySpeed, borrowSpeed, totalSupply, totalBorrow, trackingScale] = await Promise.all([
|
|
530
553
|
client.readContract({
|
|
531
554
|
address: comet,
|
|
532
555
|
abi: cometInterfaceAbi,
|
|
@@ -540,7 +563,12 @@ async function enrichMarketOnChain(client, market) {
|
|
|
540
563
|
args: [utilization]
|
|
541
564
|
}),
|
|
542
565
|
readTokenMeta(client, getAddress(baseToken)),
|
|
543
|
-
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "baseTokenPriceFeed" })
|
|
566
|
+
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "baseTokenPriceFeed" }),
|
|
567
|
+
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "baseTrackingSupplySpeed" }).catch(() => 0n),
|
|
568
|
+
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "baseTrackingBorrowSpeed" }).catch(() => 0n),
|
|
569
|
+
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "totalSupply" }).catch(() => 0n),
|
|
570
|
+
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "totalBorrow" }).catch(() => 0n),
|
|
571
|
+
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "trackingIndexScale" }).catch(() => BigInt(COMPOUND_V3_TRACKING_INDEX_SCALE))
|
|
544
572
|
]);
|
|
545
573
|
const basePrice = await client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "getPrice", args: [baseFeed] }).catch(() => 0n);
|
|
546
574
|
const assets = [
|
|
@@ -575,6 +603,47 @@ async function enrichMarketOnChain(client, market) {
|
|
|
575
603
|
role: "collateral"
|
|
576
604
|
});
|
|
577
605
|
}
|
|
606
|
+
let rewardPrice = 0n;
|
|
607
|
+
try {
|
|
608
|
+
const cfg = await client.readContract({
|
|
609
|
+
address: getAddress(market.rewards),
|
|
610
|
+
abi: cometRewardsAbi,
|
|
611
|
+
functionName: "rewardConfig",
|
|
612
|
+
args: [comet]
|
|
613
|
+
});
|
|
614
|
+
const rewardToken = getAddress(cfg.token);
|
|
615
|
+
const listed = assets.find((a) => a.asset.toLowerCase() === rewardToken.toLowerCase());
|
|
616
|
+
if (listed && listed.priceRaw !== "0") {
|
|
617
|
+
rewardPrice = BigInt(listed.priceRaw);
|
|
618
|
+
} else {
|
|
619
|
+
const info = await client.readContract({
|
|
620
|
+
address: comet,
|
|
621
|
+
abi: cometInterfaceAbi,
|
|
622
|
+
functionName: "getAssetInfoByAddress",
|
|
623
|
+
args: [rewardToken]
|
|
624
|
+
});
|
|
625
|
+
rewardPrice = await client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "getPrice", args: [info.priceFeed] }).catch(() => 0n);
|
|
626
|
+
}
|
|
627
|
+
} catch {
|
|
628
|
+
rewardPrice = 0n;
|
|
629
|
+
}
|
|
630
|
+
const baseDecimals = Number(decimals) || baseMeta.decimals;
|
|
631
|
+
const supplyRewardApr = compoundV3TrackingSpeedToRewardAprPercent({
|
|
632
|
+
trackingSpeed: supplySpeed,
|
|
633
|
+
trackingIndexScale: trackingScale,
|
|
634
|
+
totalBase: totalSupply,
|
|
635
|
+
baseDecimals,
|
|
636
|
+
basePrice,
|
|
637
|
+
rewardPrice
|
|
638
|
+
});
|
|
639
|
+
const borrowRewardApr = compoundV3TrackingSpeedToRewardAprPercent({
|
|
640
|
+
trackingSpeed: borrowSpeed,
|
|
641
|
+
trackingIndexScale: trackingScale,
|
|
642
|
+
totalBase: totalBorrow,
|
|
643
|
+
baseDecimals,
|
|
644
|
+
basePrice,
|
|
645
|
+
rewardPrice
|
|
646
|
+
});
|
|
578
647
|
return {
|
|
579
648
|
chainId: market.chainId,
|
|
580
649
|
slug: market.slug,
|
|
@@ -586,6 +655,8 @@ async function enrichMarketOnChain(client, market) {
|
|
|
586
655
|
utilization: compoundV3UtilizationToDecimal(utilization),
|
|
587
656
|
supplyAprPercent: compoundV3AprToPercentLabel(compoundV3RatePerSecondToAprDecimal(supplyRate)),
|
|
588
657
|
borrowAprPercent: compoundV3AprToPercentLabel(compoundV3RatePerSecondToAprDecimal(borrowRate)),
|
|
658
|
+
supplyRewardAprPercent: supplyRewardApr == null ? null : compoundV3AprToPercentLabel(supplyRewardApr / 100),
|
|
659
|
+
borrowRewardAprPercent: borrowRewardApr == null ? null : compoundV3AprToPercentLabel(borrowRewardApr / 100),
|
|
589
660
|
assets
|
|
590
661
|
};
|
|
591
662
|
}
|
|
@@ -601,6 +672,8 @@ function registryMarketRow(market) {
|
|
|
601
672
|
utilization: null,
|
|
602
673
|
supplyAprPercent: null,
|
|
603
674
|
borrowAprPercent: null,
|
|
675
|
+
supplyRewardAprPercent: null,
|
|
676
|
+
borrowRewardAprPercent: null,
|
|
604
677
|
assets: market.baseToken ? [
|
|
605
678
|
{
|
|
606
679
|
asset: market.baseToken,
|
|
@@ -627,7 +700,7 @@ async function compoundV3FetchMarketsSummary(args) {
|
|
|
627
700
|
if (!args.rpcUrl?.trim()) {
|
|
628
701
|
return {
|
|
629
702
|
markets: registry.map(registryMarketRow),
|
|
630
|
-
notes: "Registry from official comet deployments. Pass rpcUrl (MCP server injects it) to enrich APRs and collaterals." + subgraphNote
|
|
703
|
+
notes: "Registry from official comet deployments. Pass rpcUrl (MCP server injects it) to enrich APRs, reward APRs, and collaterals." + subgraphNote
|
|
631
704
|
};
|
|
632
705
|
}
|
|
633
706
|
const client = publicClient(args.rpcUrl, args.chainId);
|
|
@@ -641,7 +714,7 @@ async function compoundV3FetchMarketsSummary(args) {
|
|
|
641
714
|
}
|
|
642
715
|
return {
|
|
643
716
|
markets,
|
|
644
|
-
notes: "Comet proxy addresses from official deployments;
|
|
717
|
+
notes: "Comet proxy addresses from official deployments; base supply/borrow APR and COMP incentive APR from on-chain CometInterface. Incentive APR is extra and variable; null when the reward token has no on-chain price feed." + subgraphNote
|
|
645
718
|
};
|
|
646
719
|
}
|
|
647
720
|
async function compoundV3FetchMarketSummary(args) {
|
|
@@ -1483,6 +1556,6 @@ var compoundV3ProtocolModule = {
|
|
|
1483
1556
|
};
|
|
1484
1557
|
registerProtocolModule(compoundV3ProtocolModule);
|
|
1485
1558
|
|
|
1486
|
-
export { BULKER_ACTION_CLAIM_REWARD, BULKER_ACTION_SUPPLY_ASSET, BULKER_ACTION_SUPPLY_NATIVE_TOKEN, BULKER_ACTION_TRANSFER_ASSET, BULKER_ACTION_WITHDRAW_ASSET, BULKER_ACTION_WITHDRAW_NATIVE_TOKEN, COMPOUND_V3_CHAIN_IDS, COMPOUND_V3_FACTOR_SCALE, COMPOUND_V3_MARKETS, COMPOUND_V3_PROTOCOL_ID, COMPOUND_V3_SECONDS_PER_YEAR, COMPOUND_V3_WRAPPED_NATIVE, buildEvmMultisignBodyCompoundV3Bulker, buildEvmMultisignBodyCompoundV3ClaimRewards, buildEvmMultisignBodyCompoundV3Repay, buildEvmMultisignBodyCompoundV3Supply, buildEvmMultisignBodyCompoundV3Withdraw, bulkerActionId, cometBulkerAbi, cometInterfaceAbi, cometRewardsAbi, compoundJsAgreesWithOfficial, compoundJsCollateralAddresses, compoundJsCometAddress, compoundV3AprToPercentLabel, compoundV3FactorToPercent, compoundV3FetchAccountSummary, compoundV3FetchMarketSummary, compoundV3FetchMarketsSummary, compoundV3KeyForNodeAssetRow, compoundV3ProtocolModule, compoundV3RatePerSecondToAprDecimal, compoundV3SubgraphIdForChain, compoundV3UtilizationToDecimal, compoundV3WrappedNative, createCompoundV3PublicClient, ensureCompoundV3ChainAssetCache, erc20ApproveAbi, erc20ReadAbi, fetchCompoundV3SubgraphMarkets, getCompoundV3AssetModesFromCache, getCompoundV3MarketByComet, isCompoundV3ChainSupported, isNativeAssetAddress, listCompoundJsCometInstances, listCompoundV3KnownTokenAddresses, listCompoundV3MarketsForAsset, listCompoundV3MarketsForChain, listCompoundV3SupportedChainIds, pushApproveIfNeeded, requireCompoundV3Market, resolveCompoundV3ActionAsset, wethAbi };
|
|
1559
|
+
export { BULKER_ACTION_CLAIM_REWARD, BULKER_ACTION_SUPPLY_ASSET, BULKER_ACTION_SUPPLY_NATIVE_TOKEN, BULKER_ACTION_TRANSFER_ASSET, BULKER_ACTION_WITHDRAW_ASSET, BULKER_ACTION_WITHDRAW_NATIVE_TOKEN, COMPOUND_V3_CHAIN_IDS, COMPOUND_V3_FACTOR_SCALE, COMPOUND_V3_MARKETS, COMPOUND_V3_PRICE_SCALE, COMPOUND_V3_PROTOCOL_ID, COMPOUND_V3_SECONDS_PER_YEAR, COMPOUND_V3_TRACKING_INDEX_SCALE, COMPOUND_V3_WRAPPED_NATIVE, buildEvmMultisignBodyCompoundV3Bulker, buildEvmMultisignBodyCompoundV3ClaimRewards, buildEvmMultisignBodyCompoundV3Repay, buildEvmMultisignBodyCompoundV3Supply, buildEvmMultisignBodyCompoundV3Withdraw, bulkerActionId, cometBulkerAbi, cometInterfaceAbi, cometRewardsAbi, compoundJsAgreesWithOfficial, compoundJsCollateralAddresses, compoundJsCometAddress, compoundV3AprToPercentLabel, compoundV3FactorToPercent, compoundV3FetchAccountSummary, compoundV3FetchMarketSummary, compoundV3FetchMarketsSummary, compoundV3KeyForNodeAssetRow, compoundV3ProtocolModule, compoundV3RatePerSecondToAprDecimal, compoundV3SubgraphIdForChain, compoundV3TrackingSpeedToRewardAprPercent, compoundV3UtilizationToDecimal, compoundV3WrappedNative, createCompoundV3PublicClient, ensureCompoundV3ChainAssetCache, erc20ApproveAbi, erc20ReadAbi, fetchCompoundV3SubgraphMarkets, getCompoundV3AssetModesFromCache, getCompoundV3MarketByComet, isCompoundV3ChainSupported, isNativeAssetAddress, listCompoundJsCometInstances, listCompoundV3KnownTokenAddresses, listCompoundV3MarketsForAsset, listCompoundV3MarketsForChain, listCompoundV3SupportedChainIds, pushApproveIfNeeded, requireCompoundV3Market, resolveCompoundV3ActionAsset, wethAbi };
|
|
1487
1560
|
//# sourceMappingURL=index.js.map
|
|
1488
1561
|
//# sourceMappingURL=index.js.map
|