@continuumdao/ctm-mpc-defi 0.2.30 → 0.2.32
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 +1933 -56
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +3671 -661
- package/dist/agent/catalog.js +1896 -58
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/aerodrome/SKILL.md +93 -0
- package/dist/agent/skills/compound-v3/SKILL.md +132 -0
- package/dist/agent/skills/euler-v2/SKILL.md +1 -1
- package/dist/agent/skills/morpho/SKILL.md +16 -8
- package/dist/buildBatch-CngvebiD.d.ts +45 -0
- package/dist/chains/evm/index.d.ts +6 -44
- 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 +119 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +119 -2
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/aerodrome/index.cjs +3922 -0
- package/dist/protocols/evm/aerodrome/index.cjs.map +1 -0
- package/dist/protocols/evm/aerodrome/index.d.ts +792 -0
- package/dist/protocols/evm/aerodrome/index.js +3843 -0
- package/dist/protocols/evm/aerodrome/index.js.map +1 -0
- package/dist/protocols/evm/compound-v3/index.cjs +1542 -0
- package/dist/protocols/evm/compound-v3/index.cjs.map +1 -0
- package/dist/protocols/evm/compound-v3/index.d.ts +683 -0
- package/dist/protocols/evm/compound-v3/index.js +1488 -0
- package/dist/protocols/evm/compound-v3/index.js.map +1 -0
- package/dist/protocols/evm/euler-v2/index.cjs +17 -10
- package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
- package/dist/protocols/evm/euler-v2/index.js +17 -10
- package/dist/protocols/evm/euler-v2/index.js.map +1 -1
- package/dist/protocols/evm/morpho/index.cjs +746 -39
- package/dist/protocols/evm/morpho/index.cjs.map +1 -1
- package/dist/protocols/evm/morpho/index.d.ts +161 -14
- package/dist/protocols/evm/morpho/index.js +736 -42
- package/dist/protocols/evm/morpho/index.js.map +1 -1
- package/package.json +15 -1
package/dist/agent/catalog.cjs
CHANGED
|
@@ -24,6 +24,9 @@ var __export = (target, all) => {
|
|
|
24
24
|
function getAaveGraphqlProxyUrl() {
|
|
25
25
|
return aaveGraphqlProxyUrl;
|
|
26
26
|
}
|
|
27
|
+
function getEulerGraphqlProxyUrl() {
|
|
28
|
+
return eulerGraphqlProxyUrl;
|
|
29
|
+
}
|
|
27
30
|
function getMorphoGraphqlProxyUrl() {
|
|
28
31
|
return morphoGraphqlProxyUrl;
|
|
29
32
|
}
|
|
@@ -61,7 +64,7 @@ async function getJsonViaOptionalProxy(args) {
|
|
|
61
64
|
}
|
|
62
65
|
return await r.json();
|
|
63
66
|
}
|
|
64
|
-
var aaveGraphqlProxyUrl, morphoGraphqlProxyUrl;
|
|
67
|
+
var aaveGraphqlProxyUrl, eulerGraphqlProxyUrl, morphoGraphqlProxyUrl;
|
|
65
68
|
var init_defiProxy = __esm({
|
|
66
69
|
"src/core/defiProxy.ts"() {
|
|
67
70
|
}
|
|
@@ -95,17 +98,27 @@ var init_api = __esm({
|
|
|
95
98
|
// src/protocols/evm/morpho/midnightConstants.ts
|
|
96
99
|
var midnightConstants_exports = {};
|
|
97
100
|
__export(midnightConstants_exports, {
|
|
101
|
+
MORPHO_BLUE_CANONICAL: () => MORPHO_BLUE_CANONICAL,
|
|
98
102
|
MORPHO_MIDNIGHT_ADDRESSES: () => MORPHO_MIDNIGHT_ADDRESSES,
|
|
99
103
|
MORPHO_MIDNIGHT_AUTHORIZE_FALLBACK_GAS: () => MORPHO_MIDNIGHT_AUTHORIZE_FALLBACK_GAS,
|
|
100
104
|
MORPHO_MIDNIGHT_BASE_CHAIN_ID: () => MORPHO_MIDNIGHT_BASE_CHAIN_ID,
|
|
105
|
+
MORPHO_MIDNIGHT_BLUE_SUPPLY_FALLBACK_GAS: () => MORPHO_MIDNIGHT_BLUE_SUPPLY_FALLBACK_GAS,
|
|
106
|
+
MORPHO_MIDNIGHT_BLUE_WITHDRAW_FALLBACK_GAS: () => MORPHO_MIDNIGHT_BLUE_WITHDRAW_FALLBACK_GAS,
|
|
101
107
|
MORPHO_MIDNIGHT_BOOKS_MAX_LIMIT: () => MORPHO_MIDNIGHT_BOOKS_MAX_LIMIT,
|
|
102
108
|
MORPHO_MIDNIGHT_BORROW_FALLBACK_GAS: () => MORPHO_MIDNIGHT_BORROW_FALLBACK_GAS,
|
|
109
|
+
MORPHO_MIDNIGHT_CALLBACK_SALT: () => MORPHO_MIDNIGHT_CALLBACK_SALT,
|
|
110
|
+
MORPHO_MIDNIGHT_CREATE_CALLBACK_FALLBACK_GAS: () => MORPHO_MIDNIGHT_CREATE_CALLBACK_FALLBACK_GAS,
|
|
103
111
|
MORPHO_MIDNIGHT_DEFAULT_DEADLINE_SECONDS: () => MORPHO_MIDNIGHT_DEFAULT_DEADLINE_SECONDS,
|
|
112
|
+
MORPHO_MIDNIGHT_DEFAULT_OFFER_TTL_SECONDS: () => MORPHO_MIDNIGHT_DEFAULT_OFFER_TTL_SECONDS,
|
|
104
113
|
MORPHO_MIDNIGHT_DEFAULT_SLIPPAGE_PCT: () => MORPHO_MIDNIGHT_DEFAULT_SLIPPAGE_PCT,
|
|
105
114
|
MORPHO_MIDNIGHT_ERC20_APPROVE_FALLBACK: () => MORPHO_MIDNIGHT_ERC20_APPROVE_FALLBACK,
|
|
115
|
+
MORPHO_MIDNIGHT_ETHEREUM_CHAIN_ID: () => MORPHO_MIDNIGHT_ETHEREUM_CHAIN_ID,
|
|
106
116
|
MORPHO_MIDNIGHT_LEND_FALLBACK_GAS: () => MORPHO_MIDNIGHT_LEND_FALLBACK_GAS,
|
|
117
|
+
MORPHO_MIDNIGHT_MEMPOOL_PUBLISH_FALLBACK_GAS: () => MORPHO_MIDNIGHT_MEMPOOL_PUBLISH_FALLBACK_GAS,
|
|
107
118
|
MORPHO_MIDNIGHT_REPAY_FALLBACK_GAS: () => MORPHO_MIDNIGHT_REPAY_FALLBACK_GAS,
|
|
108
119
|
MORPHO_MIDNIGHT_REST_BASE: () => MORPHO_MIDNIGHT_REST_BASE,
|
|
120
|
+
MORPHO_MIDNIGHT_SET_CONSUMED_FALLBACK_GAS: () => MORPHO_MIDNIGHT_SET_CONSUMED_FALLBACK_GAS,
|
|
121
|
+
MORPHO_MIDNIGHT_SET_ROOT_FALLBACK_GAS: () => MORPHO_MIDNIGHT_SET_ROOT_FALLBACK_GAS,
|
|
109
122
|
MORPHO_MIDNIGHT_WETH_DEPOSIT_FALLBACK: () => MORPHO_MIDNIGHT_WETH_DEPOSIT_FALLBACK,
|
|
110
123
|
TOKEN_PERMIT_NONE: () => TOKEN_PERMIT_NONE,
|
|
111
124
|
morphoMidnightAddressesForChain: () => morphoMidnightAddressesForChain
|
|
@@ -113,18 +126,36 @@ __export(midnightConstants_exports, {
|
|
|
113
126
|
function morphoMidnightAddressesForChain(chainId) {
|
|
114
127
|
return MORPHO_MIDNIGHT_ADDRESSES[chainId] ?? null;
|
|
115
128
|
}
|
|
116
|
-
var MORPHO_MIDNIGHT_REST_BASE, MORPHO_MIDNIGHT_BOOKS_MAX_LIMIT, MORPHO_MIDNIGHT_DEFAULT_SLIPPAGE_PCT, MORPHO_MIDNIGHT_DEFAULT_DEADLINE_SECONDS, MORPHO_MIDNIGHT_BASE_CHAIN_ID, MORPHO_MIDNIGHT_ADDRESSES, TOKEN_PERMIT_NONE, MORPHO_MIDNIGHT_LEND_FALLBACK_GAS, MORPHO_MIDNIGHT_BORROW_FALLBACK_GAS, MORPHO_MIDNIGHT_REPAY_FALLBACK_GAS, MORPHO_MIDNIGHT_AUTHORIZE_FALLBACK_GAS, MORPHO_MIDNIGHT_ERC20_APPROVE_FALLBACK, MORPHO_MIDNIGHT_WETH_DEPOSIT_FALLBACK;
|
|
129
|
+
var MORPHO_MIDNIGHT_REST_BASE, MORPHO_MIDNIGHT_BOOKS_MAX_LIMIT, MORPHO_MIDNIGHT_DEFAULT_SLIPPAGE_PCT, MORPHO_MIDNIGHT_DEFAULT_DEADLINE_SECONDS, MORPHO_MIDNIGHT_DEFAULT_OFFER_TTL_SECONDS, MORPHO_MIDNIGHT_BASE_CHAIN_ID, MORPHO_MIDNIGHT_ETHEREUM_CHAIN_ID, MORPHO_BLUE_CANONICAL, MORPHO_MIDNIGHT_CALLBACK_SALT, MORPHO_MIDNIGHT_ADDRESSES, TOKEN_PERMIT_NONE, MORPHO_MIDNIGHT_LEND_FALLBACK_GAS, MORPHO_MIDNIGHT_BORROW_FALLBACK_GAS, MORPHO_MIDNIGHT_REPAY_FALLBACK_GAS, MORPHO_MIDNIGHT_AUTHORIZE_FALLBACK_GAS, MORPHO_MIDNIGHT_ERC20_APPROVE_FALLBACK, MORPHO_MIDNIGHT_WETH_DEPOSIT_FALLBACK, MORPHO_MIDNIGHT_CREATE_CALLBACK_FALLBACK_GAS, MORPHO_MIDNIGHT_BLUE_SUPPLY_FALLBACK_GAS, MORPHO_MIDNIGHT_BLUE_WITHDRAW_FALLBACK_GAS, MORPHO_MIDNIGHT_SET_ROOT_FALLBACK_GAS, MORPHO_MIDNIGHT_MEMPOOL_PUBLISH_FALLBACK_GAS, MORPHO_MIDNIGHT_SET_CONSUMED_FALLBACK_GAS;
|
|
117
130
|
var init_midnightConstants = __esm({
|
|
118
131
|
"src/protocols/evm/morpho/midnightConstants.ts"() {
|
|
119
132
|
MORPHO_MIDNIGHT_REST_BASE = "https://api.morpho.org/v0/midnight";
|
|
120
133
|
MORPHO_MIDNIGHT_BOOKS_MAX_LIMIT = 20;
|
|
121
134
|
MORPHO_MIDNIGHT_DEFAULT_SLIPPAGE_PCT = "0.5";
|
|
122
135
|
MORPHO_MIDNIGHT_DEFAULT_DEADLINE_SECONDS = 3600;
|
|
136
|
+
MORPHO_MIDNIGHT_DEFAULT_OFFER_TTL_SECONDS = 7 * 24 * 3600;
|
|
123
137
|
MORPHO_MIDNIGHT_BASE_CHAIN_ID = 8453;
|
|
138
|
+
MORPHO_MIDNIGHT_ETHEREUM_CHAIN_ID = 1;
|
|
139
|
+
MORPHO_BLUE_CANONICAL = "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
|
|
140
|
+
MORPHO_MIDNIGHT_CALLBACK_SALT = viem.keccak256(viem.toBytes("continuum-midnight-lend-v1"));
|
|
124
141
|
MORPHO_MIDNIGHT_ADDRESSES = {
|
|
142
|
+
[MORPHO_MIDNIGHT_ETHEREUM_CHAIN_ID]: {
|
|
143
|
+
midnight: "0x471686c42792F93528B000beF54bC10E3aa2045f",
|
|
144
|
+
bundles: "0x7c00dBB2b6b6b9B28745332e550dC8782Fcf77EC",
|
|
145
|
+
mempool: "0xde2d62449301a09A51EbF9326EA60d2e8BF4A8F7",
|
|
146
|
+
setterRatifier: "0xb72c416382c8A6399D0765CebfB032F040B00B3c",
|
|
147
|
+
ecrecoverRatifier: "0xAC439c81CAA6ef4C7B7E8F0110F8CE63A4b6D43e",
|
|
148
|
+
blueBuyCallbackFactory: "0x172d1FdC5f79bFe1ED46448f18541E591E5c93a7",
|
|
149
|
+
morphoBlue: MORPHO_BLUE_CANONICAL
|
|
150
|
+
},
|
|
125
151
|
[MORPHO_MIDNIGHT_BASE_CHAIN_ID]: {
|
|
126
|
-
midnight: "
|
|
127
|
-
bundles: "
|
|
152
|
+
midnight: "0xAdedD8ab6dE832766Fedf0FaC4992E5C4D3EA18A",
|
|
153
|
+
bundles: "0x091183d729BE9f808c212b475E387A12E67850A7",
|
|
154
|
+
mempool: "0xdD6DCE32e21f7b020898a8258dA37355b4017993",
|
|
155
|
+
setterRatifier: "0x800B5F12A61B8198a5a6EfD794Cac6699B294d63",
|
|
156
|
+
ecrecoverRatifier: "0xd6e70365C8E8DDa9a4ca662C07bbE663b017755E",
|
|
157
|
+
blueBuyCallbackFactory: "0x7337f119Eca028bD39E0e543cEf71631D2333425",
|
|
158
|
+
morphoBlue: MORPHO_BLUE_CANONICAL
|
|
128
159
|
}
|
|
129
160
|
};
|
|
130
161
|
TOKEN_PERMIT_NONE = { kind: 0, data: "0x" };
|
|
@@ -134,6 +165,12 @@ var init_midnightConstants = __esm({
|
|
|
134
165
|
MORPHO_MIDNIGHT_AUTHORIZE_FALLBACK_GAS = 80000n;
|
|
135
166
|
MORPHO_MIDNIGHT_ERC20_APPROVE_FALLBACK = 100000n;
|
|
136
167
|
MORPHO_MIDNIGHT_WETH_DEPOSIT_FALLBACK = 120000n;
|
|
168
|
+
MORPHO_MIDNIGHT_CREATE_CALLBACK_FALLBACK_GAS = 1200000n;
|
|
169
|
+
MORPHO_MIDNIGHT_BLUE_SUPPLY_FALLBACK_GAS = 400000n;
|
|
170
|
+
MORPHO_MIDNIGHT_BLUE_WITHDRAW_FALLBACK_GAS = 350000n;
|
|
171
|
+
MORPHO_MIDNIGHT_SET_ROOT_FALLBACK_GAS = 80000n;
|
|
172
|
+
MORPHO_MIDNIGHT_MEMPOOL_PUBLISH_FALLBACK_GAS = 250000n;
|
|
173
|
+
MORPHO_MIDNIGHT_SET_CONSUMED_FALLBACK_GAS = 80000n;
|
|
137
174
|
}
|
|
138
175
|
});
|
|
139
176
|
|
|
@@ -143,6 +180,7 @@ __export(midnightApi_exports, {
|
|
|
143
180
|
fetchMorphoMidnightBook: () => fetchMorphoMidnightBook,
|
|
144
181
|
fetchMorphoMidnightBookQuote: () => fetchMorphoMidnightBookQuote,
|
|
145
182
|
fetchMorphoMidnightBooks: () => fetchMorphoMidnightBooks,
|
|
183
|
+
fetchMorphoMidnightMakerOffers: () => fetchMorphoMidnightMakerOffers,
|
|
146
184
|
fetchMorphoMidnightMarketById: () => fetchMorphoMidnightMarketById,
|
|
147
185
|
fetchMorphoMidnightUserMarketPosition: () => fetchMorphoMidnightUserMarketPosition,
|
|
148
186
|
fetchMorphoMidnightUserPositions: () => fetchMorphoMidnightUserPositions,
|
|
@@ -284,6 +322,39 @@ async function fetchMorphoMidnightUserPositions(args) {
|
|
|
284
322
|
}
|
|
285
323
|
return rows;
|
|
286
324
|
}
|
|
325
|
+
async function fetchMorphoMidnightMakerOffers(args) {
|
|
326
|
+
const qs = new URLSearchParams();
|
|
327
|
+
qs.set("maker", viem.getAddress(args.maker));
|
|
328
|
+
if (args.chainId != null) qs.set("chain_ids", String(args.chainId));
|
|
329
|
+
const j = await midnightGetJson(`/takeable-offers?${qs}`);
|
|
330
|
+
const out = [];
|
|
331
|
+
for (const row of j.data ?? []) {
|
|
332
|
+
const o = row.offer;
|
|
333
|
+
if (!o?.maker || !viem.isAddress(o.maker) || !o.market?.loan_token || !viem.isAddress(o.market.loan_token)) continue;
|
|
334
|
+
if (!o.market.midnight || !viem.isAddress(o.market.midnight)) continue;
|
|
335
|
+
const group = (o.group ?? "").trim();
|
|
336
|
+
if (!group.startsWith("0x") || group.length !== 66) continue;
|
|
337
|
+
const callback = o.callback && viem.isAddress(o.callback) ? viem.getAddress(o.callback) : "0x0000000000000000000000000000000000000000";
|
|
338
|
+
out.push({
|
|
339
|
+
marketId: String(row.market_id ?? ""),
|
|
340
|
+
chainId: Number(o.market.chain_id ?? args.chainId ?? 0),
|
|
341
|
+
midnight: viem.getAddress(o.market.midnight),
|
|
342
|
+
loanToken: viem.getAddress(o.market.loan_token),
|
|
343
|
+
maker: viem.getAddress(o.maker),
|
|
344
|
+
buy: o.buy === true,
|
|
345
|
+
tick: String(o.tick ?? "0"),
|
|
346
|
+
maxAssets: String(o.max_assets ?? "0"),
|
|
347
|
+
maxUnits: String(o.max_units ?? "0"),
|
|
348
|
+
expiry: Number(o.expiry ?? 0),
|
|
349
|
+
group,
|
|
350
|
+
callback,
|
|
351
|
+
callbackData: o.callback_data ?? "0x",
|
|
352
|
+
units: String(row.units ?? "0"),
|
|
353
|
+
maturity: o.market.maturity != null ? Number(o.market.maturity) : null
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
return out;
|
|
357
|
+
}
|
|
287
358
|
async function fetchMorphoMidnightUserMarketPosition(args) {
|
|
288
359
|
const marketId = args.marketId.trim();
|
|
289
360
|
const user = args.user.trim();
|
|
@@ -603,9 +674,9 @@ async function loadFullCurveSessionForRpc(rpcUrl) {
|
|
|
603
674
|
if (!url) {
|
|
604
675
|
throw new Error("rpcUrl is required.");
|
|
605
676
|
}
|
|
606
|
-
const
|
|
607
|
-
if (
|
|
608
|
-
return
|
|
677
|
+
const cached2 = curveSessionCache.get(url);
|
|
678
|
+
if (cached2 && cached2.expiresAt > Date.now()) {
|
|
679
|
+
return cached2.session;
|
|
609
680
|
}
|
|
610
681
|
try {
|
|
611
682
|
const { default: curve } = await import('@curvefi/api');
|
|
@@ -921,7 +992,7 @@ var evmMultisignCommonInputSchema = zod.z.object({
|
|
|
921
992
|
chainDetail: chainDetailSchema.optional().describe("Server-filled gas row from chain registry when keyGenId is set."),
|
|
922
993
|
customGasChainDetails: zod.z.record(zod.z.unknown()).optional().describe("Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true."),
|
|
923
994
|
expiryDate: zod.z.number().int().positive().optional().describe(
|
|
924
|
-
"Optional Unix seconds (UTC) when the MPC sign request expires. Uniswap V4, GMX, Hyperliquid,
|
|
995
|
+
"Optional Unix seconds (UTC) when the MPC sign request expires. Uniswap V4, GMX, Hyperliquid, Curve DAO, and Aerodrome default to 30 minutes when omitted; other protocols use the node default (7 days)."
|
|
925
996
|
)
|
|
926
997
|
});
|
|
927
998
|
function withMultisignKeySourceRefine(schema) {
|
|
@@ -1657,6 +1728,182 @@ var mcpCurveDaoBuildSwapMultisignInputSchema = withMultisignKeySourceRefine(
|
|
|
1657
1728
|
})
|
|
1658
1729
|
)
|
|
1659
1730
|
);
|
|
1731
|
+
var chain8453 = agentEvmChainIdSchema.describe("Must be 8453 (Base). Aerodrome is Base-only.");
|
|
1732
|
+
var rpcUrlOptional = zod.z.string().min(1).optional().describe("JSON-RPC URL; continuum-mcp-server injects from chain registry \u2014 do not pass a public RPC URL");
|
|
1733
|
+
var mcpAerodromeDiscoverPoolsInputSchema = zod.z.object({
|
|
1734
|
+
chainId: chain8453,
|
|
1735
|
+
rpcUrl: rpcUrlOptional,
|
|
1736
|
+
token: zod.z.string().min(1).describe("Ticker or 0x address to find pools for (AAPLc, USDC, ETH, WETH, AERO)."),
|
|
1737
|
+
tokenOut: zod.z.string().min(1).optional().describe("Optional counterpart. Defaults to USDC so B20 stocks resolve. Tickers OK.")
|
|
1738
|
+
});
|
|
1739
|
+
var mcpAerodromeDiscoverPoolsOutputSchema = jsonObjectSchema.describe(
|
|
1740
|
+
"{ token, tokenOut, pools[] (lp, kind, tickSpacing, factory), notes }. Factory getPool only \u2014 not LpSugar. Then call ctm_aerodrome_quote."
|
|
1741
|
+
);
|
|
1742
|
+
var mcpAerodromeFetchPoolsInputSchema = zod.z.object({
|
|
1743
|
+
chainId: chain8453,
|
|
1744
|
+
rpcUrl: rpcUrlOptional,
|
|
1745
|
+
limit: zod.z.number().int().positive().max(200).optional(),
|
|
1746
|
+
offset: zod.z.number().int().min(0).optional()
|
|
1747
|
+
});
|
|
1748
|
+
var mcpAerodromeFetchPoolsOutputSchema = jsonObjectSchema.describe("{ chainId, pools[] }");
|
|
1749
|
+
var mcpAerodromeFetchPositionsInputSchema = zod.z.object({
|
|
1750
|
+
chainId: chain8453,
|
|
1751
|
+
rpcUrl: rpcUrlOptional,
|
|
1752
|
+
account: evmAddressSchema.optional(),
|
|
1753
|
+
executorAddress: evmAddressSchema.optional().describe("Server-filled from keyGenId when omitted")
|
|
1754
|
+
});
|
|
1755
|
+
var mcpAerodromeFetchPositionsOutputSchema = jsonObjectSchema.describe(
|
|
1756
|
+
"{ chainId, account, notes, positions[] } \u2014 each row has label (vAMM-USDC/AERO \xB7 #id), kind, gauge, stakedInGauge, claimFees.pool, claimEmissions (gauge + tokenId/cl for Slipstream, or null if no gauge). Dust v2 rows omitted."
|
|
1757
|
+
);
|
|
1758
|
+
var mcpAerodromeQuoteInputSchema = zod.z.object({
|
|
1759
|
+
chainId: chain8453,
|
|
1760
|
+
rpcUrl: rpcUrlOptional,
|
|
1761
|
+
tokenIn: zod.z.string().min(1).describe("Ticker (AAPLc, USDC, ETH, WETH, AERO) or 0x address. Native: 0x0 / eth. B20 stocks need no address lookup."),
|
|
1762
|
+
tokenOut: zod.z.string().min(1).describe("Ticker (AAPLc, USDC, ETH, WETH, AERO) or 0x address. Native: 0x0 / eth."),
|
|
1763
|
+
amountHuman: zod.z.string().min(1).describe("Human-readable amount of tokenIn (B20 stocks are 8 decimals)"),
|
|
1764
|
+
tokenInDecimals: zod.z.number().int().min(0).max(18).optional().describe("Optional override. Omit for known tickers \u2014 AAPLc and other B20 stocks always use 8.")
|
|
1765
|
+
});
|
|
1766
|
+
var mcpAerodromeQuoteOutputSchema = jsonObjectSchema.describe(
|
|
1767
|
+
"{ tokenIn, tokenOut, amountInWei, amountOutWei, amountOutHuman, priceImpactPercent (0\u2013100 vs a tiny same-route probe, or null), hops, pathPacked, isNativeIn, isNativeOut, source }"
|
|
1768
|
+
);
|
|
1769
|
+
var mcpAerodromeBuildSwapMultisignInputSchema = withMultisignKeySourceRefine(
|
|
1770
|
+
evmMultisignCommonInputSchema.extend({
|
|
1771
|
+
tokenIn: zod.z.string().min(1).describe("Ticker (AAPLc, USDC, ETH, WETH, AERO) or 0x address / 0x0 native"),
|
|
1772
|
+
tokenOut: zod.z.string().min(1).describe("Ticker (AAPLc, USDC, ETH, WETH, AERO) or 0x address / 0x0 native"),
|
|
1773
|
+
amountHuman: zod.z.string().min(1),
|
|
1774
|
+
slippagePercent: zod.z.number().gt(0).lt(100),
|
|
1775
|
+
quoteSnapshot: jsonObjectSchema.optional()
|
|
1776
|
+
})
|
|
1777
|
+
);
|
|
1778
|
+
var mcpAerodromeQuoteAddLiquidityInputSchema = zod.z.object({
|
|
1779
|
+
chainId: chain8453,
|
|
1780
|
+
rpcUrl: rpcUrlOptional,
|
|
1781
|
+
tokenA: zod.z.string().min(1).describe("Ticker (AAPLc, USDC, ETH, WETH, AERO) or 0x / 0x0 native"),
|
|
1782
|
+
tokenB: zod.z.string().min(1).describe("Ticker (AAPLc, USDC, ETH, WETH, AERO) or 0x / 0x0 native"),
|
|
1783
|
+
stable: agentBooleanSchema(false),
|
|
1784
|
+
amountAHuman: zod.z.string().optional().describe("Human amount of tokenA. Omit to solve from tokenB (one-sided, same as the dialog)."),
|
|
1785
|
+
amountBHuman: zod.z.string().optional().describe("Human amount of tokenB. Omit to solve from tokenA (one-sided, same as the dialog)."),
|
|
1786
|
+
tokenADecimals: zod.z.number().int().min(0).max(18).optional(),
|
|
1787
|
+
tokenBDecimals: zod.z.number().int().min(0).max(18).optional()
|
|
1788
|
+
}).refine((v) => Boolean((v.amountAHuman ?? "").trim() || (v.amountBHuman ?? "").trim()), {
|
|
1789
|
+
message: "Enter amountAHuman or amountBHuman. The other side is filled from the current vAMM, sAMM, or Slipstream pool."
|
|
1790
|
+
});
|
|
1791
|
+
var mcpAerodromeQuoteAddLiquidityOutputSchema = jsonObjectSchema.describe(
|
|
1792
|
+
"{ tokenA, tokenB, amountAHuman, amountBHuman, kind (stable|volatile|cl), tickSpacing?, emptyPool, seedable, hint }. seedable:false = do not first-deposit (ETH/AAPLc has no pool \u2014 pair vs USDC). kind:cl is a Slipstream ratio; basic addLiquidity is v2 only."
|
|
1793
|
+
);
|
|
1794
|
+
var mcpAerodromeQuoteClDepositInputSchema = zod.z.object({
|
|
1795
|
+
chainId: chain8453,
|
|
1796
|
+
rpcUrl: rpcUrlOptional,
|
|
1797
|
+
token0: zod.z.string().min(1).describe("Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native"),
|
|
1798
|
+
token1: zod.z.string().min(1).describe("Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native"),
|
|
1799
|
+
amount0Human: zod.z.string().optional(),
|
|
1800
|
+
amount1Human: zod.z.string().optional(),
|
|
1801
|
+
tickSpacing: zod.z.number().int(),
|
|
1802
|
+
tickLower: zod.z.number().int(),
|
|
1803
|
+
tickUpper: zod.z.number().int(),
|
|
1804
|
+
sqrtPriceX96: zod.z.string().min(1).describe("0 if the CL pool already exists")
|
|
1805
|
+
});
|
|
1806
|
+
var mcpAerodromeQuoteClDepositOutputSchema = jsonObjectSchema;
|
|
1807
|
+
var mcpAerodromeBuildAddLiquidityMultisignInputSchema = withMultisignKeySourceRefine(
|
|
1808
|
+
evmMultisignCommonInputSchema.extend({
|
|
1809
|
+
tokenA: zod.z.string().min(1).describe("Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native"),
|
|
1810
|
+
tokenB: zod.z.string().min(1).describe("Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native"),
|
|
1811
|
+
stable: agentBooleanSchema(false),
|
|
1812
|
+
amountAHuman: zod.z.string().optional().describe("Omit to solve from amountBHuman (one-sided)."),
|
|
1813
|
+
amountBHuman: zod.z.string().optional().describe("Omit to solve from amountAHuman (one-sided)."),
|
|
1814
|
+
slippagePercent: zod.z.number().gt(0).lt(100)
|
|
1815
|
+
}).refine((v) => Boolean((v.amountAHuman ?? "").trim() || (v.amountBHuman ?? "").trim()), {
|
|
1816
|
+
message: "Enter amountAHuman or amountBHuman."
|
|
1817
|
+
})
|
|
1818
|
+
);
|
|
1819
|
+
var mcpAerodromeBuildRemoveLiquidityMultisignInputSchema = withMultisignKeySourceRefine(
|
|
1820
|
+
evmMultisignCommonInputSchema.extend({
|
|
1821
|
+
tokenA: zod.z.string().min(1),
|
|
1822
|
+
tokenB: zod.z.string().min(1),
|
|
1823
|
+
stable: agentBooleanSchema(false),
|
|
1824
|
+
lpToken: evmAddressSchema,
|
|
1825
|
+
liquidityHuman: zod.z.string().min(1),
|
|
1826
|
+
lpDecimals: zod.z.number().int().min(0).max(18).optional(),
|
|
1827
|
+
amountAMinHuman: zod.z.string().optional(),
|
|
1828
|
+
amountBMinHuman: zod.z.string().optional()
|
|
1829
|
+
})
|
|
1830
|
+
);
|
|
1831
|
+
var mcpAerodromeBuildClMintMultisignInputSchema = withMultisignKeySourceRefine(
|
|
1832
|
+
evmMultisignCommonInputSchema.extend({
|
|
1833
|
+
token0: zod.z.string().min(1),
|
|
1834
|
+
token1: zod.z.string().min(1),
|
|
1835
|
+
amount0Human: zod.z.string().optional(),
|
|
1836
|
+
amount1Human: zod.z.string().optional(),
|
|
1837
|
+
tickSpacing: zod.z.number().int(),
|
|
1838
|
+
tickLower: zod.z.number().int(),
|
|
1839
|
+
tickUpper: zod.z.number().int(),
|
|
1840
|
+
sqrtPriceX96: zod.z.string().min(1),
|
|
1841
|
+
slippagePercent: zod.z.number().gt(0).lt(100)
|
|
1842
|
+
})
|
|
1843
|
+
);
|
|
1844
|
+
var mcpAerodromeBuildClIncreaseMultisignInputSchema = withMultisignKeySourceRefine(
|
|
1845
|
+
evmMultisignCommonInputSchema.extend({
|
|
1846
|
+
tokenId: zod.z.string().min(1),
|
|
1847
|
+
token0: zod.z.string().min(1),
|
|
1848
|
+
token1: zod.z.string().min(1),
|
|
1849
|
+
amount0Wei: zod.z.string().min(1),
|
|
1850
|
+
amount1Wei: zod.z.string().min(1),
|
|
1851
|
+
slippagePercent: zod.z.number().gt(0).lt(100)
|
|
1852
|
+
})
|
|
1853
|
+
);
|
|
1854
|
+
var mcpAerodromeBuildClDecreaseMultisignInputSchema = withMultisignKeySourceRefine(
|
|
1855
|
+
evmMultisignCommonInputSchema.extend({
|
|
1856
|
+
tokenId: zod.z.string().min(1),
|
|
1857
|
+
liquidity: zod.z.string().min(1),
|
|
1858
|
+
amount0MinWei: zod.z.string().optional(),
|
|
1859
|
+
amount1MinWei: zod.z.string().optional()
|
|
1860
|
+
})
|
|
1861
|
+
);
|
|
1862
|
+
var mcpAerodromeBuildClBurnMultisignInputSchema = withMultisignKeySourceRefine(
|
|
1863
|
+
evmMultisignCommonInputSchema.extend({
|
|
1864
|
+
tokenId: zod.z.string().min(1)
|
|
1865
|
+
})
|
|
1866
|
+
);
|
|
1867
|
+
var mcpAerodromeBuildGaugeStakeMultisignInputSchema = withMultisignKeySourceRefine(
|
|
1868
|
+
evmMultisignCommonInputSchema.extend({
|
|
1869
|
+
gauge: evmAddressSchema,
|
|
1870
|
+
lpToken: evmAddressSchema.optional(),
|
|
1871
|
+
amountHuman: zod.z.string().optional(),
|
|
1872
|
+
lpDecimals: zod.z.number().int().min(0).max(18).optional(),
|
|
1873
|
+
tokenId: zod.z.string().optional(),
|
|
1874
|
+
cl: agentBooleanSchema(false)
|
|
1875
|
+
})
|
|
1876
|
+
);
|
|
1877
|
+
var mcpAerodromeBuildGaugeUnstakeMultisignInputSchema = withMultisignKeySourceRefine(
|
|
1878
|
+
evmMultisignCommonInputSchema.extend({
|
|
1879
|
+
gauge: evmAddressSchema,
|
|
1880
|
+
amountHuman: zod.z.string().optional(),
|
|
1881
|
+
lpDecimals: zod.z.number().int().min(0).max(18).optional(),
|
|
1882
|
+
tokenId: zod.z.string().optional(),
|
|
1883
|
+
cl: agentBooleanSchema(false)
|
|
1884
|
+
})
|
|
1885
|
+
);
|
|
1886
|
+
var mcpAerodromeBuildClaimFeesMultisignInputSchema = withMultisignKeySourceRefine(
|
|
1887
|
+
evmMultisignCommonInputSchema.extend({
|
|
1888
|
+
pool: evmAddressSchema.describe(
|
|
1889
|
+
"Pool (lp) from ctm_aerodrome_fetch_positions claimFees.pool \u2014 not the gauge. Dialog: \u201CFees from the pool\u201D."
|
|
1890
|
+
)
|
|
1891
|
+
})
|
|
1892
|
+
);
|
|
1893
|
+
var mcpAerodromeBuildClCollectFeesMultisignInputSchema = withMultisignKeySourceRefine(
|
|
1894
|
+
evmMultisignCommonInputSchema.extend({
|
|
1895
|
+
tokenId: zod.z.string().min(1)
|
|
1896
|
+
})
|
|
1897
|
+
);
|
|
1898
|
+
var mcpAerodromeBuildClaimEmissionsMultisignInputSchema = withMultisignKeySourceRefine(
|
|
1899
|
+
evmMultisignCommonInputSchema.extend({
|
|
1900
|
+
gauge: evmAddressSchema.describe(
|
|
1901
|
+
"Gauge from fetch_positions claimEmissions.gauge \u2014 not the pool. Dialog: \u201CEmissions from the gauge in AERO\u201D. Skip if claimEmissions is null."
|
|
1902
|
+
),
|
|
1903
|
+
tokenId: zod.z.string().optional().describe("Required for Slipstream staked positions (claimEmissions.tokenId)."),
|
|
1904
|
+
cl: agentBooleanSchema(false).describe("true when claimEmissions.cl (Slipstream NFT getReward).")
|
|
1905
|
+
})
|
|
1906
|
+
);
|
|
1660
1907
|
|
|
1661
1908
|
// src/protocols/evm/morpho/robinhoodEarn.ts
|
|
1662
1909
|
var ROBINHOOD_CHAIN_ID = 4663;
|
|
@@ -1833,6 +2080,23 @@ function preprocessMorphoMidnightBorrowInput(raw) {
|
|
|
1833
2080
|
}
|
|
1834
2081
|
return o;
|
|
1835
2082
|
}
|
|
2083
|
+
function preprocessMorphoMidnightLendOfferInput(raw) {
|
|
2084
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
2085
|
+
const o = { ...raw };
|
|
2086
|
+
const purposeText = String(o.purposeText ?? o.purpose ?? "").trim();
|
|
2087
|
+
if (!purposeText) {
|
|
2088
|
+
const amt = String(o.amountHuman ?? "").trim();
|
|
2089
|
+
if (amt) o.purposeText = `Morpho Midnight lend offer ${amt}`;
|
|
2090
|
+
}
|
|
2091
|
+
return o;
|
|
2092
|
+
}
|
|
2093
|
+
function preprocessMorphoMidnightCancelLendOfferInput(raw) {
|
|
2094
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
2095
|
+
const o = { ...raw };
|
|
2096
|
+
const purposeText = String(o.purposeText ?? o.purpose ?? "").trim();
|
|
2097
|
+
if (!purposeText) o.purposeText = "Morpho Midnight cancel lend offer";
|
|
2098
|
+
return o;
|
|
2099
|
+
}
|
|
1836
2100
|
function preprocessMorphoMidnightRepayInput(raw) {
|
|
1837
2101
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
1838
2102
|
const o = { ...raw };
|
|
@@ -1914,6 +2178,34 @@ var mcpMorphoFetchMidnightPositionsOutputSchema = zod.z.object({
|
|
|
1914
2178
|
})
|
|
1915
2179
|
)
|
|
1916
2180
|
});
|
|
2181
|
+
var mcpMorphoFetchMidnightOffersInputSchema = zod.z.object({
|
|
2182
|
+
user: zod.z.string().min(1).describe("Maker EVM address"),
|
|
2183
|
+
chainId: agentEvmChainIdSchema.optional()
|
|
2184
|
+
});
|
|
2185
|
+
var mcpMorphoFetchMidnightOffersOutputSchema = zod.z.object({
|
|
2186
|
+
offers: zod.z.array(
|
|
2187
|
+
zod.z.object({
|
|
2188
|
+
marketId: zod.z.string(),
|
|
2189
|
+
chainId: zod.z.number().int(),
|
|
2190
|
+
midnightAddress: zod.z.string(),
|
|
2191
|
+
loanTokenAddress: zod.z.string(),
|
|
2192
|
+
maker: zod.z.string(),
|
|
2193
|
+
group: zod.z.string().describe("Pass to ctm_morpho_build_midnight_cancel_lend_offer_multisign"),
|
|
2194
|
+
callback: zod.z.string(),
|
|
2195
|
+
callbackData: zod.z.string(),
|
|
2196
|
+
tick: zod.z.string(),
|
|
2197
|
+
maxAssets: zod.z.string(),
|
|
2198
|
+
remainingUnits: zod.z.string(),
|
|
2199
|
+
expiry: zod.z.number(),
|
|
2200
|
+
expiryIso: zod.z.string(),
|
|
2201
|
+
maturity: zod.z.number().nullable(),
|
|
2202
|
+
maturityIso: zod.z.string(),
|
|
2203
|
+
lendApr: zod.z.string(),
|
|
2204
|
+
lendAprNumeric: zod.z.number().nullable(),
|
|
2205
|
+
marketLabel: zod.z.string()
|
|
2206
|
+
})
|
|
2207
|
+
)
|
|
2208
|
+
});
|
|
1917
2209
|
var mcpServerCommonInputSchema = zod.z.object({
|
|
1918
2210
|
keyGenId: zod.z.string().min(1).describe("KeyGen id from fetch_key_gen_result / node preferred KeyGen"),
|
|
1919
2211
|
chainId: zod.z.number().int().positive().describe("EVM chain id; RPC and gas config resolved from chain registry"),
|
|
@@ -2293,6 +2585,35 @@ var mcpMorphoMidnightBorrowInputSchema = withMultisignKeySourceRefine(
|
|
|
2293
2585
|
})
|
|
2294
2586
|
)
|
|
2295
2587
|
);
|
|
2588
|
+
var mcpMorphoMidnightLendOfferInputSchema = withMultisignKeySourceRefine(
|
|
2589
|
+
zod.z.preprocess(
|
|
2590
|
+
preprocessMorphoMidnightLendOfferInput,
|
|
2591
|
+
evmMultisignCommonInputSchema.extend({
|
|
2592
|
+
marketId: zod.z.string().min(1).describe("marketId from ctm_morpho_fetch_midnight_books"),
|
|
2593
|
+
amountHuman: zod.z.string().min(1).describe("Loan-token amount to park in Blue and quote on Midnight"),
|
|
2594
|
+
loanToken: evmAddressSchema.optional(),
|
|
2595
|
+
lendAprPct: zod.z.string().optional().describe("Target fixed lend APR percent, e.g. 5.2. Defaults to book best bid."),
|
|
2596
|
+
tick: zod.z.string().optional().describe("Override Midnight tick (takes precedence over lendAprPct)"),
|
|
2597
|
+
blueMarketId: zod.z.string().optional().describe("Morpho Blue market to earn variable yield until the offer fills"),
|
|
2598
|
+
expirySeconds: agentCoercedOptionalIntSchema(zod.z.number().int().min(60)),
|
|
2599
|
+
marketLabel: zod.z.string().optional(),
|
|
2600
|
+
isNativeIn: agentOptionalBooleanSchema()
|
|
2601
|
+
})
|
|
2602
|
+
)
|
|
2603
|
+
);
|
|
2604
|
+
var mcpMorphoMidnightCancelLendOfferInputSchema = withMultisignKeySourceRefine(
|
|
2605
|
+
zod.z.preprocess(
|
|
2606
|
+
preprocessMorphoMidnightCancelLendOfferInput,
|
|
2607
|
+
evmMultisignCommonInputSchema.extend({
|
|
2608
|
+
group: zod.z.string().min(1).describe("Offer group id from ctm_morpho_fetch_midnight_offers"),
|
|
2609
|
+
callback: evmAddressSchema.optional(),
|
|
2610
|
+
callbackData: zod.z.string().optional().describe("Hex Blue MarketParams from the offer row"),
|
|
2611
|
+
midnight: evmAddressSchema.optional(),
|
|
2612
|
+
withdrawRemaining: agentOptionalBooleanSchema(),
|
|
2613
|
+
marketLabel: zod.z.string().optional()
|
|
2614
|
+
})
|
|
2615
|
+
)
|
|
2616
|
+
);
|
|
2296
2617
|
var mcpMorphoMidnightRepayInputSchema = withMultisignKeySourceRefine(
|
|
2297
2618
|
zod.z.preprocess(
|
|
2298
2619
|
preprocessMorphoMidnightRepayInput,
|
|
@@ -2794,6 +3115,96 @@ var mcpEulerV2FetchLendVaultsOutputSchema = zod.z.object({
|
|
|
2794
3115
|
})
|
|
2795
3116
|
)
|
|
2796
3117
|
});
|
|
3118
|
+
var mcpCompoundV3FetchMarketsInputSchema = zod.z.object({
|
|
3119
|
+
chainId: agentEvmChainIdSchema,
|
|
3120
|
+
rpcUrl: zod.z.string().min(1).optional().describe("Server-filled from chain registry. Agents should omit.")
|
|
3121
|
+
});
|
|
3122
|
+
var mcpCompoundV3MarketAssetSchema = zod.z.object({
|
|
3123
|
+
asset: zod.z.string(),
|
|
3124
|
+
symbol: zod.z.string(),
|
|
3125
|
+
decimals: zod.z.number(),
|
|
3126
|
+
borrowCollateralFactorPercent: zod.z.number(),
|
|
3127
|
+
liquidateCollateralFactorPercent: zod.z.number(),
|
|
3128
|
+
priceRaw: zod.z.string(),
|
|
3129
|
+
role: zod.z.enum(["base", "collateral"])
|
|
3130
|
+
});
|
|
3131
|
+
var mcpCompoundV3MarketSummarySchema = zod.z.object({
|
|
3132
|
+
chainId: zod.z.number(),
|
|
3133
|
+
slug: zod.z.string(),
|
|
3134
|
+
symbol: zod.z.string(),
|
|
3135
|
+
comet: zod.z.string().describe("Comet proxy \u2014 copy as comet for write tools"),
|
|
3136
|
+
rewards: zod.z.string(),
|
|
3137
|
+
bulker: zod.z.string().nullable(),
|
|
3138
|
+
baseToken: zod.z.string().nullable(),
|
|
3139
|
+
utilization: zod.z.number().nullable(),
|
|
3140
|
+
supplyAprPercent: zod.z.string().nullable(),
|
|
3141
|
+
borrowAprPercent: zod.z.string().nullable(),
|
|
3142
|
+
assets: zod.z.array(mcpCompoundV3MarketAssetSchema)
|
|
3143
|
+
});
|
|
3144
|
+
var mcpCompoundV3FetchMarketsOutputSchema = zod.z.object({
|
|
3145
|
+
markets: zod.z.array(mcpCompoundV3MarketSummarySchema),
|
|
3146
|
+
notes: zod.z.string()
|
|
3147
|
+
});
|
|
3148
|
+
var mcpCompoundV3FetchMarketInputSchema = zod.z.object({
|
|
3149
|
+
chainId: agentEvmChainIdSchema,
|
|
3150
|
+
comet: evmAddressSchema.describe("Comet proxy from ctm_compound_v3_fetch_markets"),
|
|
3151
|
+
rpcUrl: zod.z.string().min(1).optional().describe("Server-filled from chain registry. Agents should omit.")
|
|
3152
|
+
});
|
|
3153
|
+
var mcpCompoundV3FetchMarketOutputSchema = mcpCompoundV3MarketSummarySchema;
|
|
3154
|
+
var mcpCompoundV3FetchAccountInputSchema = zod.z.object({
|
|
3155
|
+
chainId: agentEvmChainIdSchema,
|
|
3156
|
+
comet: evmAddressSchema.describe("Comet proxy from ctm_compound_v3_fetch_markets"),
|
|
3157
|
+
account: evmAddressSchema.describe("MPC executor / user address"),
|
|
3158
|
+
rpcUrl: zod.z.string().min(1).optional().describe("Server-filled from chain registry. Agents should omit.")
|
|
3159
|
+
});
|
|
3160
|
+
var mcpCompoundV3FetchAccountOutputSchema = zod.z.object({
|
|
3161
|
+
comet: zod.z.string(),
|
|
3162
|
+
symbol: zod.z.string(),
|
|
3163
|
+
baseSupplied: zod.z.string(),
|
|
3164
|
+
baseBorrowed: zod.z.string(),
|
|
3165
|
+
collaterals: zod.z.array(
|
|
3166
|
+
zod.z.object({
|
|
3167
|
+
asset: zod.z.string(),
|
|
3168
|
+
symbol: zod.z.string(),
|
|
3169
|
+
balance: zod.z.string()
|
|
3170
|
+
})
|
|
3171
|
+
),
|
|
3172
|
+
isBorrowCollateralized: zod.z.boolean(),
|
|
3173
|
+
isLiquidatable: zod.z.boolean(),
|
|
3174
|
+
rewardToken: zod.z.string().nullable(),
|
|
3175
|
+
rewardOwed: zod.z.string().nullable()
|
|
3176
|
+
});
|
|
3177
|
+
var compoundV3WriteFields = {
|
|
3178
|
+
comet: evmAddressSchema.describe("Comet proxy from ctm_compound_v3_fetch_markets. Never the implementation."),
|
|
3179
|
+
asset: evmAddressSchema.describe(
|
|
3180
|
+
"Token to supply/withdraw. Native ETH: 0x0000000000000000000000000000000000000000 or set isNative true."
|
|
3181
|
+
),
|
|
3182
|
+
amountHuman: zod.z.string().min(1).describe('Human amount (e.g. "100"). Withdraw base while undercollateralized borrows.'),
|
|
3183
|
+
isNative: agentOptionalBooleanSchema().describe(
|
|
3184
|
+
"Wrap/unwrap native ETH automatically (WETH.deposit/withdraw). Independent of useBulker."
|
|
3185
|
+
),
|
|
3186
|
+
isNativeIn: agentOptionalBooleanSchema().describe("Alias of isNative for supply/repay."),
|
|
3187
|
+
useBulker: agentOptionalBooleanSchema().describe(
|
|
3188
|
+
"If true, prefer ctm_compound_v3_build_bulker_multisign for combined actions. ETH wrap still works when false."
|
|
3189
|
+
)
|
|
3190
|
+
};
|
|
3191
|
+
var mcpCompoundV3SupplyInputSchema = mcpMultisignInput(compoundV3WriteFields);
|
|
3192
|
+
var mcpCompoundV3WithdrawInputSchema = mcpMultisignInput(compoundV3WriteFields);
|
|
3193
|
+
var mcpCompoundV3RepayInputSchema = mcpMultisignInput(compoundV3WriteFields);
|
|
3194
|
+
var mcpCompoundV3ClaimRewardsInputSchema = mcpMultisignInput({
|
|
3195
|
+
comet: evmAddressSchema.describe("Comet proxy from ctm_compound_v3_fetch_markets")
|
|
3196
|
+
});
|
|
3197
|
+
var mcpCompoundV3BulkerInputSchema = mcpMultisignInput({
|
|
3198
|
+
comet: evmAddressSchema.describe("Comet proxy from ctm_compound_v3_fetch_markets"),
|
|
3199
|
+
steps: zod.z.array(
|
|
3200
|
+
zod.z.object({
|
|
3201
|
+
action: zod.z.enum(["supply", "withdraw", "claim"]),
|
|
3202
|
+
asset: evmAddressSchema.optional(),
|
|
3203
|
+
amountHuman: zod.z.string().optional(),
|
|
3204
|
+
isNative: agentOptionalBooleanSchema()
|
|
3205
|
+
})
|
|
3206
|
+
).min(1).describe("Combined Bulker actions. Native supply/withdraw uses Bulker native token actions.")
|
|
3207
|
+
});
|
|
2797
3208
|
function mcpGmxMultisignInput(fields, preprocess) {
|
|
2798
3209
|
const inner = evmMultisignCommonInputSchema.extend(fields);
|
|
2799
3210
|
const shaped = preprocess ? zod.z.preprocess(preprocess, inner) : inner;
|
|
@@ -4078,6 +4489,26 @@ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
|
|
|
4078
4489
|
handler: { importPath: "protocols/evm/morpho", exportName: "buildEvmMultisignBodyMorphoMidnightLendBatch" },
|
|
4079
4490
|
inputZod: mcpMorphoMidnightLendInputSchema
|
|
4080
4491
|
}),
|
|
4492
|
+
defineProtocolMcpTool({
|
|
4493
|
+
name: "ctm_morpho_build_midnight_lend_offer_multisign",
|
|
4494
|
+
actionId: "morpho.midnight-lend-offer",
|
|
4495
|
+
protocolId: "morpho",
|
|
4496
|
+
chainCategory: "evm",
|
|
4497
|
+
description: "Build a Morpho Midnight lend limit offer. Parks the loan token in Morpho Blue (variable yield) until a borrower takes the offer via BlueBuyCallback.",
|
|
4498
|
+
prerequisites: ["keyGenId", "chainId", "marketId from ctm_morpho_fetch_midnight_books", "amountHuman"],
|
|
4499
|
+
handler: { importPath: "protocols/evm/morpho", exportName: "buildEvmMultisignBodyMorphoMidnightLendOfferBatch" },
|
|
4500
|
+
inputZod: mcpMorphoMidnightLendOfferInputSchema
|
|
4501
|
+
}),
|
|
4502
|
+
defineProtocolMcpTool({
|
|
4503
|
+
name: "ctm_morpho_build_midnight_cancel_lend_offer_multisign",
|
|
4504
|
+
actionId: "morpho.midnight-cancel-lend-offer",
|
|
4505
|
+
protocolId: "morpho",
|
|
4506
|
+
chainCategory: "evm",
|
|
4507
|
+
description: "Cancel a Morpho Midnight lend offer (exhaust the offer group) and withdraw unused Blue-parked funds.",
|
|
4508
|
+
prerequisites: ["keyGenId", "chainId", "group from ctm_morpho_fetch_midnight_offers"],
|
|
4509
|
+
handler: { importPath: "protocols/evm/morpho", exportName: "buildEvmMultisignBodyMorphoMidnightCancelLendOfferBatch" },
|
|
4510
|
+
inputZod: mcpMorphoMidnightCancelLendOfferInputSchema
|
|
4511
|
+
}),
|
|
4081
4512
|
defineProtocolMcpTool({
|
|
4082
4513
|
name: "ctm_morpho_build_midnight_borrow_multisign",
|
|
4083
4514
|
actionId: "morpho.midnight-borrow",
|
|
@@ -4650,6 +5081,56 @@ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
|
|
|
4650
5081
|
followUp: [...MCP_MULTISIGN_SUBMIT_FOLLOW_UP, "ctm_continuum_dao_forum_me"],
|
|
4651
5082
|
handler: { importPath: "protocols/evm/continuum-dao", exportName: "buildEvmMultisignBodyContinuumDaoForumSignIn" },
|
|
4652
5083
|
inputZod: mcpContinuumDaoForumSignInInputSchema
|
|
5084
|
+
}),
|
|
5085
|
+
defineProtocolMcpTool({
|
|
5086
|
+
name: "ctm_compound_v3_build_supply_multisign",
|
|
5087
|
+
actionId: "compound-v3.supply",
|
|
5088
|
+
protocolId: "compound-v3",
|
|
5089
|
+
chainCategory: "evm",
|
|
5090
|
+
description: "Supply base (earn or repay) or collateral to a Comet proxy. Native ETH always wraps via WETH.deposit even when useBulker is false.",
|
|
5091
|
+
prerequisites: ["keyGenId", "chainId", "comet from ctm_compound_v3_fetch_markets", "asset", "amountHuman"],
|
|
5092
|
+
handler: { importPath: "protocols/evm/compound-v3", exportName: "buildEvmMultisignBodyCompoundV3Supply" },
|
|
5093
|
+
inputZod: mcpCompoundV3SupplyInputSchema
|
|
5094
|
+
}),
|
|
5095
|
+
defineProtocolMcpTool({
|
|
5096
|
+
name: "ctm_compound_v3_build_withdraw_multisign",
|
|
5097
|
+
actionId: "compound-v3.withdraw",
|
|
5098
|
+
protocolId: "compound-v3",
|
|
5099
|
+
chainCategory: "evm",
|
|
5100
|
+
description: "Withdraw collateral or base from a Comet. Withdraw of base while undercollateralized borrows. Native ETH always unwraps via WETH.withdraw.",
|
|
5101
|
+
prerequisites: ["keyGenId", "chainId", "comet", "asset", "amountHuman", "ctm_compound_v3_fetch_account"],
|
|
5102
|
+
handler: { importPath: "protocols/evm/compound-v3", exportName: "buildEvmMultisignBodyCompoundV3Withdraw" },
|
|
5103
|
+
inputZod: mcpCompoundV3WithdrawInputSchema
|
|
5104
|
+
}),
|
|
5105
|
+
defineProtocolMcpTool({
|
|
5106
|
+
name: "ctm_compound_v3_build_repay_multisign",
|
|
5107
|
+
actionId: "compound-v3.repay",
|
|
5108
|
+
protocolId: "compound-v3",
|
|
5109
|
+
chainCategory: "evm",
|
|
5110
|
+
description: "Repay Comet base debt by supplying the base asset (same as supply of base while borrowed).",
|
|
5111
|
+
prerequisites: ["keyGenId", "chainId", "comet", "asset (base token)", "amountHuman"],
|
|
5112
|
+
handler: { importPath: "protocols/evm/compound-v3", exportName: "buildEvmMultisignBodyCompoundV3Repay" },
|
|
5113
|
+
inputZod: mcpCompoundV3RepayInputSchema
|
|
5114
|
+
}),
|
|
5115
|
+
defineProtocolMcpTool({
|
|
5116
|
+
name: "ctm_compound_v3_build_claim_rewards_multisign",
|
|
5117
|
+
actionId: "compound-v3.claim-rewards",
|
|
5118
|
+
protocolId: "compound-v3",
|
|
5119
|
+
chainCategory: "evm",
|
|
5120
|
+
description: "Claim COMP / reward token from the market Rewards contract.",
|
|
5121
|
+
prerequisites: ["keyGenId", "chainId", "comet", "ctm_compound_v3_fetch_account for claimable"],
|
|
5122
|
+
handler: { importPath: "protocols/evm/compound-v3", exportName: "buildEvmMultisignBodyCompoundV3ClaimRewards" },
|
|
5123
|
+
inputZod: mcpCompoundV3ClaimRewardsInputSchema
|
|
5124
|
+
}),
|
|
5125
|
+
defineProtocolMcpTool({
|
|
5126
|
+
name: "ctm_compound_v3_build_bulker_multisign",
|
|
5127
|
+
actionId: "compound-v3.bulker",
|
|
5128
|
+
protocolId: "compound-v3",
|
|
5129
|
+
chainCategory: "evm",
|
|
5130
|
+
description: "Optional combined Bulker.invoke (supply + borrow, claim + withdraw, native via Bulker). ETH wrap still works without this tool.",
|
|
5131
|
+
prerequisites: ["keyGenId", "chainId", "comet", "steps"],
|
|
5132
|
+
handler: { importPath: "protocols/evm/compound-v3", exportName: "buildEvmMultisignBodyCompoundV3Bulker" },
|
|
5133
|
+
inputZod: mcpCompoundV3BulkerInputSchema
|
|
4653
5134
|
})
|
|
4654
5135
|
];
|
|
4655
5136
|
|
|
@@ -5027,6 +5508,210 @@ var CORE_MCP_TOOL_DEFINITIONS = [
|
|
|
5027
5508
|
handler: { importPath: "protocols/evm/curve-dao", exportName: "buildEvmMultisignBodyCurveDaoBatch" },
|
|
5028
5509
|
inputZod: mcpCurveDaoBuildSwapMultisignInputSchema
|
|
5029
5510
|
}),
|
|
5511
|
+
defineMcpTool({
|
|
5512
|
+
name: "ctm_aerodrome_discover_pools",
|
|
5513
|
+
actionId: "aerodrome.discover-pools",
|
|
5514
|
+
protocolId: "aerodrome",
|
|
5515
|
+
chainCategory: "evm",
|
|
5516
|
+
description: "Find Aerodrome v2 + Slipstream pools for one token (optional tokenOut, default USDC) via factory getPool. Tickers OK (AAPLc, USDC, ETH). Use this instead of dumping listed tokens or LpSugar.all. For a price, skip this and call ctm_aerodrome_quote. rpcUrl is injected.",
|
|
5517
|
+
prerequisites: ["chainId 8453", "token (ticker or 0x)"],
|
|
5518
|
+
followUp: ["ctm_aerodrome_quote", "ctm_aerodrome_quote_add_liquidity"],
|
|
5519
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "aerodromeDiscoverPoolsSummary" },
|
|
5520
|
+
inputZod: mcpAerodromeDiscoverPoolsInputSchema,
|
|
5521
|
+
outputZod: mcpAerodromeDiscoverPoolsOutputSchema
|
|
5522
|
+
}),
|
|
5523
|
+
defineMcpTool({
|
|
5524
|
+
name: "ctm_aerodrome_fetch_pools",
|
|
5525
|
+
actionId: "aerodrome.fetch-pools",
|
|
5526
|
+
protocolId: "aerodrome",
|
|
5527
|
+
chainCategory: "evm",
|
|
5528
|
+
description: "Paginated LpSugar.all pool dump on Base. Heavy \u2014 can time out. Not required for swaps: ctm_aerodrome_quote discovers Slipstream 3 / v2 routes itself (including AAPLc/USDC). Use only when browsing LP inventory.",
|
|
5529
|
+
prerequisites: ["chainId 8453"],
|
|
5530
|
+
followUp: ["ctm_aerodrome_quote_add_liquidity", "ctm_aerodrome_fetch_positions"],
|
|
5531
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "aerodromeFetchPoolsSummary" },
|
|
5532
|
+
inputZod: mcpAerodromeFetchPoolsInputSchema,
|
|
5533
|
+
outputZod: mcpAerodromeFetchPoolsOutputSchema
|
|
5534
|
+
}),
|
|
5535
|
+
defineMcpTool({
|
|
5536
|
+
name: "ctm_aerodrome_fetch_positions",
|
|
5537
|
+
actionId: "aerodrome.fetch-positions",
|
|
5538
|
+
protocolId: "aerodrome",
|
|
5539
|
+
chainCategory: "evm",
|
|
5540
|
+
description: "KeyGen Aerodrome positions (same picker as the Multi-Sign Rewards tab). Each row has label, kind (vAMM/sAMM/CL), gauge, stakedInGauge, claimFees.pool, and claimEmissions (gauge + tokenId/cl, or null). Dust v2 rows omitted. Read-only.",
|
|
5541
|
+
prerequisites: ["chainId 8453", "account or keyGenId"],
|
|
5542
|
+
followUp: [
|
|
5543
|
+
"ctm_aerodrome_build_claim_fees_multisign",
|
|
5544
|
+
"ctm_aerodrome_build_claim_emissions_multisign",
|
|
5545
|
+
"ctm_aerodrome_build_cl_collect_fees_multisign"
|
|
5546
|
+
],
|
|
5547
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "aerodromeFetchPositionsSummary" },
|
|
5548
|
+
inputZod: mcpAerodromeFetchPositionsInputSchema,
|
|
5549
|
+
outputZod: mcpAerodromeFetchPositionsOutputSchema
|
|
5550
|
+
}),
|
|
5551
|
+
defineMcpTool({
|
|
5552
|
+
name: "ctm_aerodrome_quote",
|
|
5553
|
+
actionId: "aerodrome.quote",
|
|
5554
|
+
protocolId: "aerodrome",
|
|
5555
|
+
chainCategory: "evm",
|
|
5556
|
+
description: "Quote an Aerodrome swap on Base. tokenIn/tokenOut accept tickers (AAPLc, USDC, ETH, WETH, AERO) or 0x addresses. Coinbase B20 stocks are 8 decimals and route via Slipstream 3 (usually a USDC hop). Returns amountOutHuman and priceImpactPercent (0\u2013100 vs a tiny same-route probe). Call this directly \u2014 do not fetch_pools or ask the user for a stock address. Does NOT create a sign request.",
|
|
5557
|
+
prerequisites: ["chainId 8453", "tokenIn + tokenOut + amountHuman (tickers OK)"],
|
|
5558
|
+
followUp: ["ctm_aerodrome_build_swap_multisign"],
|
|
5559
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "aerodromeQuote" },
|
|
5560
|
+
inputZod: mcpAerodromeQuoteInputSchema,
|
|
5561
|
+
outputZod: mcpAerodromeQuoteOutputSchema
|
|
5562
|
+
}),
|
|
5563
|
+
defineMultisignSubmitMcpTool({
|
|
5564
|
+
name: "ctm_aerodrome_build_swap_multisign",
|
|
5565
|
+
actionId: "aerodrome.swap",
|
|
5566
|
+
protocolId: "aerodrome",
|
|
5567
|
+
chainCategory: "evm",
|
|
5568
|
+
description: "Create and submit mpc-auth multiSignRequest for an Aerodrome swap (optional ERC-20 approve + Router / Slipstream SwapRouter). Default deadline 30 minutes \u2014 ask the user to confirm that window and useCustomGas (via get_multi_sign_gas_options) before calling. Activate aerodrome:swap first.",
|
|
5569
|
+
prerequisites: [
|
|
5570
|
+
"ctm_aerodrome_quote",
|
|
5571
|
+
"get_multi_sign_gas_options + user confirms useCustomGas and 30-minute deadline",
|
|
5572
|
+
"keyGenId + chainId 8453 + purposeText + slippagePercent"
|
|
5573
|
+
],
|
|
5574
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "buildEvmMultisignBodyAerodromeSwapBatch" },
|
|
5575
|
+
inputZod: mcpAerodromeBuildSwapMultisignInputSchema
|
|
5576
|
+
}),
|
|
5577
|
+
defineMcpTool({
|
|
5578
|
+
name: "ctm_aerodrome_quote_add_liquidity",
|
|
5579
|
+
actionId: "aerodrome.quote-add-liquidity",
|
|
5580
|
+
protocolId: "aerodrome",
|
|
5581
|
+
chainCategory: "evm",
|
|
5582
|
+
description: "Quote an Aerodrome deposit on Base (same as the Liquidity tab). One-sided: pass amountAHuman or amountBHuman; the other side comes from the current vAMM/sAMM reserves or Slipstream slot0. Tickers OK (AAPLc, USDC, ETH). B20 stocks are 8 decimals. ETH/stock has no pool \u2014 seedable:false and hint says pair vs USDC. Do not first-deposit an empty vAMM. Read-only.",
|
|
5583
|
+
prerequisites: ["chainId 8453", "tokenA + tokenB + amountAHuman or amountBHuman (tickers OK)"],
|
|
5584
|
+
followUp: ["ctm_aerodrome_build_add_liquidity_multisign"],
|
|
5585
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "aerodromeQuoteAddLiquidity" },
|
|
5586
|
+
inputZod: mcpAerodromeQuoteAddLiquidityInputSchema,
|
|
5587
|
+
outputZod: mcpAerodromeQuoteAddLiquidityOutputSchema
|
|
5588
|
+
}),
|
|
5589
|
+
defineMcpTool({
|
|
5590
|
+
name: "ctm_aerodrome_quote_cl_deposit",
|
|
5591
|
+
actionId: "aerodrome.quote-cl-deposit",
|
|
5592
|
+
protocolId: "aerodrome",
|
|
5593
|
+
chainCategory: "evm",
|
|
5594
|
+
description: "Quote a Slipstream CL deposit (SugarHelper estimate when one side is omitted). token0/token1 accept tickers (AAPLc, USDC, ETH). Use when quote_add_liquidity returns kind:cl. Read-only.",
|
|
5595
|
+
prerequisites: ["chainId 8453", "ticks + sqrtPriceX96"],
|
|
5596
|
+
followUp: ["ctm_aerodrome_build_cl_mint_multisign"],
|
|
5597
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "aerodromeQuoteClDeposit" },
|
|
5598
|
+
inputZod: mcpAerodromeQuoteClDepositInputSchema,
|
|
5599
|
+
outputZod: mcpAerodromeQuoteClDepositOutputSchema
|
|
5600
|
+
}),
|
|
5601
|
+
defineMultisignSubmitMcpTool({
|
|
5602
|
+
name: "ctm_aerodrome_build_add_liquidity_multisign",
|
|
5603
|
+
actionId: "aerodrome.add-liquidity",
|
|
5604
|
+
protocolId: "aerodrome",
|
|
5605
|
+
chainCategory: "evm",
|
|
5606
|
+
description: "Submit multiSignRequest to add basic vAMM/sAMM liquidity (approve + addLiquidity / addLiquidityETH). One-sided amounts OK. Refuses empty/unseedable pairs (ETH/AAPLc) and Slipstream-only quotes (use CL mint). Activate aerodrome:lp first.",
|
|
5607
|
+
prerequisites: [
|
|
5608
|
+
"ctm_aerodrome_quote_add_liquidity",
|
|
5609
|
+
"get_multi_sign_gas_options + user confirms useCustomGas and 30-minute deadline",
|
|
5610
|
+
"keyGenId + purposeText + slippagePercent"
|
|
5611
|
+
],
|
|
5612
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "buildEvmMultisignBodyAerodromeAddLiquidityBatch" },
|
|
5613
|
+
inputZod: mcpAerodromeBuildAddLiquidityMultisignInputSchema
|
|
5614
|
+
}),
|
|
5615
|
+
defineMultisignSubmitMcpTool({
|
|
5616
|
+
name: "ctm_aerodrome_build_remove_liquidity_multisign",
|
|
5617
|
+
actionId: "aerodrome.remove-liquidity",
|
|
5618
|
+
protocolId: "aerodrome",
|
|
5619
|
+
chainCategory: "evm",
|
|
5620
|
+
description: "Submit multiSignRequest to remove basic-pool liquidity.",
|
|
5621
|
+
prerequisites: ["keyGenId", "lpToken + liquidityHuman"],
|
|
5622
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "buildEvmMultisignBodyAerodromeRemoveLiquidityBatch" },
|
|
5623
|
+
inputZod: mcpAerodromeBuildRemoveLiquidityMultisignInputSchema
|
|
5624
|
+
}),
|
|
5625
|
+
defineMultisignSubmitMcpTool({
|
|
5626
|
+
name: "ctm_aerodrome_build_cl_mint_multisign",
|
|
5627
|
+
actionId: "aerodrome.cl-mint",
|
|
5628
|
+
protocolId: "aerodrome",
|
|
5629
|
+
chainCategory: "evm",
|
|
5630
|
+
description: "Submit multiSignRequest to mint a Slipstream concentrated liquidity NFT.",
|
|
5631
|
+
prerequisites: ["ctm_aerodrome_quote_cl_deposit", "keyGenId"],
|
|
5632
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "buildEvmMultisignBodyAerodromeClMintBatch" },
|
|
5633
|
+
inputZod: mcpAerodromeBuildClMintMultisignInputSchema
|
|
5634
|
+
}),
|
|
5635
|
+
defineMultisignSubmitMcpTool({
|
|
5636
|
+
name: "ctm_aerodrome_build_cl_increase_multisign",
|
|
5637
|
+
actionId: "aerodrome.cl-increase",
|
|
5638
|
+
protocolId: "aerodrome",
|
|
5639
|
+
chainCategory: "evm",
|
|
5640
|
+
description: "Submit multiSignRequest to increase Slipstream liquidity.",
|
|
5641
|
+
prerequisites: ["keyGenId", "tokenId"],
|
|
5642
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "buildEvmMultisignBodyAerodromeClIncreaseBatch" },
|
|
5643
|
+
inputZod: mcpAerodromeBuildClIncreaseMultisignInputSchema
|
|
5644
|
+
}),
|
|
5645
|
+
defineMultisignSubmitMcpTool({
|
|
5646
|
+
name: "ctm_aerodrome_build_cl_decrease_multisign",
|
|
5647
|
+
actionId: "aerodrome.cl-decrease",
|
|
5648
|
+
protocolId: "aerodrome",
|
|
5649
|
+
chainCategory: "evm",
|
|
5650
|
+
description: "Submit multiSignRequest to decrease Slipstream liquidity.",
|
|
5651
|
+
prerequisites: ["keyGenId", "tokenId + liquidity"],
|
|
5652
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "buildEvmMultisignBodyAerodromeClDecreaseBatch" },
|
|
5653
|
+
inputZod: mcpAerodromeBuildClDecreaseMultisignInputSchema
|
|
5654
|
+
}),
|
|
5655
|
+
defineMultisignSubmitMcpTool({
|
|
5656
|
+
name: "ctm_aerodrome_build_cl_burn_multisign",
|
|
5657
|
+
actionId: "aerodrome.cl-burn",
|
|
5658
|
+
protocolId: "aerodrome",
|
|
5659
|
+
chainCategory: "evm",
|
|
5660
|
+
description: "Submit multiSignRequest to burn an empty Slipstream position NFT.",
|
|
5661
|
+
prerequisites: ["keyGenId", "tokenId (liquidity withdrawn, fees collected)"],
|
|
5662
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "buildEvmMultisignBodyAerodromeClBurnBatch" },
|
|
5663
|
+
inputZod: mcpAerodromeBuildClBurnMultisignInputSchema
|
|
5664
|
+
}),
|
|
5665
|
+
defineMultisignSubmitMcpTool({
|
|
5666
|
+
name: "ctm_aerodrome_build_gauge_stake_multisign",
|
|
5667
|
+
actionId: "aerodrome.gauge-stake",
|
|
5668
|
+
protocolId: "aerodrome",
|
|
5669
|
+
chainCategory: "evm",
|
|
5670
|
+
description: "Submit multiSignRequest to stake basic LP tokens or a Slipstream NFT in a gauge.",
|
|
5671
|
+
prerequisites: ["keyGenId", "gauge + lpToken or tokenId"],
|
|
5672
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "buildEvmMultisignBodyAerodromeGaugeStakeBatch" },
|
|
5673
|
+
inputZod: mcpAerodromeBuildGaugeStakeMultisignInputSchema
|
|
5674
|
+
}),
|
|
5675
|
+
defineMultisignSubmitMcpTool({
|
|
5676
|
+
name: "ctm_aerodrome_build_gauge_unstake_multisign",
|
|
5677
|
+
actionId: "aerodrome.gauge-unstake",
|
|
5678
|
+
protocolId: "aerodrome",
|
|
5679
|
+
chainCategory: "evm",
|
|
5680
|
+
description: "Submit multiSignRequest to unstake from an Aerodrome gauge.",
|
|
5681
|
+
prerequisites: ["keyGenId", "gauge"],
|
|
5682
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "buildEvmMultisignBodyAerodromeGaugeUnstakeBatch" },
|
|
5683
|
+
inputZod: mcpAerodromeBuildGaugeUnstakeMultisignInputSchema
|
|
5684
|
+
}),
|
|
5685
|
+
defineMultisignSubmitMcpTool({
|
|
5686
|
+
name: "ctm_aerodrome_build_claim_fees_multisign",
|
|
5687
|
+
actionId: "aerodrome.claim-fees",
|
|
5688
|
+
protocolId: "aerodrome",
|
|
5689
|
+
chainCategory: "evm",
|
|
5690
|
+
description: "Claim unstaked fees from the pool (dialog: \u201CFees from the pool\u201D). Pass claimFees.pool from ctm_aerodrome_fetch_positions \u2014 not the gauge. Activate aerodrome:rewards first.",
|
|
5691
|
+
prerequisites: ["ctm_aerodrome_fetch_positions", "keyGenId + purposeText + pool=claimFees.pool"],
|
|
5692
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "buildEvmMultisignBodyAerodromeClaimFeesBatch" },
|
|
5693
|
+
inputZod: mcpAerodromeBuildClaimFeesMultisignInputSchema
|
|
5694
|
+
}),
|
|
5695
|
+
defineMultisignSubmitMcpTool({
|
|
5696
|
+
name: "ctm_aerodrome_build_cl_collect_fees_multisign",
|
|
5697
|
+
actionId: "aerodrome.cl-collect-fees",
|
|
5698
|
+
protocolId: "aerodrome",
|
|
5699
|
+
chainCategory: "evm",
|
|
5700
|
+
description: "Collect Slipstream NFT fees via NFPM.collect. Pass the position id from fetch_positions (kind:cl). Activate aerodrome:rewards first.",
|
|
5701
|
+
prerequisites: ["ctm_aerodrome_fetch_positions", "keyGenId + tokenId"],
|
|
5702
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "buildEvmMultisignBodyAerodromeClCollectBatch" },
|
|
5703
|
+
inputZod: mcpAerodromeBuildClCollectFeesMultisignInputSchema
|
|
5704
|
+
}),
|
|
5705
|
+
defineMultisignSubmitMcpTool({
|
|
5706
|
+
name: "ctm_aerodrome_build_claim_emissions_multisign",
|
|
5707
|
+
actionId: "aerodrome.claim-emissions",
|
|
5708
|
+
protocolId: "aerodrome",
|
|
5709
|
+
chainCategory: "evm",
|
|
5710
|
+
description: "Claim gauge emissions in AERO (dialog: \u201CEmissions from the gauge in AERO\u201D). Pass claimEmissions from ctm_aerodrome_fetch_positions (gauge; CL staked also needs tokenId + cl:true). Skip when claimEmissions is null. Activate aerodrome:rewards first.",
|
|
5711
|
+
prerequisites: ["ctm_aerodrome_fetch_positions", "keyGenId + purposeText + gauge=claimEmissions.gauge"],
|
|
5712
|
+
handler: { importPath: "protocols/evm/aerodrome", exportName: "buildEvmMultisignBodyAerodromeClaimEmissionsBatch" },
|
|
5713
|
+
inputZod: mcpAerodromeBuildClaimEmissionsMultisignInputSchema
|
|
5714
|
+
}),
|
|
5030
5715
|
defineMcpTool({
|
|
5031
5716
|
name: "ctm_gmx_fetch_markets",
|
|
5032
5717
|
actionId: "gmx.fetch-markets",
|
|
@@ -5445,6 +6130,7 @@ var CORE_MCP_TOOL_DEFINITIONS = [
|
|
|
5445
6130
|
followUp: [
|
|
5446
6131
|
"ctm_morpho_fetch_midnight_quote",
|
|
5447
6132
|
"ctm_morpho_build_midnight_lend_multisign",
|
|
6133
|
+
"ctm_morpho_build_midnight_lend_offer_multisign",
|
|
5448
6134
|
"ctm_morpho_build_midnight_borrow_multisign"
|
|
5449
6135
|
],
|
|
5450
6136
|
handler: { importPath: "protocols/evm/morpho", exportName: "morphoFetchMidnightBooksSummary" },
|
|
@@ -5458,7 +6144,11 @@ var CORE_MCP_TOOL_DEFINITIONS = [
|
|
|
5458
6144
|
chainCategory: "evm",
|
|
5459
6145
|
description: "Quote a Morpho Midnight book fill. side asks = lend, bids = borrow. assets is raw loan-token units.",
|
|
5460
6146
|
prerequisites: ["marketId from ctm_morpho_fetch_midnight_books", "assets raw amount"],
|
|
5461
|
-
followUp: [
|
|
6147
|
+
followUp: [
|
|
6148
|
+
"ctm_morpho_build_midnight_lend_multisign",
|
|
6149
|
+
"ctm_morpho_build_midnight_lend_offer_multisign",
|
|
6150
|
+
"ctm_morpho_build_midnight_borrow_multisign"
|
|
6151
|
+
],
|
|
5462
6152
|
handler: { importPath: "protocols/evm/morpho", exportName: "morphoFetchMidnightQuoteSummary" },
|
|
5463
6153
|
inputZod: mcpMorphoFetchMidnightQuoteInputSchema,
|
|
5464
6154
|
outputZod: mcpMorphoFetchMidnightQuoteOutputSchema
|
|
@@ -5475,6 +6165,18 @@ var CORE_MCP_TOOL_DEFINITIONS = [
|
|
|
5475
6165
|
inputZod: mcpMorphoFetchMidnightPositionsInputSchema,
|
|
5476
6166
|
outputZod: mcpMorphoFetchMidnightPositionsOutputSchema
|
|
5477
6167
|
}),
|
|
6168
|
+
defineMcpTool({
|
|
6169
|
+
name: "ctm_morpho_fetch_midnight_offers",
|
|
6170
|
+
actionId: "morpho.fetch-midnight-offers",
|
|
6171
|
+
protocolId: "morpho",
|
|
6172
|
+
chainCategory: "evm",
|
|
6173
|
+
description: "Open Morpho Midnight maker lend offers for a user. Use group/callback/callbackData to cancel and withdraw unused Blue park.",
|
|
6174
|
+
prerequisites: ["user address"],
|
|
6175
|
+
followUp: ["ctm_morpho_build_midnight_cancel_lend_offer_multisign"],
|
|
6176
|
+
handler: { importPath: "protocols/evm/morpho", exportName: "morphoFetchMidnightMakerOffersSummary" },
|
|
6177
|
+
inputZod: mcpMorphoFetchMidnightOffersInputSchema,
|
|
6178
|
+
outputZod: mcpMorphoFetchMidnightOffersOutputSchema
|
|
6179
|
+
}),
|
|
5478
6180
|
defineMcpTool({
|
|
5479
6181
|
name: "ctm_euler_v2_fetch_lend_vaults",
|
|
5480
6182
|
actionId: "euler-v2.fetch-lend-vaults",
|
|
@@ -5937,6 +6639,47 @@ var CORE_MCP_TOOL_DEFINITIONS = [
|
|
|
5937
6639
|
handler: { importPath: "protocols/evm/continuum-dao", exportName: "continuumDaoForumSections" },
|
|
5938
6640
|
inputZod: mcpContinuumDaoForumSectionsInputSchema,
|
|
5939
6641
|
outputZod: mcpContinuumDaoForumSectionsOutputSchema
|
|
6642
|
+
}),
|
|
6643
|
+
defineMcpTool({
|
|
6644
|
+
name: "ctm_compound_v3_fetch_markets",
|
|
6645
|
+
actionId: "compound-v3.fetch-markets",
|
|
6646
|
+
protocolId: "compound-v3",
|
|
6647
|
+
chainCategory: "evm",
|
|
6648
|
+
description: "List Compound III Comet markets on a chain. Each market has one borrowable base and a collateral list \u2014 use this (not web search) to answer what you can borrow against an asset or which collaterals a Comet accepts. Copy comet for fetch_market / fetch_account / build_*_multisign.",
|
|
6649
|
+
prerequisites: ["chainId", "get_defi_protocol_supported_chains"],
|
|
6650
|
+
followUp: ["ctm_compound_v3_fetch_market", "ctm_compound_v3_fetch_account"],
|
|
6651
|
+
handler: { importPath: "protocols/evm/compound-v3", exportName: "compoundV3FetchMarketsSummary" },
|
|
6652
|
+
inputZod: mcpCompoundV3FetchMarketsInputSchema,
|
|
6653
|
+
outputZod: mcpCompoundV3FetchMarketsOutputSchema
|
|
6654
|
+
}),
|
|
6655
|
+
defineMcpTool({
|
|
6656
|
+
name: "ctm_compound_v3_fetch_market",
|
|
6657
|
+
actionId: "compound-v3.fetch-market",
|
|
6658
|
+
protocolId: "compound-v3",
|
|
6659
|
+
chainCategory: "evm",
|
|
6660
|
+
description: "One Comet: collateral list (what backs a borrow), collateral factors, prices, utilization, supply/borrow APR. Base is the only borrowable asset. Always uses the Comet proxy + CometInterface.",
|
|
6661
|
+
prerequisites: ["comet from ctm_compound_v3_fetch_markets", "rpcUrl from chain registry"],
|
|
6662
|
+
followUp: ["ctm_compound_v3_fetch_account", "ctm_compound_v3_build_supply_multisign"],
|
|
6663
|
+
handler: { importPath: "protocols/evm/compound-v3", exportName: "compoundV3FetchMarketSummary" },
|
|
6664
|
+
inputZod: mcpCompoundV3FetchMarketInputSchema,
|
|
6665
|
+
outputZod: mcpCompoundV3FetchMarketOutputSchema
|
|
6666
|
+
}),
|
|
6667
|
+
defineMcpTool({
|
|
6668
|
+
name: "ctm_compound_v3_fetch_account",
|
|
6669
|
+
actionId: "compound-v3.fetch-account",
|
|
6670
|
+
protocolId: "compound-v3",
|
|
6671
|
+
chainCategory: "evm",
|
|
6672
|
+
description: "User position on a Comet: base supplied, base borrowed, each collateral, isBorrowCollateralized, isLiquidatable, claimable rewards.",
|
|
6673
|
+
prerequisites: ["comet from ctm_compound_v3_fetch_markets", "account", "rpcUrl from chain registry"],
|
|
6674
|
+
followUp: [
|
|
6675
|
+
"ctm_compound_v3_build_supply_multisign",
|
|
6676
|
+
"ctm_compound_v3_build_withdraw_multisign",
|
|
6677
|
+
"ctm_compound_v3_build_repay_multisign",
|
|
6678
|
+
"ctm_compound_v3_build_claim_rewards_multisign"
|
|
6679
|
+
],
|
|
6680
|
+
handler: { importPath: "protocols/evm/compound-v3", exportName: "compoundV3FetchAccountSummary" },
|
|
6681
|
+
inputZod: mcpCompoundV3FetchAccountInputSchema,
|
|
6682
|
+
outputZod: mcpCompoundV3FetchAccountOutputSchema
|
|
5940
6683
|
})
|
|
5941
6684
|
];
|
|
5942
6685
|
var MCP_TOOL_DEFINITIONS = [
|
|
@@ -6330,37 +7073,273 @@ var aaveV4ProtocolModule = {
|
|
|
6330
7073
|
]
|
|
6331
7074
|
};
|
|
6332
7075
|
registerProtocolModule(aaveV4ProtocolModule);
|
|
7076
|
+
init_defiProxy();
|
|
7077
|
+
var EULER_EVAULT_CAP_UNLIMITED_WEI = (1n << 256n) - 1n;
|
|
7078
|
+
var UINT256_MAX = EULER_EVAULT_CAP_UNLIMITED_WEI;
|
|
7079
|
+
viem.parseAbi([
|
|
7080
|
+
"function caps() view returns (uint16 supplyCap, uint16 borrowCap)",
|
|
7081
|
+
"function cash() view returns (uint256)",
|
|
7082
|
+
"function totalBorrows() view returns (uint256)",
|
|
7083
|
+
"function totalAssets() view returns (uint256)"
|
|
7084
|
+
]);
|
|
7085
|
+
function resolveEulerAmountCapToWei(rawCap16) {
|
|
7086
|
+
const amountCap = BigInt(rawCap16) & 0xffffn;
|
|
7087
|
+
if (amountCap === 0n) return UINT256_MAX;
|
|
7088
|
+
const exp = amountCap & 63n;
|
|
7089
|
+
const mantissa = amountCap >> 6n;
|
|
7090
|
+
return 10n ** exp * mantissa / 100n;
|
|
7091
|
+
}
|
|
7092
|
+
function eulerSubgraphVaultCapToUnderlyingWei(raw) {
|
|
7093
|
+
try {
|
|
7094
|
+
const v = BigInt((raw ?? "").trim() || "0");
|
|
7095
|
+
if (v >= UINT256_MAX - 3n) return v;
|
|
7096
|
+
if (v <= 0xffffn) return resolveEulerAmountCapToWei(v);
|
|
7097
|
+
return v;
|
|
7098
|
+
} catch {
|
|
7099
|
+
return 0n;
|
|
7100
|
+
}
|
|
7101
|
+
}
|
|
6333
7102
|
|
|
6334
|
-
// src/protocols/evm/euler-v2/
|
|
6335
|
-
var
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
7103
|
+
// src/protocols/evm/euler-v2/eulerV2Subgraph.ts
|
|
7104
|
+
var EULER_V2_GOLDSKY_SUBGRAPH_URL_BY_CHAIN_ID = {
|
|
7105
|
+
1: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-mainnet/latest/gn",
|
|
7106
|
+
8453: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-base/latest/gn",
|
|
7107
|
+
1923: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-swell/latest/gn",
|
|
7108
|
+
146: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-sonic/latest/gn",
|
|
7109
|
+
60808: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-bob/latest/gn",
|
|
7110
|
+
80094: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-berachain/latest/gn",
|
|
7111
|
+
43114: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-avalanche/latest/gn",
|
|
7112
|
+
42161: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-arbitrum/latest/gn",
|
|
7113
|
+
130: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-unichain/latest/gn",
|
|
7114
|
+
57073: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-ink/latest/gn",
|
|
7115
|
+
56: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-bsc/latest/gn",
|
|
7116
|
+
999: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-hyperevm/latest/gn",
|
|
7117
|
+
10: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-optimism/latest/gn",
|
|
7118
|
+
100: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-gnosis/latest/gn",
|
|
7119
|
+
480: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-worldchain/latest/gn",
|
|
7120
|
+
239: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-tac/latest/gn",
|
|
7121
|
+
9745: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-plasma/latest/gn",
|
|
7122
|
+
5e3: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-mantle/latest/gn"
|
|
6353
7123
|
};
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
7124
|
+
var WRAPPED_NATIVE_FALLBACK = {
|
|
7125
|
+
1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
7126
|
+
10: "0x4200000000000000000000000000000000000006",
|
|
7127
|
+
56: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
|
|
7128
|
+
100: "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d",
|
|
7129
|
+
130: "0x4200000000000000000000000000000000000006",
|
|
7130
|
+
146: "0x03980325872071166574bcd94670450917897468",
|
|
7131
|
+
239: "0xB63B9f0eb4A6E6f191529D71d4D88cc8900Df2C9",
|
|
7132
|
+
// TAC: WTAC (https://docs.tac.build/ecosystem/token-list)
|
|
7133
|
+
480: "0x4200000000000000000000000000000000000006",
|
|
7134
|
+
999: "0x5555555555555555555555555555555555555555",
|
|
7135
|
+
// HyperEVM: WHYPE (Hyperliquid docs)
|
|
7136
|
+
1923: "0x4200000000000000000000000000000000000006",
|
|
7137
|
+
42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
7138
|
+
43114: "0xB31f66AA3C1e785363F0875A1B74D27b85FE0459",
|
|
7139
|
+
5e3: "0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8",
|
|
7140
|
+
// Mantle: WMNT
|
|
7141
|
+
57073: "0x4200000000000000000000000000000000000006",
|
|
7142
|
+
60808: "0x4200000000000000000000000000000000000006",
|
|
7143
|
+
80094: "0x6969696969696969696969696969696969696969",
|
|
7144
|
+
// Berachain: WBERA (https://docs.berachain.com)
|
|
7145
|
+
8453: "0x4200000000000000000000000000000000000006",
|
|
7146
|
+
9745: "0x6100E367285b01F48D07953803A2d8dCA5D19873"
|
|
7147
|
+
// Plasma: WXPL
|
|
7148
|
+
};
|
|
7149
|
+
for (const id of Object.keys(EULER_V2_GOLDSKY_SUBGRAPH_URL_BY_CHAIN_ID).map(Number)) {
|
|
7150
|
+
if (WRAPPED_NATIVE_FALLBACK[id] == null) {
|
|
7151
|
+
throw new Error(`eulerV2Subgraph: add WRAPPED_NATIVE_FALLBACK for Euler Goldsky chain ${id}`);
|
|
7152
|
+
}
|
|
6360
7153
|
}
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
7154
|
+
function eulerV2GoldskyUrlForChain(chainId) {
|
|
7155
|
+
return EULER_V2_GOLDSKY_SUBGRAPH_URL_BY_CHAIN_ID[chainId];
|
|
7156
|
+
}
|
|
7157
|
+
async function resolveEulerWrappedNativeToken(chainId) {
|
|
7158
|
+
try {
|
|
7159
|
+
const fromAave = await fetchAaveV4NativeWrappedToken(chainId);
|
|
7160
|
+
if (fromAave) return fromAave;
|
|
7161
|
+
} catch {
|
|
7162
|
+
}
|
|
7163
|
+
const fb = WRAPPED_NATIVE_FALLBACK[chainId];
|
|
7164
|
+
if (fb && viem.isAddress(fb)) return viem.getAddress(fb);
|
|
7165
|
+
return null;
|
|
7166
|
+
}
|
|
7167
|
+
async function eulerSubgraphGql(endpoint, query, variables, chainId) {
|
|
7168
|
+
const body = { query, variables: variables ?? {} };
|
|
7169
|
+
const proxy = getEulerGraphqlProxyUrl();
|
|
7170
|
+
const j = await postJsonViaOptionalProxy({
|
|
7171
|
+
directUrl: endpoint,
|
|
7172
|
+
body,
|
|
7173
|
+
proxyUrl: proxy,
|
|
7174
|
+
proxyEnvelope: chainId != null ? { chainId, query, variables: variables ?? {} } : body
|
|
7175
|
+
});
|
|
7176
|
+
if (j.errors?.length) {
|
|
7177
|
+
throw new Error(j.errors.map((e) => e.message ?? "Unknown").join("; "));
|
|
7178
|
+
}
|
|
7179
|
+
if (j.data == null) throw new Error("Euler subgraph: empty response");
|
|
7180
|
+
return j.data;
|
|
7181
|
+
}
|
|
7182
|
+
async function eulerV2QueryGraphQl(chainId, query, variables) {
|
|
7183
|
+
const endpoint = eulerV2GoldskyUrlForChain(chainId);
|
|
7184
|
+
if (!endpoint) {
|
|
7185
|
+
throw new Error(`Euler v2 subgraph is not configured for chain ${chainId}`);
|
|
7186
|
+
}
|
|
7187
|
+
return eulerSubgraphGql(endpoint, query, variables, chainId);
|
|
7188
|
+
}
|
|
7189
|
+
function normAssetAddr(raw) {
|
|
7190
|
+
const s = (raw ?? "").trim();
|
|
7191
|
+
if (!s || !viem.isAddress(s)) return null;
|
|
7192
|
+
return viem.getAddress(s).toLowerCase();
|
|
7193
|
+
}
|
|
7194
|
+
function vaultShowsBorrowTab(borrowCap, totalBorrows) {
|
|
7195
|
+
let borrows = 0n;
|
|
7196
|
+
try {
|
|
7197
|
+
borrows = BigInt((totalBorrows ?? "").trim() || "0");
|
|
7198
|
+
} catch {
|
|
7199
|
+
borrows = 0n;
|
|
7200
|
+
}
|
|
7201
|
+
if (borrows > 0n) return true;
|
|
7202
|
+
const w = eulerSubgraphVaultCapToUnderlyingWei(borrowCap);
|
|
7203
|
+
if (w >= EULER_EVAULT_CAP_UNLIMITED_WEI - 3n) return true;
|
|
7204
|
+
return w > 0n;
|
|
7205
|
+
}
|
|
7206
|
+
var VAULT_PAGE = `
|
|
7207
|
+
query V($first: Int!, $skip: Int!) {
|
|
7208
|
+
eulerVaults(first: $first, skip: $skip) {
|
|
7209
|
+
asset
|
|
7210
|
+
borrowCap
|
|
7211
|
+
state { totalBorrows }
|
|
7212
|
+
}
|
|
7213
|
+
}
|
|
7214
|
+
`;
|
|
7215
|
+
var EARN_PAGE = `
|
|
7216
|
+
query E($first: Int!, $skip: Int!) {
|
|
7217
|
+
eulerEarnVaults(first: $first, skip: $skip) {
|
|
7218
|
+
asset
|
|
7219
|
+
}
|
|
7220
|
+
}
|
|
7221
|
+
`;
|
|
7222
|
+
async function paginateEulerVaultRows(chainId) {
|
|
7223
|
+
const out = [];
|
|
7224
|
+
let skip = 0;
|
|
7225
|
+
const first = 1e3;
|
|
7226
|
+
while (true) {
|
|
7227
|
+
const d = await eulerV2QueryGraphQl(chainId, VAULT_PAGE, { first, skip });
|
|
7228
|
+
const rows = d.eulerVaults ?? [];
|
|
7229
|
+
if (!rows.length) break;
|
|
7230
|
+
for (const r of rows) {
|
|
7231
|
+
const tb = (r.state?.totalBorrows ?? "0").toString();
|
|
7232
|
+
out.push({ asset: r.asset ?? null, borrowCap: r.borrowCap, totalBorrows: tb });
|
|
7233
|
+
}
|
|
7234
|
+
if (rows.length < first) break;
|
|
7235
|
+
skip += first;
|
|
7236
|
+
}
|
|
7237
|
+
return out;
|
|
7238
|
+
}
|
|
7239
|
+
async function paginateEulerEarnAssets(chainId) {
|
|
7240
|
+
const assets = [];
|
|
7241
|
+
let skip = 0;
|
|
7242
|
+
const first = 1e3;
|
|
7243
|
+
while (true) {
|
|
7244
|
+
const d = await eulerV2QueryGraphQl(
|
|
7245
|
+
chainId,
|
|
7246
|
+
EARN_PAGE,
|
|
7247
|
+
{
|
|
7248
|
+
first,
|
|
7249
|
+
skip
|
|
7250
|
+
}
|
|
7251
|
+
);
|
|
7252
|
+
const rows = d.eulerEarnVaults ?? [];
|
|
7253
|
+
if (!rows.length) break;
|
|
7254
|
+
for (const r of rows) {
|
|
7255
|
+
const a = normAssetAddr(r.asset ?? void 0);
|
|
7256
|
+
if (a) assets.push(a);
|
|
7257
|
+
}
|
|
7258
|
+
if (rows.length < first) break;
|
|
7259
|
+
skip += first;
|
|
7260
|
+
}
|
|
7261
|
+
return assets;
|
|
7262
|
+
}
|
|
7263
|
+
var eulerV2ChainAssetCache = /* @__PURE__ */ new Map();
|
|
7264
|
+
async function fetchEulerV2ChainAssetCache(chainId) {
|
|
7265
|
+
const endpoint = eulerV2GoldskyUrlForChain(chainId);
|
|
7266
|
+
if (!endpoint) {
|
|
7267
|
+
return { nativeWrapped: null, modesByUnderlying: /* @__PURE__ */ new Map() };
|
|
7268
|
+
}
|
|
7269
|
+
const [nativeWrapped, vaultRows, earnAssets] = await Promise.all([
|
|
7270
|
+
resolveEulerWrappedNativeToken(chainId),
|
|
7271
|
+
paginateEulerVaultRows(chainId),
|
|
7272
|
+
paginateEulerEarnAssets(chainId)
|
|
7273
|
+
]);
|
|
7274
|
+
const modes = /* @__PURE__ */ new Map();
|
|
7275
|
+
const bump = (addr, patch) => {
|
|
7276
|
+
const cur = modes.get(addr) ?? { lend: false, borrow: false, earn: false };
|
|
7277
|
+
modes.set(addr, {
|
|
7278
|
+
lend: cur.lend || !!patch.lend,
|
|
7279
|
+
borrow: cur.borrow || !!patch.borrow,
|
|
7280
|
+
earn: cur.earn || !!patch.earn
|
|
7281
|
+
});
|
|
7282
|
+
};
|
|
7283
|
+
for (const e of earnAssets) bump(e, { earn: true });
|
|
7284
|
+
for (const row of vaultRows) {
|
|
7285
|
+
const a = normAssetAddr(row.asset);
|
|
7286
|
+
if (!a) continue;
|
|
7287
|
+
bump(a, {
|
|
7288
|
+
lend: true,
|
|
7289
|
+
borrow: vaultShowsBorrowTab(row.borrowCap, row.totalBorrows)
|
|
7290
|
+
});
|
|
7291
|
+
}
|
|
7292
|
+
return { nativeWrapped, modesByUnderlying: modes };
|
|
7293
|
+
}
|
|
7294
|
+
function ensureEulerV2ChainAssetCache(chainId) {
|
|
7295
|
+
const hit = eulerV2ChainAssetCache.get(chainId);
|
|
7296
|
+
if (hit) return hit;
|
|
7297
|
+
const p = fetchEulerV2ChainAssetCache(chainId).catch((e) => {
|
|
7298
|
+
eulerV2ChainAssetCache.delete(chainId);
|
|
7299
|
+
throw e;
|
|
7300
|
+
});
|
|
7301
|
+
eulerV2ChainAssetCache.set(chainId, p);
|
|
7302
|
+
return p;
|
|
7303
|
+
}
|
|
7304
|
+
|
|
7305
|
+
// src/protocols/evm/euler-v2/loadEulerV2SupportedChainIds.ts
|
|
7306
|
+
var cached = null;
|
|
7307
|
+
function loadEulerV2SupportedChainIds() {
|
|
7308
|
+
if (cached) return Promise.resolve(cached);
|
|
7309
|
+
cached = new Set(Object.keys(EULER_V2_GOLDSKY_SUBGRAPH_URL_BY_CHAIN_ID).map((k) => Number(k)));
|
|
7310
|
+
return Promise.resolve(cached);
|
|
7311
|
+
}
|
|
7312
|
+
|
|
7313
|
+
// src/protocols/evm/euler-v2/index.ts
|
|
7314
|
+
var EULER_V2_PROTOCOL_ID = "euler-v2";
|
|
7315
|
+
var eulerV2ProtocolModule = {
|
|
7316
|
+
id: EULER_V2_PROTOCOL_ID,
|
|
7317
|
+
chainCategory: "evm",
|
|
7318
|
+
isChainSupported(ctx) {
|
|
7319
|
+
return ctx.chainCategory === "evm";
|
|
7320
|
+
},
|
|
7321
|
+
isTokenSupported(token) {
|
|
7322
|
+
return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
|
|
7323
|
+
},
|
|
7324
|
+
actions: [
|
|
7325
|
+
{ id: "euler-v2.isolated-lend", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Deposit into Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
7326
|
+
{ id: "euler-v2.isolated-borrow", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Borrow from Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
7327
|
+
{ id: "euler-v2.vault-withdraw", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw from Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
7328
|
+
{ id: "euler-v2.borrow-repay", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Repay Euler borrow", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
7329
|
+
{ id: "euler-v2.collateral-deposit", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Deposit borrow collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
7330
|
+
{ id: "euler-v2.collateral-withdraw", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw borrow collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
|
|
7331
|
+
]
|
|
7332
|
+
};
|
|
7333
|
+
registerProtocolModule(eulerV2ProtocolModule);
|
|
7334
|
+
|
|
7335
|
+
// src/protocols/evm/gmx/support.ts
|
|
7336
|
+
var GMX_SUPPORTED_CHAIN_IDS = [42161, 43114];
|
|
7337
|
+
function isGmxChainSupported(chainId) {
|
|
7338
|
+
return GMX_SUPPORTED_CHAIN_IDS.includes(chainId);
|
|
7339
|
+
}
|
|
7340
|
+
var require2 = module$1.createRequire(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('catalog.cjs', document.baseURI).href))));
|
|
7341
|
+
var { GmxApiSdk } = require2("@gmx-io/sdk/v2");
|
|
7342
|
+
var { getApiUrl, getApiFallbackUrls } = require2("@gmx-io/sdk/configs/api");
|
|
6364
7343
|
var GMX_HTTP_TIMEOUT_MS = 3e4;
|
|
6365
7344
|
function gmxResolvedApiBaseUrls(chainId) {
|
|
6366
7345
|
const primary = getApiUrl(chainId);
|
|
@@ -7085,6 +8064,8 @@ var morphoProtocolModule = {
|
|
|
7085
8064
|
{ id: "morpho.fetch-midnight-quote", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Quote Morpho Midnight lend/borrow fill", commonParams: [], params: {} },
|
|
7086
8065
|
{ id: "morpho.fetch-midnight-positions", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "List Morpho Midnight user positions", commonParams: [], params: {} },
|
|
7087
8066
|
{ id: "morpho.midnight-lend", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Morpho Midnight fixed-rate lend (take asks)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
8067
|
+
{ id: "morpho.midnight-lend-offer", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Morpho Midnight lend limit offer parked in Blue until filled", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
8068
|
+
{ id: "morpho.midnight-cancel-lend-offer", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Cancel a Morpho Midnight lend offer and withdraw unused Blue park", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
7088
8069
|
{ id: "morpho.midnight-borrow", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Morpho Midnight fixed-rate borrow (supply collateral + take bids)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
7089
8070
|
{ id: "morpho.midnight-repay", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Morpho Midnight repay debt and withdraw collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
|
|
7090
8071
|
]
|
|
@@ -7360,6 +8341,141 @@ var veniceProtocolModule = {
|
|
|
7360
8341
|
]
|
|
7361
8342
|
};
|
|
7362
8343
|
registerProtocolModule(veniceProtocolModule);
|
|
8344
|
+
var AERODROME_PROTOCOL_ID = "aerodrome";
|
|
8345
|
+
var AERODROME_CHAIN_ID = 8453;
|
|
8346
|
+
var AERODROME_WETH_BASE = "0x4200000000000000000000000000000000000006";
|
|
8347
|
+
var AERODROME_USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
8348
|
+
function isAerodromeChainSupported(chainId) {
|
|
8349
|
+
const n = typeof chainId === "number" ? chainId : Number.parseInt(String(chainId), 10);
|
|
8350
|
+
return n === AERODROME_CHAIN_ID;
|
|
8351
|
+
}
|
|
8352
|
+
var AERODROME_BASE_ADDRESSES_FALLBACK = {
|
|
8353
|
+
aero: "0x940181a94A35A4569E4529A3CDfB74e38FD98631"};
|
|
8354
|
+
var AERODROME_COINBASE_STOCK_TOKENS = [
|
|
8355
|
+
{ symbol: "AAPLc", name: "Apple Inc.", address: "0xb200000000000000000000C2e324d24d7eEcd1fb" },
|
|
8356
|
+
{ symbol: "NVDAc", name: "NVIDIA Corporation", address: "0xb20000000000000000000078ee7ce2fE4908108C" },
|
|
8357
|
+
{ symbol: "METAc", name: "Meta Platforms Inc.", address: "0xb2000000000000000000008bC8786B856E61707C" },
|
|
8358
|
+
{ symbol: "GOOGLc", name: "Alphabet Inc.", address: "0xb2000000000000000000002D0BA3164cc74f58B7" },
|
|
8359
|
+
{ symbol: "AMZNc", name: "Amazon.com Inc.", address: "0xb200000000000000000000d9192b6B456483C2E8" },
|
|
8360
|
+
{ symbol: "TSLAc", name: "Tesla Inc.", address: "0xb2000000000000000000001e800a7f5189430cD0" },
|
|
8361
|
+
{ symbol: "MSFTc", name: "Microsoft Corporation", address: "0xB200000000000000000000Ab99cFa739E253872B" },
|
|
8362
|
+
{ symbol: "COINc", name: "Coinbase Global Inc.", address: "0xb200000000000000000000c85a31389D71F3ecfb" },
|
|
8363
|
+
{ symbol: "MSTRc", name: "Strategy Inc.", address: "0xb2000000000000000000004884b426556b92883d" },
|
|
8364
|
+
{ symbol: "CRCLc", name: "Circle Internet Group Inc.", address: "0xB20000000000000000000019f6E7C675b73C2e4D" },
|
|
8365
|
+
{ symbol: "INTCc", name: "Intel Corporation", address: "0xB2000000000000000000004AFF16039bA04bdFBc" },
|
|
8366
|
+
{ symbol: "SNDKc", name: "Sandisk Corporation", address: "0xb200000000000000000000397293Cb8cda9a10c5" },
|
|
8367
|
+
{ symbol: "SPCXc", name: "Space Exploration Technologies Corp.", address: "0xb2000000000000000000007b9fcbd005511aCBd5" }
|
|
8368
|
+
];
|
|
8369
|
+
var AERODROME_COINBASE_STOCK_DECIMALS = 8;
|
|
8370
|
+
|
|
8371
|
+
// src/protocols/evm/aerodrome/index.ts
|
|
8372
|
+
var aerodromeProtocolModule = {
|
|
8373
|
+
id: AERODROME_PROTOCOL_ID,
|
|
8374
|
+
chainCategory: "evm",
|
|
8375
|
+
isChainSupported(ctx) {
|
|
8376
|
+
if (ctx.chainCategory !== "evm") return false;
|
|
8377
|
+
return isAerodromeChainSupported(ctx.chainId);
|
|
8378
|
+
},
|
|
8379
|
+
isTokenSupported(token) {
|
|
8380
|
+
if (token.category !== "evm") return false;
|
|
8381
|
+
return token.kind === "native" || token.kind === "erc20";
|
|
8382
|
+
},
|
|
8383
|
+
actions: [
|
|
8384
|
+
{
|
|
8385
|
+
id: "aerodrome.quote",
|
|
8386
|
+
protocolId: AERODROME_PROTOCOL_ID,
|
|
8387
|
+
chainCategory: "evm",
|
|
8388
|
+
description: "Quote an Aerodrome swap on Base via factory discovery + MixedRouteQuoterV3 / Router. Tickers (AAPLc, USDC, ETH) accepted.",
|
|
8389
|
+
commonParams: [],
|
|
8390
|
+
params: {
|
|
8391
|
+
chainId: { type: "number", required: true, description: `Must be ${AERODROME_CHAIN_ID}` },
|
|
8392
|
+
tokenIn: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH, WETH, AERO) or 0x / 0x0 native" },
|
|
8393
|
+
tokenOut: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH, WETH, AERO) or 0x / 0x0 native" },
|
|
8394
|
+
amountHuman: { type: "string", required: true, description: "Human-readable input amount (B20 stocks are 8 decimals)" }
|
|
8395
|
+
}
|
|
8396
|
+
},
|
|
8397
|
+
{
|
|
8398
|
+
id: "aerodrome.swap",
|
|
8399
|
+
protocolId: AERODROME_PROTOCOL_ID,
|
|
8400
|
+
chainCategory: "evm",
|
|
8401
|
+
description: "Swap via Aerodrome Router / Slipstream SwapRouter (optional ERC-20 approve batch)",
|
|
8402
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
8403
|
+
params: {
|
|
8404
|
+
tokenIn: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native" },
|
|
8405
|
+
tokenOut: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native" },
|
|
8406
|
+
amountHuman: { type: "string", required: true, description: "Human-readable input amount" },
|
|
8407
|
+
slippagePercent: { type: "number", required: true, description: "Slippage percent (0\u2013100 exclusive)" }
|
|
8408
|
+
}
|
|
8409
|
+
},
|
|
8410
|
+
{
|
|
8411
|
+
id: "aerodrome.add-liquidity",
|
|
8412
|
+
protocolId: AERODROME_PROTOCOL_ID,
|
|
8413
|
+
chainCategory: "evm",
|
|
8414
|
+
description: "Deposit into a basic vAMM/sAMM pool (one-sided amounts; tickers OK)",
|
|
8415
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
8416
|
+
params: {
|
|
8417
|
+
tokenA: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native" },
|
|
8418
|
+
tokenB: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native" },
|
|
8419
|
+
stable: { type: "boolean", required: true, description: "true = sAMM, false = vAMM" },
|
|
8420
|
+
amountAHuman: { type: "string", required: false, description: "Amount A; omit to solve from B" },
|
|
8421
|
+
amountBHuman: { type: "string", required: false, description: "Amount B; omit to solve from A" },
|
|
8422
|
+
slippagePercent: { type: "number", required: true, description: "Slippage percent" }
|
|
8423
|
+
}
|
|
8424
|
+
},
|
|
8425
|
+
{
|
|
8426
|
+
id: "aerodrome.remove-liquidity",
|
|
8427
|
+
protocolId: AERODROME_PROTOCOL_ID,
|
|
8428
|
+
chainCategory: "evm",
|
|
8429
|
+
description: "Withdraw from a basic vAMM/sAMM pool",
|
|
8430
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
8431
|
+
params: {
|
|
8432
|
+
lpToken: { type: "address", required: true, description: "LP token" },
|
|
8433
|
+
liquidityHuman: { type: "string", required: true, description: "LP amount" }
|
|
8434
|
+
}
|
|
8435
|
+
},
|
|
8436
|
+
{
|
|
8437
|
+
id: "aerodrome.cl-mint",
|
|
8438
|
+
protocolId: AERODROME_PROTOCOL_ID,
|
|
8439
|
+
chainCategory: "evm",
|
|
8440
|
+
description: "Mint a Slipstream concentrated liquidity NFT",
|
|
8441
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
8442
|
+
params: {
|
|
8443
|
+
token0: { type: "address", required: true, description: "Token0" },
|
|
8444
|
+
token1: { type: "address", required: true, description: "Token1" },
|
|
8445
|
+
tickSpacing: { type: "number", required: true, description: "Pool tick spacing" },
|
|
8446
|
+
tickLower: { type: "number", required: true, description: "Lower tick" },
|
|
8447
|
+
tickUpper: { type: "number", required: true, description: "Upper tick" }
|
|
8448
|
+
}
|
|
8449
|
+
},
|
|
8450
|
+
{
|
|
8451
|
+
id: "aerodrome.gauge-stake",
|
|
8452
|
+
protocolId: AERODROME_PROTOCOL_ID,
|
|
8453
|
+
chainCategory: "evm",
|
|
8454
|
+
description: "Stake basic LP tokens or a Slipstream NFT in a gauge",
|
|
8455
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
8456
|
+
params: {
|
|
8457
|
+
gauge: { type: "address", required: true, description: "Gauge address" }
|
|
8458
|
+
}
|
|
8459
|
+
},
|
|
8460
|
+
{
|
|
8461
|
+
id: "aerodrome.claim-fees",
|
|
8462
|
+
protocolId: AERODROME_PROTOCOL_ID,
|
|
8463
|
+
chainCategory: "evm",
|
|
8464
|
+
description: "Claim unstaked fees from the pool (not the gauge)",
|
|
8465
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
8466
|
+
params: { pool: { type: "address", required: true, description: "Pool lp from fetch_positions claimFees.pool" } }
|
|
8467
|
+
},
|
|
8468
|
+
{
|
|
8469
|
+
id: "aerodrome.claim-emissions",
|
|
8470
|
+
protocolId: AERODROME_PROTOCOL_ID,
|
|
8471
|
+
chainCategory: "evm",
|
|
8472
|
+
description: "Claim gauge emissions in AERO (not the pool)",
|
|
8473
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
8474
|
+
params: { gauge: { type: "address", required: true, description: "Gauge from fetch_positions claimEmissions" } }
|
|
8475
|
+
}
|
|
8476
|
+
]
|
|
8477
|
+
};
|
|
8478
|
+
registerProtocolModule(aerodromeProtocolModule);
|
|
7363
8479
|
var CONTINUUM_DAO_PROTOCOL_ID = "continuum-dao";
|
|
7364
8480
|
var CONTINUUM_DAO_ETHEREUM_CHAIN_ID = 1;
|
|
7365
8481
|
var CONTINUUM_DAO_LINEA_CHAIN_ID = 59144;
|
|
@@ -7492,6 +8608,617 @@ var continuumDaoProtocolModule = {
|
|
|
7492
8608
|
]
|
|
7493
8609
|
};
|
|
7494
8610
|
registerProtocolModule(continuumDaoProtocolModule);
|
|
8611
|
+
var COMPOUND_V3_PROTOCOL_ID = "compound-v3";
|
|
8612
|
+
var COMPOUND_V3_CHAIN_IDS = [1, 8453, 42161, 10, 137, 5e3, 130, 59144];
|
|
8613
|
+
var COMPOUND_V3_WRAPPED_NATIVE = {
|
|
8614
|
+
1: viem.getAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
|
|
8615
|
+
8453: viem.getAddress("0x4200000000000000000000000000000000000006"),
|
|
8616
|
+
42161: viem.getAddress("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
|
|
8617
|
+
10: viem.getAddress("0x4200000000000000000000000000000000000006"),
|
|
8618
|
+
137: viem.getAddress("0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"),
|
|
8619
|
+
5e3: viem.getAddress("0x78c1b0C915c4CD0f08633e2ec3d4961Ab0237669"),
|
|
8620
|
+
130: viem.getAddress("0x4200000000000000000000000000000000000006"),
|
|
8621
|
+
59144: viem.getAddress("0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f")
|
|
8622
|
+
};
|
|
8623
|
+
function isCompoundV3ChainSupported(chainId) {
|
|
8624
|
+
return COMPOUND_V3_CHAIN_IDS.includes(chainId);
|
|
8625
|
+
}
|
|
8626
|
+
function compoundV3WrappedNative(chainId) {
|
|
8627
|
+
return COMPOUND_V3_WRAPPED_NATIVE[chainId] ?? null;
|
|
8628
|
+
}
|
|
8629
|
+
var COMPOUND_V3_MARKETS = [
|
|
8630
|
+
// Ethereum
|
|
8631
|
+
{
|
|
8632
|
+
chainId: 1,
|
|
8633
|
+
slug: "usdc",
|
|
8634
|
+
symbol: "cUSDCv3",
|
|
8635
|
+
comet: viem.getAddress("0xc3d688B66703497DAA19211EEdff47f25384cdc3"),
|
|
8636
|
+
rewards: viem.getAddress("0x1B0e765F6224C21223AeA2af16c1C46E38885a40"),
|
|
8637
|
+
bulker: viem.getAddress("0xa397a8C2086C554B531c02E29f3291c9704B00c7"),
|
|
8638
|
+
baseToken: viem.getAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
8639
|
+
source: "comet-deployments"
|
|
8640
|
+
},
|
|
8641
|
+
{
|
|
8642
|
+
chainId: 1,
|
|
8643
|
+
slug: "usds",
|
|
8644
|
+
symbol: "cUSDSv3",
|
|
8645
|
+
comet: viem.getAddress("0x5D409e56D886231aDAf00c8775665AD0f9897b56"),
|
|
8646
|
+
rewards: viem.getAddress("0x1B0e765F6224C21223AeA2af16c1C46E38885a40"),
|
|
8647
|
+
bulker: viem.getAddress("0xa397a8C2086C554B531c02E29f3291c9704B00c7"),
|
|
8648
|
+
baseToken: viem.getAddress("0xdC035D45d973E3EC169d2276DDab16f1e407384F"),
|
|
8649
|
+
source: "comet-deployments"
|
|
8650
|
+
},
|
|
8651
|
+
{
|
|
8652
|
+
chainId: 1,
|
|
8653
|
+
slug: "usdt",
|
|
8654
|
+
symbol: "cUSDTv3",
|
|
8655
|
+
comet: viem.getAddress("0x3Afdc9BCA9213A35503b077a6072F3D0d5AB0840"),
|
|
8656
|
+
rewards: viem.getAddress("0x1B0e765F6224C21223AeA2af16c1C46E38885a40"),
|
|
8657
|
+
bulker: viem.getAddress("0xa397a8C2086C554B531c02E29f3291c9704B00c7"),
|
|
8658
|
+
baseToken: viem.getAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
|
|
8659
|
+
source: "comet-deployments"
|
|
8660
|
+
},
|
|
8661
|
+
{
|
|
8662
|
+
chainId: 1,
|
|
8663
|
+
slug: "wbtc",
|
|
8664
|
+
symbol: "cWBTCv3",
|
|
8665
|
+
comet: viem.getAddress("0xe85Dc543813B8c2CFEaAc371517b925a166a9293"),
|
|
8666
|
+
rewards: viem.getAddress("0x1B0e765F6224C21223AeA2af16c1C46E38885a40"),
|
|
8667
|
+
bulker: viem.getAddress("0xa397a8C2086C554B531c02E29f3291c9704B00c7"),
|
|
8668
|
+
baseToken: viem.getAddress("0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"),
|
|
8669
|
+
source: "comet-deployments"
|
|
8670
|
+
},
|
|
8671
|
+
{
|
|
8672
|
+
chainId: 1,
|
|
8673
|
+
slug: "weth",
|
|
8674
|
+
symbol: "cWETHv3",
|
|
8675
|
+
comet: viem.getAddress("0xA17581A9E3356d9A858b789D68B4d866e593aE94"),
|
|
8676
|
+
rewards: viem.getAddress("0x1B0e765F6224C21223AeA2af16c1C46E38885a40"),
|
|
8677
|
+
bulker: viem.getAddress("0xa397a8C2086C554B531c02E29f3291c9704B00c7"),
|
|
8678
|
+
baseToken: viem.getAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
|
|
8679
|
+
source: "comet-deployments"
|
|
8680
|
+
},
|
|
8681
|
+
{
|
|
8682
|
+
chainId: 1,
|
|
8683
|
+
slug: "wsteth",
|
|
8684
|
+
symbol: "cWstETHv3",
|
|
8685
|
+
comet: viem.getAddress("0x3D0bb1ccaB520A66e607822fC55BC921738fAFE3"),
|
|
8686
|
+
rewards: viem.getAddress("0x1B0e765F6224C21223AeA2af16c1C46E38885a40"),
|
|
8687
|
+
bulker: viem.getAddress("0x2c776041CCFe903071AF44aa147368a9c8EEA518"),
|
|
8688
|
+
baseToken: viem.getAddress("0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"),
|
|
8689
|
+
source: "comet-deployments"
|
|
8690
|
+
},
|
|
8691
|
+
// Base
|
|
8692
|
+
{
|
|
8693
|
+
chainId: 8453,
|
|
8694
|
+
slug: "usdc",
|
|
8695
|
+
symbol: "cUSDCv3",
|
|
8696
|
+
comet: viem.getAddress("0xb125E6687d4313864e53df431d5425969c15Eb2F"),
|
|
8697
|
+
rewards: viem.getAddress("0x123964802e6ABabBE1Bc9547D72Ef1B69B00A6b1"),
|
|
8698
|
+
bulker: viem.getAddress("0x78D0677032A35c63D142a48A2037048871212a8C"),
|
|
8699
|
+
baseToken: viem.getAddress("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
8700
|
+
source: "comet-deployments"
|
|
8701
|
+
},
|
|
8702
|
+
{
|
|
8703
|
+
chainId: 8453,
|
|
8704
|
+
slug: "usdbc",
|
|
8705
|
+
symbol: "cUSDbCv3",
|
|
8706
|
+
comet: viem.getAddress("0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf"),
|
|
8707
|
+
rewards: viem.getAddress("0x123964802e6ABabBE1Bc9547D72Ef1B69B00A6b1"),
|
|
8708
|
+
bulker: viem.getAddress("0x78D0677032A35c63D142a48A2037048871212a8C"),
|
|
8709
|
+
baseToken: viem.getAddress("0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA"),
|
|
8710
|
+
source: "comet-deployments"
|
|
8711
|
+
},
|
|
8712
|
+
{
|
|
8713
|
+
chainId: 8453,
|
|
8714
|
+
slug: "usds",
|
|
8715
|
+
symbol: "cUSDSv3",
|
|
8716
|
+
comet: viem.getAddress("0x2c776041CCFe903071AF44aa147368a9c8EEA518"),
|
|
8717
|
+
rewards: viem.getAddress("0x123964802e6ABabBE1Bc9547D72Ef1B69B00A6b1"),
|
|
8718
|
+
bulker: viem.getAddress("0x78D0677032A35c63D142a48A2037048871212a8C"),
|
|
8719
|
+
baseToken: viem.getAddress("0x820C137fa70C8691f0e44Dc420a5e53c168921Dc"),
|
|
8720
|
+
source: "comet-deployments"
|
|
8721
|
+
},
|
|
8722
|
+
{
|
|
8723
|
+
chainId: 8453,
|
|
8724
|
+
slug: "weth",
|
|
8725
|
+
symbol: "cWETHv3",
|
|
8726
|
+
comet: viem.getAddress("0x46e6b214b524310239732D51387075E0e70970bf"),
|
|
8727
|
+
rewards: viem.getAddress("0x123964802e6ABabBE1Bc9547D72Ef1B69B00A6b1"),
|
|
8728
|
+
bulker: viem.getAddress("0x78D0677032A35c63D142a48A2037048871212a8C"),
|
|
8729
|
+
baseToken: viem.getAddress("0x4200000000000000000000000000000000000006"),
|
|
8730
|
+
source: "comet-deployments"
|
|
8731
|
+
},
|
|
8732
|
+
{
|
|
8733
|
+
chainId: 8453,
|
|
8734
|
+
slug: "aero",
|
|
8735
|
+
symbol: "cAEROv3",
|
|
8736
|
+
comet: viem.getAddress("0x784efeB622244d2348d4F2522f8860B96fbEcE89"),
|
|
8737
|
+
rewards: viem.getAddress("0x123964802e6ABabBE1Bc9547D72Ef1B69B00A6b1"),
|
|
8738
|
+
bulker: viem.getAddress("0x78D0677032A35c63D142a48A2037048871212a8C"),
|
|
8739
|
+
baseToken: viem.getAddress("0x940181a94A35A4569E4529A3CDfB74e38FD98631"),
|
|
8740
|
+
source: "comet-deployments"
|
|
8741
|
+
},
|
|
8742
|
+
// Arbitrum
|
|
8743
|
+
{
|
|
8744
|
+
chainId: 42161,
|
|
8745
|
+
slug: "usdc",
|
|
8746
|
+
symbol: "cUSDCv3",
|
|
8747
|
+
comet: viem.getAddress("0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf"),
|
|
8748
|
+
rewards: viem.getAddress("0x88730d254A2f7e6AC8388c3198aFd694bA9f7fae"),
|
|
8749
|
+
bulker: viem.getAddress("0xbdE8F31D2DdDA895264e27DD990faB3DC87b372d"),
|
|
8750
|
+
baseToken: viem.getAddress("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
8751
|
+
source: "comet-deployments"
|
|
8752
|
+
},
|
|
8753
|
+
{
|
|
8754
|
+
chainId: 42161,
|
|
8755
|
+
slug: "usdc.e",
|
|
8756
|
+
symbol: "cUSDC.ev3",
|
|
8757
|
+
comet: viem.getAddress("0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA"),
|
|
8758
|
+
rewards: viem.getAddress("0x88730d254A2f7e6AC8388c3198aFd694bA9f7fae"),
|
|
8759
|
+
bulker: viem.getAddress("0xbdE8F31D2DdDA895264e27DD990faB3DC87b372d"),
|
|
8760
|
+
baseToken: viem.getAddress("0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8"),
|
|
8761
|
+
source: "comet-deployments"
|
|
8762
|
+
},
|
|
8763
|
+
{
|
|
8764
|
+
chainId: 42161,
|
|
8765
|
+
slug: "usdt",
|
|
8766
|
+
symbol: "cUSDTv3",
|
|
8767
|
+
comet: viem.getAddress("0xd98Be00b5D27fc98112BdE293e487f8D4cA57d07"),
|
|
8768
|
+
rewards: viem.getAddress("0x88730d254A2f7e6AC8388c3198aFd694bA9f7fae"),
|
|
8769
|
+
bulker: viem.getAddress("0xbdE8F31D2DdDA895264e27DD990faB3DC87b372d"),
|
|
8770
|
+
baseToken: viem.getAddress("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),
|
|
8771
|
+
source: "comet-deployments"
|
|
8772
|
+
},
|
|
8773
|
+
{
|
|
8774
|
+
chainId: 42161,
|
|
8775
|
+
slug: "weth",
|
|
8776
|
+
symbol: "cWETHv3",
|
|
8777
|
+
comet: viem.getAddress("0x6f7D514bbD4aFf3BcD1140B7344b32f063dEe486"),
|
|
8778
|
+
rewards: viem.getAddress("0x88730d254A2f7e6AC8388c3198aFd694bA9f7fae"),
|
|
8779
|
+
bulker: viem.getAddress("0xbdE8F31D2DdDA895264e27DD990faB3DC87b372d"),
|
|
8780
|
+
baseToken: viem.getAddress("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
|
|
8781
|
+
source: "comet-deployments"
|
|
8782
|
+
},
|
|
8783
|
+
// Optimism
|
|
8784
|
+
{
|
|
8785
|
+
chainId: 10,
|
|
8786
|
+
slug: "usdc",
|
|
8787
|
+
symbol: "cUSDCv3",
|
|
8788
|
+
comet: viem.getAddress("0x2e44e174f7D53F0212823acC11C01A11d58c5bCB"),
|
|
8789
|
+
rewards: viem.getAddress("0x443EA0340cb75a160F31A440722dec7b5bc3C2E9"),
|
|
8790
|
+
bulker: viem.getAddress("0xcb3643CC8294B23171272845473dEc49739d4Ba3"),
|
|
8791
|
+
baseToken: viem.getAddress("0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85"),
|
|
8792
|
+
source: "comet-deployments"
|
|
8793
|
+
},
|
|
8794
|
+
{
|
|
8795
|
+
chainId: 10,
|
|
8796
|
+
slug: "usdt",
|
|
8797
|
+
symbol: "cUSDTv3",
|
|
8798
|
+
comet: viem.getAddress("0x995E394b8B2437aC8Ce61Ee0bC610D617962B214"),
|
|
8799
|
+
rewards: viem.getAddress("0x443EA0340cb75a160F31A440722dec7b5bc3C2E9"),
|
|
8800
|
+
bulker: viem.getAddress("0xcb3643CC8294B23171272845473dEc49739d4Ba3"),
|
|
8801
|
+
baseToken: viem.getAddress("0x94b008aA00579c1307B0EF2c499aD98a8ce58e58"),
|
|
8802
|
+
source: "comet-deployments"
|
|
8803
|
+
},
|
|
8804
|
+
{
|
|
8805
|
+
chainId: 10,
|
|
8806
|
+
slug: "weth",
|
|
8807
|
+
symbol: "cWETHv3",
|
|
8808
|
+
comet: viem.getAddress("0xE36A30D249f7761327fd973001A32010b521b6Fd"),
|
|
8809
|
+
rewards: viem.getAddress("0x443EA0340cb75a160F31A440722dec7b5bc3C2E9"),
|
|
8810
|
+
bulker: viem.getAddress("0xcb3643CC8294B23171272845473dEc49739d4Ba3"),
|
|
8811
|
+
baseToken: viem.getAddress("0x4200000000000000000000000000000000000006"),
|
|
8812
|
+
source: "comet-deployments"
|
|
8813
|
+
},
|
|
8814
|
+
// Polygon
|
|
8815
|
+
{
|
|
8816
|
+
chainId: 137,
|
|
8817
|
+
slug: "usdc",
|
|
8818
|
+
symbol: "cUSDCv3",
|
|
8819
|
+
comet: viem.getAddress("0xF25212E676D1F7F89Cd72fFEe66158f541246445"),
|
|
8820
|
+
rewards: viem.getAddress("0x45939657d1CA34A8FA39A924B71D28Fe8431e581"),
|
|
8821
|
+
bulker: viem.getAddress("0x59e242D352ae13166B4987aE5c990C232f7f7CD6"),
|
|
8822
|
+
baseToken: viem.getAddress("0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"),
|
|
8823
|
+
source: "comet-deployments"
|
|
8824
|
+
},
|
|
8825
|
+
{
|
|
8826
|
+
chainId: 137,
|
|
8827
|
+
slug: "usdt",
|
|
8828
|
+
symbol: "cUSDTv3",
|
|
8829
|
+
comet: viem.getAddress("0xaeB318360f27748Acb200CE616E389A6C9409a07"),
|
|
8830
|
+
rewards: viem.getAddress("0x45939657d1CA34A8FA39A924B71D28Fe8431e581"),
|
|
8831
|
+
bulker: viem.getAddress("0x59e242D352ae13166B4987aE5c990C232f7f7CD6"),
|
|
8832
|
+
baseToken: viem.getAddress("0xc2132D05D31c914a87C6611C10748AEb04B58e8F"),
|
|
8833
|
+
source: "comet-deployments"
|
|
8834
|
+
},
|
|
8835
|
+
// Mantle
|
|
8836
|
+
{
|
|
8837
|
+
chainId: 5e3,
|
|
8838
|
+
slug: "usde",
|
|
8839
|
+
symbol: "cUSDev3",
|
|
8840
|
+
comet: viem.getAddress("0x606174f62cd968d8e684c645080fa694c1D7786E"),
|
|
8841
|
+
rewards: viem.getAddress("0xCd83CbBFCE149d141A5171C3D6a0F0fCCeE225Ab"),
|
|
8842
|
+
bulker: viem.getAddress("0x67DFCa85CcEEFA2C5B1dB4DEe3BEa716A28B9baa"),
|
|
8843
|
+
source: "comet-deployments"
|
|
8844
|
+
},
|
|
8845
|
+
// Unichain
|
|
8846
|
+
{
|
|
8847
|
+
chainId: 130,
|
|
8848
|
+
slug: "usdc",
|
|
8849
|
+
symbol: "cUSDCv3",
|
|
8850
|
+
comet: viem.getAddress("0x2c7118c4C88B9841FCF839074c26Ae8f035f2921"),
|
|
8851
|
+
rewards: viem.getAddress("0x6f7D514bbD4aFf3BcD1140B7344b32f063dEe486"),
|
|
8852
|
+
bulker: viem.getAddress("0x58EbB8Db8b4FdF2dCbbB16E04c2F5b952963B514"),
|
|
8853
|
+
baseToken: viem.getAddress("0x078D782b760474a361dDA0AF3839290b0EF57AD6"),
|
|
8854
|
+
source: "comet-deployments"
|
|
8855
|
+
},
|
|
8856
|
+
{
|
|
8857
|
+
chainId: 130,
|
|
8858
|
+
slug: "weth",
|
|
8859
|
+
symbol: "cWETHv3",
|
|
8860
|
+
comet: viem.getAddress("0x6C987dDE50dB1dcDd32Cd4175778C2a291978E2a"),
|
|
8861
|
+
rewards: viem.getAddress("0x6f7D514bbD4aFf3BcD1140B7344b32f063dEe486"),
|
|
8862
|
+
bulker: viem.getAddress("0x58EbB8Db8b4FdF2dCbbB16E04c2F5b952963B514"),
|
|
8863
|
+
baseToken: viem.getAddress("0x4200000000000000000000000000000000000006"),
|
|
8864
|
+
source: "comet-deployments"
|
|
8865
|
+
},
|
|
8866
|
+
// Linea
|
|
8867
|
+
{
|
|
8868
|
+
chainId: 59144,
|
|
8869
|
+
slug: "usdc",
|
|
8870
|
+
symbol: "cUSDCv3",
|
|
8871
|
+
comet: viem.getAddress("0x8D38A3d6B3c3B7d96D6536DA7Eef94A9d7dbC991"),
|
|
8872
|
+
rewards: viem.getAddress("0x2c7118c4C88B9841FCF839074c26Ae8f035f2921"),
|
|
8873
|
+
bulker: viem.getAddress("0x023ee795361B28cDbB94e302983578486A0A5f1B"),
|
|
8874
|
+
baseToken: viem.getAddress("0x176211869cA2b568f2A7D4EE941E073a821EE1ff"),
|
|
8875
|
+
source: "comet-deployments"
|
|
8876
|
+
},
|
|
8877
|
+
{
|
|
8878
|
+
chainId: 59144,
|
|
8879
|
+
slug: "weth",
|
|
8880
|
+
symbol: "cWETHv3",
|
|
8881
|
+
comet: viem.getAddress("0x60F2058379716A64a7A5d29219397e79bC552194"),
|
|
8882
|
+
rewards: viem.getAddress("0x2c7118c4C88B9841FCF839074c26Ae8f035f2921"),
|
|
8883
|
+
bulker: viem.getAddress("0x023ee795361B28cDbB94e302983578486A0A5f1B"),
|
|
8884
|
+
baseToken: viem.getAddress("0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f"),
|
|
8885
|
+
source: "comet-deployments"
|
|
8886
|
+
}
|
|
8887
|
+
];
|
|
8888
|
+
function listCompoundV3SupportedChainIds() {
|
|
8889
|
+
return [...COMPOUND_V3_CHAIN_IDS];
|
|
8890
|
+
}
|
|
8891
|
+
function listCompoundV3MarketsForChain(chainId) {
|
|
8892
|
+
if (!isCompoundV3ChainSupported(chainId)) return [];
|
|
8893
|
+
return COMPOUND_V3_MARKETS.filter((m) => m.chainId === chainId);
|
|
8894
|
+
}
|
|
8895
|
+
var cometInterfaceAbi = viem.parseAbi([
|
|
8896
|
+
"function supply(address asset, uint256 amount)",
|
|
8897
|
+
"function supplyTo(address dst, address asset, uint256 amount)",
|
|
8898
|
+
"function withdraw(address asset, uint256 amount)",
|
|
8899
|
+
"function withdrawTo(address to, address asset, uint256 amount)",
|
|
8900
|
+
"function allow(address manager, bool isAllowed)",
|
|
8901
|
+
"function hasPermission(address owner, address manager) view returns (bool)",
|
|
8902
|
+
"function balanceOf(address account) view returns (uint256)",
|
|
8903
|
+
"function borrowBalanceOf(address account) view returns (uint256)",
|
|
8904
|
+
"function collateralBalanceOf(address account, address asset) view returns (uint128)",
|
|
8905
|
+
"function baseToken() view returns (address)",
|
|
8906
|
+
"function baseTokenPriceFeed() view returns (address)",
|
|
8907
|
+
"function decimals() view returns (uint8)",
|
|
8908
|
+
"function numAssets() view returns (uint8)",
|
|
8909
|
+
"function getUtilization() view returns (uint256)",
|
|
8910
|
+
"function getSupplyRate(uint256 utilization) view returns (uint64)",
|
|
8911
|
+
"function getBorrowRate(uint256 utilization) view returns (uint64)",
|
|
8912
|
+
"function getPrice(address priceFeed) view returns (uint256)",
|
|
8913
|
+
"function isBorrowCollateralized(address account) view returns (bool)",
|
|
8914
|
+
"function isLiquidatable(address account) view returns (bool)",
|
|
8915
|
+
"function getAssetInfo(uint8 i) view returns ((uint8 offset, address asset, address priceFeed, uint64 scale, uint64 borrowCollateralFactor, uint64 liquidateCollateralFactor, uint64 liquidationFactor, uint128 supplyCap))",
|
|
8916
|
+
"function getAssetInfoByAddress(address asset) view returns ((uint8 offset, address asset, address priceFeed, uint64 scale, uint64 borrowCollateralFactor, uint64 liquidateCollateralFactor, uint64 liquidationFactor, uint128 supplyCap))"
|
|
8917
|
+
]);
|
|
8918
|
+
viem.parseAbi([
|
|
8919
|
+
"function getRewardOwed(address comet, address account) view returns ((address token, uint256 owed))",
|
|
8920
|
+
"function claim(address comet, address src, bool shouldAccrue)"
|
|
8921
|
+
]);
|
|
8922
|
+
viem.parseAbi([
|
|
8923
|
+
"function invoke(bytes32[] actions, bytes[] data) payable"
|
|
8924
|
+
]);
|
|
8925
|
+
var erc20ReadAbi = viem.parseAbi([
|
|
8926
|
+
"function allowance(address owner, address spender) view returns (uint256)",
|
|
8927
|
+
"function decimals() view returns (uint8)",
|
|
8928
|
+
"function symbol() view returns (string)",
|
|
8929
|
+
"function name() view returns (string)"
|
|
8930
|
+
]);
|
|
8931
|
+
viem.parseAbi(["function approve(address spender, uint256 amount) returns (bool)"]);
|
|
8932
|
+
viem.parseAbi(["function deposit() payable", "function withdraw(uint256 wad)"]);
|
|
8933
|
+
function bulkerActionId(name) {
|
|
8934
|
+
return viem.stringToHex(name, { size: 32 });
|
|
8935
|
+
}
|
|
8936
|
+
bulkerActionId("ACTION_SUPPLY_ASSET");
|
|
8937
|
+
bulkerActionId("ACTION_SUPPLY_NATIVE_TOKEN");
|
|
8938
|
+
bulkerActionId("ACTION_WITHDRAW_ASSET");
|
|
8939
|
+
bulkerActionId("ACTION_WITHDRAW_NATIVE_TOKEN");
|
|
8940
|
+
bulkerActionId("ACTION_CLAIM_REWARD");
|
|
8941
|
+
bulkerActionId("ACTION_TRANSFER_ASSET");
|
|
8942
|
+
|
|
8943
|
+
// src/protocols/evm/compound-v3/apr.ts
|
|
8944
|
+
var COMPOUND_V3_SECONDS_PER_YEAR = 365 * 24 * 60 * 60;
|
|
8945
|
+
function compoundV3RatePerSecondToAprDecimal(ratePerSecond) {
|
|
8946
|
+
if (ratePerSecond <= 0n) return 0;
|
|
8947
|
+
return Number(ratePerSecond) / 1e18 * COMPOUND_V3_SECONDS_PER_YEAR;
|
|
8948
|
+
}
|
|
8949
|
+
function compoundV3AprToPercentLabel(aprDecimal) {
|
|
8950
|
+
if (!Number.isFinite(aprDecimal)) return "\u2014";
|
|
8951
|
+
const pct = aprDecimal * 100;
|
|
8952
|
+
if (Math.abs(pct) < 1e-3) return "0.00%";
|
|
8953
|
+
return `${pct.toFixed(2)}%`;
|
|
8954
|
+
}
|
|
8955
|
+
function compoundV3UtilizationToDecimal(utilization) {
|
|
8956
|
+
if (utilization <= 0n) return 0;
|
|
8957
|
+
return Number(utilization) / 1e18;
|
|
8958
|
+
}
|
|
8959
|
+
function compoundV3FactorToPercent(factor) {
|
|
8960
|
+
return Number(factor) / 1e16;
|
|
8961
|
+
}
|
|
8962
|
+
|
|
8963
|
+
// src/protocols/evm/compound-v3/subgraph.ts
|
|
8964
|
+
var COMPOUND_V3_SUBGRAPH_BY_CHAIN = {
|
|
8965
|
+
1: "5nwMCSHaTqG3Kd2gHznbTXEnZ9QNWsssQfbHhDqQSQFp",
|
|
8966
|
+
137: "AaFtUWKfFdj2x8nnE3RxTSJkHwGHvawH3VWFBykCGzLs",
|
|
8967
|
+
42161: "Ff7ha9ELmpmg81D6nYxy4t8aGP26dPztqD1LDJNPqjLS",
|
|
8968
|
+
8453: "2hcXhs36pTBDVUmk5K2Zkr6N4UYGwaHuco2a6jyTsijo",
|
|
8969
|
+
10: "FhHNkfh5z6Z2WCEBxB6V3s8RPxnJfWZ9zAfM5bVvbvbb"
|
|
8970
|
+
};
|
|
8971
|
+
function compoundV3SubgraphIdForChain(chainId) {
|
|
8972
|
+
return COMPOUND_V3_SUBGRAPH_BY_CHAIN[chainId] ?? null;
|
|
8973
|
+
}
|
|
8974
|
+
async function fetchCompoundV3SubgraphMarkets(args) {
|
|
8975
|
+
const id = compoundV3SubgraphIdForChain(args.chainId);
|
|
8976
|
+
const apiKey = (args.apiKey ?? process.env.THE_GRAPH_API_KEY ?? "").trim();
|
|
8977
|
+
if (!id || !apiKey) return null;
|
|
8978
|
+
const url = `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/${id}`;
|
|
8979
|
+
try {
|
|
8980
|
+
const res = await fetch(url, {
|
|
8981
|
+
method: "POST",
|
|
8982
|
+
headers: { "content-type": "application/json" },
|
|
8983
|
+
body: JSON.stringify({
|
|
8984
|
+
query: `query CompoundV3Markets { markets(first: 50) { id } }`
|
|
8985
|
+
})
|
|
8986
|
+
});
|
|
8987
|
+
if (!res.ok) return null;
|
|
8988
|
+
const json = await res.json();
|
|
8989
|
+
const markets = json.data?.markets;
|
|
8990
|
+
if (!markets) return null;
|
|
8991
|
+
return markets.map((m) => ({ id: m.id, comet: m.id }));
|
|
8992
|
+
} catch {
|
|
8993
|
+
return null;
|
|
8994
|
+
}
|
|
8995
|
+
}
|
|
8996
|
+
function publicClient(rpcUrl, chainId) {
|
|
8997
|
+
const chain = viem.defineChain({
|
|
8998
|
+
id: chainId,
|
|
8999
|
+
name: "Destination",
|
|
9000
|
+
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
9001
|
+
rpcUrls: { default: { http: [rpcUrl] } }
|
|
9002
|
+
});
|
|
9003
|
+
return viem.createPublicClient({ chain, transport: viem.http(rpcUrl) });
|
|
9004
|
+
}
|
|
9005
|
+
async function readTokenMeta(client, asset) {
|
|
9006
|
+
const [symbol, decimals] = await Promise.all([
|
|
9007
|
+
client.readContract({ address: asset, abi: erc20ReadAbi, functionName: "symbol" }).catch(() => "TOKEN"),
|
|
9008
|
+
client.readContract({ address: asset, abi: erc20ReadAbi, functionName: "decimals" }).catch(() => 18)
|
|
9009
|
+
]);
|
|
9010
|
+
return { symbol: String(symbol), decimals: Number(decimals) };
|
|
9011
|
+
}
|
|
9012
|
+
async function enrichMarketOnChain(client, market) {
|
|
9013
|
+
const comet = market.comet;
|
|
9014
|
+
const [baseToken, utilization, numAssets, decimals] = await Promise.all([
|
|
9015
|
+
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "baseToken" }),
|
|
9016
|
+
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "getUtilization" }),
|
|
9017
|
+
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "numAssets" }),
|
|
9018
|
+
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "decimals" })
|
|
9019
|
+
]);
|
|
9020
|
+
const [supplyRate, borrowRate, baseMeta, baseFeed] = await Promise.all([
|
|
9021
|
+
client.readContract({
|
|
9022
|
+
address: comet,
|
|
9023
|
+
abi: cometInterfaceAbi,
|
|
9024
|
+
functionName: "getSupplyRate",
|
|
9025
|
+
args: [utilization]
|
|
9026
|
+
}),
|
|
9027
|
+
client.readContract({
|
|
9028
|
+
address: comet,
|
|
9029
|
+
abi: cometInterfaceAbi,
|
|
9030
|
+
functionName: "getBorrowRate",
|
|
9031
|
+
args: [utilization]
|
|
9032
|
+
}),
|
|
9033
|
+
readTokenMeta(client, viem.getAddress(baseToken)),
|
|
9034
|
+
client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "baseTokenPriceFeed" })
|
|
9035
|
+
]);
|
|
9036
|
+
const basePrice = await client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "getPrice", args: [baseFeed] }).catch(() => 0n);
|
|
9037
|
+
const assets = [
|
|
9038
|
+
{
|
|
9039
|
+
asset: viem.getAddress(baseToken),
|
|
9040
|
+
symbol: baseMeta.symbol,
|
|
9041
|
+
decimals: Number(decimals) || baseMeta.decimals,
|
|
9042
|
+
borrowCollateralFactorPercent: 0,
|
|
9043
|
+
liquidateCollateralFactorPercent: 0,
|
|
9044
|
+
priceRaw: basePrice.toString(),
|
|
9045
|
+
role: "base"
|
|
9046
|
+
}
|
|
9047
|
+
];
|
|
9048
|
+
const n = Number(numAssets);
|
|
9049
|
+
for (let i = 0; i < n; i++) {
|
|
9050
|
+
const info = await client.readContract({
|
|
9051
|
+
address: comet,
|
|
9052
|
+
abi: cometInterfaceAbi,
|
|
9053
|
+
functionName: "getAssetInfo",
|
|
9054
|
+
args: [i]
|
|
9055
|
+
});
|
|
9056
|
+
const token = viem.getAddress(info.asset);
|
|
9057
|
+
const meta = await readTokenMeta(client, token);
|
|
9058
|
+
const price = await client.readContract({ address: comet, abi: cometInterfaceAbi, functionName: "getPrice", args: [info.priceFeed] }).catch(() => 0n);
|
|
9059
|
+
assets.push({
|
|
9060
|
+
asset: token,
|
|
9061
|
+
symbol: meta.symbol,
|
|
9062
|
+
decimals: meta.decimals,
|
|
9063
|
+
borrowCollateralFactorPercent: compoundV3FactorToPercent(info.borrowCollateralFactor),
|
|
9064
|
+
liquidateCollateralFactorPercent: compoundV3FactorToPercent(info.liquidateCollateralFactor),
|
|
9065
|
+
priceRaw: price.toString(),
|
|
9066
|
+
role: "collateral"
|
|
9067
|
+
});
|
|
9068
|
+
}
|
|
9069
|
+
return {
|
|
9070
|
+
chainId: market.chainId,
|
|
9071
|
+
slug: market.slug,
|
|
9072
|
+
symbol: market.symbol,
|
|
9073
|
+
comet: market.comet,
|
|
9074
|
+
rewards: market.rewards,
|
|
9075
|
+
bulker: market.bulker,
|
|
9076
|
+
baseToken: viem.getAddress(baseToken),
|
|
9077
|
+
utilization: compoundV3UtilizationToDecimal(utilization),
|
|
9078
|
+
supplyAprPercent: compoundV3AprToPercentLabel(compoundV3RatePerSecondToAprDecimal(supplyRate)),
|
|
9079
|
+
borrowAprPercent: compoundV3AprToPercentLabel(compoundV3RatePerSecondToAprDecimal(borrowRate)),
|
|
9080
|
+
assets
|
|
9081
|
+
};
|
|
9082
|
+
}
|
|
9083
|
+
function registryMarketRow(market) {
|
|
9084
|
+
return {
|
|
9085
|
+
chainId: market.chainId,
|
|
9086
|
+
slug: market.slug,
|
|
9087
|
+
symbol: market.symbol,
|
|
9088
|
+
comet: market.comet,
|
|
9089
|
+
rewards: market.rewards,
|
|
9090
|
+
bulker: market.bulker,
|
|
9091
|
+
baseToken: market.baseToken ?? null,
|
|
9092
|
+
utilization: null,
|
|
9093
|
+
supplyAprPercent: null,
|
|
9094
|
+
borrowAprPercent: null,
|
|
9095
|
+
assets: market.baseToken ? [
|
|
9096
|
+
{
|
|
9097
|
+
asset: market.baseToken,
|
|
9098
|
+
symbol: market.slug.toUpperCase(),
|
|
9099
|
+
decimals: 18,
|
|
9100
|
+
borrowCollateralFactorPercent: 0,
|
|
9101
|
+
liquidateCollateralFactorPercent: 0,
|
|
9102
|
+
priceRaw: "0",
|
|
9103
|
+
role: "base"
|
|
9104
|
+
}
|
|
9105
|
+
] : []
|
|
9106
|
+
};
|
|
9107
|
+
}
|
|
9108
|
+
async function compoundV3FetchMarketsSummary(args) {
|
|
9109
|
+
if (!isCompoundV3ChainSupported(args.chainId)) {
|
|
9110
|
+
return { markets: [], notes: `Compound III is not deployed on chain ${args.chainId}.` };
|
|
9111
|
+
}
|
|
9112
|
+
const registry = listCompoundV3MarketsForChain(args.chainId);
|
|
9113
|
+
let subgraphNote = "";
|
|
9114
|
+
const subgraph = await fetchCompoundV3SubgraphMarkets({ chainId: args.chainId });
|
|
9115
|
+
if (subgraph) {
|
|
9116
|
+
subgraphNote = ` Subgraph listed ${subgraph.length} market id(s); official comet deployments are the address source.`;
|
|
9117
|
+
}
|
|
9118
|
+
if (!args.rpcUrl?.trim()) {
|
|
9119
|
+
return {
|
|
9120
|
+
markets: registry.map(registryMarketRow),
|
|
9121
|
+
notes: "Registry from official comet deployments. Pass rpcUrl (MCP server injects it) to enrich APRs and collaterals." + subgraphNote
|
|
9122
|
+
};
|
|
9123
|
+
}
|
|
9124
|
+
const client = publicClient(args.rpcUrl, args.chainId);
|
|
9125
|
+
const markets = [];
|
|
9126
|
+
for (const row of registry) {
|
|
9127
|
+
try {
|
|
9128
|
+
markets.push(await enrichMarketOnChain(client, row));
|
|
9129
|
+
} catch {
|
|
9130
|
+
markets.push(registryMarketRow(row));
|
|
9131
|
+
}
|
|
9132
|
+
}
|
|
9133
|
+
return {
|
|
9134
|
+
markets,
|
|
9135
|
+
notes: "Comet proxy addresses from official deployments; rates and collaterals from on-chain CometInterface." + subgraphNote
|
|
9136
|
+
};
|
|
9137
|
+
}
|
|
9138
|
+
var chainAssetCache2 = /* @__PURE__ */ new Map();
|
|
9139
|
+
async function ensureCompoundV3ChainAssetCache(args) {
|
|
9140
|
+
const existing = chainAssetCache2.get(args.chainId);
|
|
9141
|
+
if (existing && existing.size > 0 && !args.rpcUrl) return existing;
|
|
9142
|
+
const map = /* @__PURE__ */ new Map();
|
|
9143
|
+
const add = (address, role) => {
|
|
9144
|
+
const key = viem.getAddress(address).toLowerCase();
|
|
9145
|
+
const cur = map.get(key) ?? { base: false, collateral: false };
|
|
9146
|
+
cur[role] = true;
|
|
9147
|
+
map.set(key, cur);
|
|
9148
|
+
};
|
|
9149
|
+
if (args.rpcUrl?.trim()) {
|
|
9150
|
+
try {
|
|
9151
|
+
const { markets } = await compoundV3FetchMarketsSummary({ chainId: args.chainId, rpcUrl: args.rpcUrl });
|
|
9152
|
+
for (const m of markets) {
|
|
9153
|
+
for (const a of m.assets) add(a.asset, a.role === "base" ? "base" : "collateral");
|
|
9154
|
+
}
|
|
9155
|
+
chainAssetCache2.set(args.chainId, map);
|
|
9156
|
+
return map;
|
|
9157
|
+
} catch {
|
|
9158
|
+
}
|
|
9159
|
+
}
|
|
9160
|
+
for (const m of listCompoundV3MarketsForChain(args.chainId)) {
|
|
9161
|
+
if (m.baseToken) add(m.baseToken, "base");
|
|
9162
|
+
}
|
|
9163
|
+
chainAssetCache2.set(args.chainId, map);
|
|
9164
|
+
return map;
|
|
9165
|
+
}
|
|
9166
|
+
|
|
9167
|
+
// src/protocols/evm/compound-v3/index.ts
|
|
9168
|
+
var compoundV3ProtocolModule = {
|
|
9169
|
+
id: COMPOUND_V3_PROTOCOL_ID,
|
|
9170
|
+
chainCategory: "evm",
|
|
9171
|
+
isChainSupported(ctx) {
|
|
9172
|
+
const id = typeof ctx.chainId === "string" ? Number(ctx.chainId) : ctx.chainId;
|
|
9173
|
+
return ctx.chainCategory === "evm" && isCompoundV3ChainSupported(id);
|
|
9174
|
+
},
|
|
9175
|
+
isTokenSupported(token) {
|
|
9176
|
+
return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
|
|
9177
|
+
},
|
|
9178
|
+
actions: [
|
|
9179
|
+
{
|
|
9180
|
+
id: "compound-v3.supply",
|
|
9181
|
+
protocolId: COMPOUND_V3_PROTOCOL_ID,
|
|
9182
|
+
chainCategory: "evm",
|
|
9183
|
+
description: "Supply base (earn/repay) or collateral to a Comet proxy",
|
|
9184
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
9185
|
+
params: {}
|
|
9186
|
+
},
|
|
9187
|
+
{
|
|
9188
|
+
id: "compound-v3.withdraw",
|
|
9189
|
+
protocolId: COMPOUND_V3_PROTOCOL_ID,
|
|
9190
|
+
chainCategory: "evm",
|
|
9191
|
+
description: "Withdraw collateral or base (withdraw of base while undercollateralized = borrow)",
|
|
9192
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
9193
|
+
params: {}
|
|
9194
|
+
},
|
|
9195
|
+
{
|
|
9196
|
+
id: "compound-v3.repay",
|
|
9197
|
+
protocolId: COMPOUND_V3_PROTOCOL_ID,
|
|
9198
|
+
chainCategory: "evm",
|
|
9199
|
+
description: "Repay base debt by supplying base",
|
|
9200
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
9201
|
+
params: {}
|
|
9202
|
+
},
|
|
9203
|
+
{
|
|
9204
|
+
id: "compound-v3.claim-rewards",
|
|
9205
|
+
protocolId: COMPOUND_V3_PROTOCOL_ID,
|
|
9206
|
+
chainCategory: "evm",
|
|
9207
|
+
description: "Claim COMP / reward token from CometRewards",
|
|
9208
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
9209
|
+
params: {}
|
|
9210
|
+
},
|
|
9211
|
+
{
|
|
9212
|
+
id: "compound-v3.bulker",
|
|
9213
|
+
protocolId: COMPOUND_V3_PROTOCOL_ID,
|
|
9214
|
+
chainCategory: "evm",
|
|
9215
|
+
description: "Combined Bulker.invoke (optional)",
|
|
9216
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
9217
|
+
params: {}
|
|
9218
|
+
}
|
|
9219
|
+
]
|
|
9220
|
+
};
|
|
9221
|
+
registerProtocolModule(compoundV3ProtocolModule);
|
|
7495
9222
|
var skillsDir = path.join(path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('catalog.cjs', document.baseURI).href)))), "skills");
|
|
7496
9223
|
var SKILL_PROTOCOL_IDS = [
|
|
7497
9224
|
"aave-v4",
|
|
@@ -7507,7 +9234,9 @@ var SKILL_PROTOCOL_IDS = [
|
|
|
7507
9234
|
"arcus",
|
|
7508
9235
|
"morpho",
|
|
7509
9236
|
"circle-cctp",
|
|
7510
|
-
"
|
|
9237
|
+
"aerodrome",
|
|
9238
|
+
"continuum-dao",
|
|
9239
|
+
"compound-v3"
|
|
7511
9240
|
];
|
|
7512
9241
|
function getToolsForProtocol(protocolId) {
|
|
7513
9242
|
return MCP_TOOL_DEFINITIONS.filter((t) => t.protocolId === protocolId);
|
|
@@ -7556,23 +9285,44 @@ function getProtocolDiscoverySummary(protocolId) {
|
|
|
7556
9285
|
};
|
|
7557
9286
|
}
|
|
7558
9287
|
init_support();
|
|
7559
|
-
var EULER_V2_SUBGRAPH_CHAIN_IDS = [
|
|
7560
|
-
1,
|
|
7561
|
-
8453,
|
|
7562
|
-
42161,
|
|
7563
|
-
10,
|
|
7564
|
-
137,
|
|
7565
|
-
56,
|
|
7566
|
-
43114,
|
|
7567
|
-
100,
|
|
7568
|
-
59144,
|
|
7569
|
-
146,
|
|
7570
|
-
1923,
|
|
7571
|
-
130
|
|
7572
|
-
];
|
|
7573
9288
|
function advisor(protocolId, tokenFilter, impl) {
|
|
7574
9289
|
return { protocolId, tokenFilter, ...impl };
|
|
7575
9290
|
}
|
|
9291
|
+
function aerodromeAdvisorPriorityTokens() {
|
|
9292
|
+
return [
|
|
9293
|
+
{
|
|
9294
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
9295
|
+
symbol: "ETH",
|
|
9296
|
+
decimals: 18,
|
|
9297
|
+
roles: ["native"]
|
|
9298
|
+
},
|
|
9299
|
+
{
|
|
9300
|
+
address: AERODROME_WETH_BASE,
|
|
9301
|
+
symbol: "WETH",
|
|
9302
|
+
decimals: 18,
|
|
9303
|
+
roles: ["native_wrapped"]
|
|
9304
|
+
},
|
|
9305
|
+
{
|
|
9306
|
+
address: AERODROME_USDC_BASE,
|
|
9307
|
+
symbol: "USDC",
|
|
9308
|
+
decimals: 6,
|
|
9309
|
+
roles: ["swappable", "listed"]
|
|
9310
|
+
},
|
|
9311
|
+
{
|
|
9312
|
+
address: AERODROME_BASE_ADDRESSES_FALLBACK.aero,
|
|
9313
|
+
symbol: "AERO",
|
|
9314
|
+
decimals: 18,
|
|
9315
|
+
roles: ["swappable"]
|
|
9316
|
+
},
|
|
9317
|
+
...AERODROME_COINBASE_STOCK_TOKENS.map((t) => ({
|
|
9318
|
+
address: t.address,
|
|
9319
|
+
symbol: t.symbol,
|
|
9320
|
+
name: t.name,
|
|
9321
|
+
decimals: AERODROME_COINBASE_STOCK_DECIMALS,
|
|
9322
|
+
roles: ["swappable", "listed", "coinbase_b20"]
|
|
9323
|
+
}))
|
|
9324
|
+
];
|
|
9325
|
+
}
|
|
7576
9326
|
var PROTOCOL_SUPPORT_ADVISORS = {
|
|
7577
9327
|
"aave-v4": advisor("aave-v4", "api_underlyings", {
|
|
7578
9328
|
async supportedChainIds() {
|
|
@@ -7768,13 +9518,34 @@ var PROTOCOL_SUPPORT_ADVISORS = {
|
|
|
7768
9518
|
}),
|
|
7769
9519
|
"euler-v2": advisor("euler-v2", "subgraph_vaults", {
|
|
7770
9520
|
async supportedChainIds() {
|
|
7771
|
-
|
|
9521
|
+
const set = await loadEulerV2SupportedChainIds();
|
|
9522
|
+
return [...set].sort((a, b) => a - b);
|
|
7772
9523
|
},
|
|
7773
|
-
async supportedTokens() {
|
|
9524
|
+
async supportedTokens(chainId) {
|
|
9525
|
+
const cache = await ensureEulerV2ChainAssetCache(chainId);
|
|
9526
|
+
const tokens = [...cache.modesByUnderlying.entries()].map(([address, modes]) => ({
|
|
9527
|
+
address,
|
|
9528
|
+
roles: [
|
|
9529
|
+
...modes.lend ? ["vault_underlying"] : [],
|
|
9530
|
+
...modes.borrow ? ["loan"] : [],
|
|
9531
|
+
...modes.earn ? ["earn"] : []
|
|
9532
|
+
]
|
|
9533
|
+
}));
|
|
7774
9534
|
return {
|
|
7775
|
-
tokens
|
|
7776
|
-
|
|
9535
|
+
tokens,
|
|
9536
|
+
nativeWrapped: cache.nativeWrapped ?? void 0,
|
|
9537
|
+
notes: "Euler EVK vault underlyings and Earn vault assets from the Goldsky subgraph. Use address as underlyingAddress for ctm_euler_v2_fetch_lend_vaults."
|
|
7777
9538
|
};
|
|
9539
|
+
},
|
|
9540
|
+
async isTokenSupported(chainId, address) {
|
|
9541
|
+
const cache = await ensureEulerV2ChainAssetCache(chainId);
|
|
9542
|
+
let normalized;
|
|
9543
|
+
try {
|
|
9544
|
+
normalized = viem.getAddress(address).toLowerCase();
|
|
9545
|
+
} catch {
|
|
9546
|
+
return false;
|
|
9547
|
+
}
|
|
9548
|
+
return cache.modesByUnderlying.has(normalized);
|
|
7778
9549
|
}
|
|
7779
9550
|
}),
|
|
7780
9551
|
[MAPLE_PROTOCOL_ID]: advisor(MAPLE_PROTOCOL_ID, "fixed_addresses", {
|
|
@@ -7839,6 +9610,21 @@ var PROTOCOL_SUPPORT_ADVISORS = {
|
|
|
7839
9610
|
};
|
|
7840
9611
|
}
|
|
7841
9612
|
}),
|
|
9613
|
+
[AERODROME_PROTOCOL_ID]: advisor(AERODROME_PROTOCOL_ID, "pool_graph", {
|
|
9614
|
+
async supportedChainIds() {
|
|
9615
|
+
return [AERODROME_CHAIN_ID];
|
|
9616
|
+
},
|
|
9617
|
+
async supportedTokens(chainId) {
|
|
9618
|
+
if (chainId !== AERODROME_CHAIN_ID) {
|
|
9619
|
+
return { tokens: [], notes: "Aerodrome is Base-only (chainId 8453)." };
|
|
9620
|
+
}
|
|
9621
|
+
return {
|
|
9622
|
+
tokens: aerodromeAdvisorPriorityTokens(),
|
|
9623
|
+
nativeWrapped: AERODROME_WETH_BASE,
|
|
9624
|
+
notes: "Slim directory: ETH, WETH, USDC, AERO, and Coinbase B20 stocks (AAPLc, \u2026). For a price call ctm_aerodrome_quote with tickers. To see pools for one token call ctm_aerodrome_discover_pools. Do not dump LpSugar."
|
|
9625
|
+
};
|
|
9626
|
+
}
|
|
9627
|
+
}),
|
|
7842
9628
|
[VENICE_PROTOCOL_ID]: advisor(VENICE_PROTOCOL_ID, "fixed_addresses", {
|
|
7843
9629
|
async supportedChainIds() {
|
|
7844
9630
|
return [VENICE_BASE_CHAIN_ID];
|
|
@@ -7877,6 +9663,54 @@ var PROTOCOL_SUPPORT_ADVISORS = {
|
|
|
7877
9663
|
};
|
|
7878
9664
|
}
|
|
7879
9665
|
}),
|
|
9666
|
+
[COMPOUND_V3_PROTOCOL_ID]: advisor(COMPOUND_V3_PROTOCOL_ID, "api_underlyings", {
|
|
9667
|
+
async supportedChainIds() {
|
|
9668
|
+
return listCompoundV3SupportedChainIds();
|
|
9669
|
+
},
|
|
9670
|
+
async supportedTokens(chainId, ctx) {
|
|
9671
|
+
const cache = await ensureCompoundV3ChainAssetCache({ chainId, rpcUrl: ctx?.rpcUrl });
|
|
9672
|
+
const nativeWrapped = compoundV3WrappedNative(chainId);
|
|
9673
|
+
const tokens = [];
|
|
9674
|
+
if (nativeWrapped) {
|
|
9675
|
+
tokens.push({
|
|
9676
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
9677
|
+
symbol: "ETH",
|
|
9678
|
+
decimals: 18,
|
|
9679
|
+
roles: ["native"]
|
|
9680
|
+
});
|
|
9681
|
+
tokens.push({
|
|
9682
|
+
address: nativeWrapped,
|
|
9683
|
+
symbol: "WETH",
|
|
9684
|
+
roles: ["native_wrapped"]
|
|
9685
|
+
});
|
|
9686
|
+
}
|
|
9687
|
+
for (const [address, modes] of cache) {
|
|
9688
|
+
if (nativeWrapped && address === nativeWrapped.toLowerCase()) continue;
|
|
9689
|
+
tokens.push({
|
|
9690
|
+
address,
|
|
9691
|
+
roles: [...modes.base ? ["base"] : [], ...modes.collateral ? ["collateral"] : []]
|
|
9692
|
+
});
|
|
9693
|
+
}
|
|
9694
|
+
return {
|
|
9695
|
+
tokens,
|
|
9696
|
+
nativeWrapped: nativeWrapped ?? void 0,
|
|
9697
|
+
notes: "Compound III Comet base and collateral tokens. Native ETH uses wrapped native (automatic wrap/unwrap). Pass comet from ctm_compound_v3_fetch_markets."
|
|
9698
|
+
};
|
|
9699
|
+
},
|
|
9700
|
+
async isTokenSupported(chainId, address, ctx) {
|
|
9701
|
+
const cache = await ensureCompoundV3ChainAssetCache({ chainId, rpcUrl: ctx?.rpcUrl });
|
|
9702
|
+
let normalized;
|
|
9703
|
+
try {
|
|
9704
|
+
normalized = viem.getAddress(address).toLowerCase();
|
|
9705
|
+
} catch {
|
|
9706
|
+
return false;
|
|
9707
|
+
}
|
|
9708
|
+
if (normalized === "0x0000000000000000000000000000000000000000") return true;
|
|
9709
|
+
const wrapped = compoundV3WrappedNative(chainId);
|
|
9710
|
+
if (wrapped && wrapped.toLowerCase() === normalized) return true;
|
|
9711
|
+
return cache.has(normalized);
|
|
9712
|
+
}
|
|
9713
|
+
}),
|
|
7880
9714
|
arcus: advisor("arcus", "api_underlyings", {
|
|
7881
9715
|
async supportedChainIds() {
|
|
7882
9716
|
return [...ARCUS_SUPPORTED_CHAIN_IDS];
|
|
@@ -7911,7 +9745,9 @@ registerProtocolModule(arcusProtocolModule);
|
|
|
7911
9745
|
registerProtocolModule(morphoProtocolModule);
|
|
7912
9746
|
registerProtocolModule(circleCctpProtocolModule);
|
|
7913
9747
|
registerProtocolModule(veniceProtocolModule);
|
|
9748
|
+
registerProtocolModule(aerodromeProtocolModule);
|
|
7914
9749
|
registerProtocolModule(continuumDaoProtocolModule);
|
|
9750
|
+
registerProtocolModule(compoundV3ProtocolModule);
|
|
7915
9751
|
function getAgentCatalog() {
|
|
7916
9752
|
return {
|
|
7917
9753
|
protocols: getProtocolModules(),
|
|
@@ -7934,7 +9770,9 @@ function getAgentCatalog() {
|
|
|
7934
9770
|
morpho: morphoProtocolModule,
|
|
7935
9771
|
circleCctp: circleCctpProtocolModule,
|
|
7936
9772
|
venice: veniceProtocolModule,
|
|
9773
|
+
aerodrome: aerodromeProtocolModule,
|
|
7937
9774
|
continuumDao: continuumDaoProtocolModule,
|
|
9775
|
+
compoundV3: compoundV3ProtocolModule,
|
|
7938
9776
|
/** Prefer getAgentCatalogForMcp() or getMcpToolDefinitions() for MCP servers. */
|
|
7939
9777
|
mcp: getAgentCatalogForMcp()
|
|
7940
9778
|
};
|
|
@@ -7972,6 +9810,30 @@ exports.mcpAaveV4BorrowInputSchema = mcpAaveV4BorrowInputSchema;
|
|
|
7972
9810
|
exports.mcpAaveV4DepositInputSchema = mcpAaveV4DepositInputSchema;
|
|
7973
9811
|
exports.mcpAaveV4RepayInputSchema = mcpAaveV4RepayInputSchema;
|
|
7974
9812
|
exports.mcpAaveV4WithdrawInputSchema = mcpAaveV4WithdrawInputSchema;
|
|
9813
|
+
exports.mcpAerodromeBuildAddLiquidityMultisignInputSchema = mcpAerodromeBuildAddLiquidityMultisignInputSchema;
|
|
9814
|
+
exports.mcpAerodromeBuildClBurnMultisignInputSchema = mcpAerodromeBuildClBurnMultisignInputSchema;
|
|
9815
|
+
exports.mcpAerodromeBuildClCollectFeesMultisignInputSchema = mcpAerodromeBuildClCollectFeesMultisignInputSchema;
|
|
9816
|
+
exports.mcpAerodromeBuildClDecreaseMultisignInputSchema = mcpAerodromeBuildClDecreaseMultisignInputSchema;
|
|
9817
|
+
exports.mcpAerodromeBuildClIncreaseMultisignInputSchema = mcpAerodromeBuildClIncreaseMultisignInputSchema;
|
|
9818
|
+
exports.mcpAerodromeBuildClMintMultisignInputSchema = mcpAerodromeBuildClMintMultisignInputSchema;
|
|
9819
|
+
exports.mcpAerodromeBuildClaimEmissionsMultisignInputSchema = mcpAerodromeBuildClaimEmissionsMultisignInputSchema;
|
|
9820
|
+
exports.mcpAerodromeBuildClaimFeesMultisignInputSchema = mcpAerodromeBuildClaimFeesMultisignInputSchema;
|
|
9821
|
+
exports.mcpAerodromeBuildGaugeStakeMultisignInputSchema = mcpAerodromeBuildGaugeStakeMultisignInputSchema;
|
|
9822
|
+
exports.mcpAerodromeBuildGaugeUnstakeMultisignInputSchema = mcpAerodromeBuildGaugeUnstakeMultisignInputSchema;
|
|
9823
|
+
exports.mcpAerodromeBuildRemoveLiquidityMultisignInputSchema = mcpAerodromeBuildRemoveLiquidityMultisignInputSchema;
|
|
9824
|
+
exports.mcpAerodromeBuildSwapMultisignInputSchema = mcpAerodromeBuildSwapMultisignInputSchema;
|
|
9825
|
+
exports.mcpAerodromeDiscoverPoolsInputSchema = mcpAerodromeDiscoverPoolsInputSchema;
|
|
9826
|
+
exports.mcpAerodromeDiscoverPoolsOutputSchema = mcpAerodromeDiscoverPoolsOutputSchema;
|
|
9827
|
+
exports.mcpAerodromeFetchPoolsInputSchema = mcpAerodromeFetchPoolsInputSchema;
|
|
9828
|
+
exports.mcpAerodromeFetchPoolsOutputSchema = mcpAerodromeFetchPoolsOutputSchema;
|
|
9829
|
+
exports.mcpAerodromeFetchPositionsInputSchema = mcpAerodromeFetchPositionsInputSchema;
|
|
9830
|
+
exports.mcpAerodromeFetchPositionsOutputSchema = mcpAerodromeFetchPositionsOutputSchema;
|
|
9831
|
+
exports.mcpAerodromeQuoteAddLiquidityInputSchema = mcpAerodromeQuoteAddLiquidityInputSchema;
|
|
9832
|
+
exports.mcpAerodromeQuoteAddLiquidityOutputSchema = mcpAerodromeQuoteAddLiquidityOutputSchema;
|
|
9833
|
+
exports.mcpAerodromeQuoteClDepositInputSchema = mcpAerodromeQuoteClDepositInputSchema;
|
|
9834
|
+
exports.mcpAerodromeQuoteClDepositOutputSchema = mcpAerodromeQuoteClDepositOutputSchema;
|
|
9835
|
+
exports.mcpAerodromeQuoteInputSchema = mcpAerodromeQuoteInputSchema;
|
|
9836
|
+
exports.mcpAerodromeQuoteOutputSchema = mcpAerodromeQuoteOutputSchema;
|
|
7975
9837
|
exports.mcpArcusBuildCancelOrderMultisignInputSchema = mcpArcusBuildCancelOrderMultisignInputSchema;
|
|
7976
9838
|
exports.mcpArcusBuildCloseMultisignInputSchema = mcpArcusBuildCloseMultisignInputSchema;
|
|
7977
9839
|
exports.mcpArcusBuildCreateApiKeyMultisignInputSchema = mcpArcusBuildCreateApiKeyMultisignInputSchema;
|
|
@@ -8002,6 +9864,17 @@ exports.mcpArcusSpotFetchMarketsInputSchema = mcpArcusSpotFetchMarketsInputSchem
|
|
|
8002
9864
|
exports.mcpArcusSpotFetchMarketsOutputSchema = mcpArcusSpotFetchMarketsOutputSchema;
|
|
8003
9865
|
exports.mcpArcusSpotFetchOhlcvInputSchema = mcpArcusSpotFetchOhlcvInputSchema;
|
|
8004
9866
|
exports.mcpArcusSpotFetchOhlcvOutputSchema = mcpArcusSpotFetchOhlcvOutputSchema;
|
|
9867
|
+
exports.mcpCompoundV3BulkerInputSchema = mcpCompoundV3BulkerInputSchema;
|
|
9868
|
+
exports.mcpCompoundV3ClaimRewardsInputSchema = mcpCompoundV3ClaimRewardsInputSchema;
|
|
9869
|
+
exports.mcpCompoundV3FetchAccountInputSchema = mcpCompoundV3FetchAccountInputSchema;
|
|
9870
|
+
exports.mcpCompoundV3FetchAccountOutputSchema = mcpCompoundV3FetchAccountOutputSchema;
|
|
9871
|
+
exports.mcpCompoundV3FetchMarketInputSchema = mcpCompoundV3FetchMarketInputSchema;
|
|
9872
|
+
exports.mcpCompoundV3FetchMarketOutputSchema = mcpCompoundV3FetchMarketOutputSchema;
|
|
9873
|
+
exports.mcpCompoundV3FetchMarketsInputSchema = mcpCompoundV3FetchMarketsInputSchema;
|
|
9874
|
+
exports.mcpCompoundV3FetchMarketsOutputSchema = mcpCompoundV3FetchMarketsOutputSchema;
|
|
9875
|
+
exports.mcpCompoundV3RepayInputSchema = mcpCompoundV3RepayInputSchema;
|
|
9876
|
+
exports.mcpCompoundV3SupplyInputSchema = mcpCompoundV3SupplyInputSchema;
|
|
9877
|
+
exports.mcpCompoundV3WithdrawInputSchema = mcpCompoundV3WithdrawInputSchema;
|
|
8005
9878
|
exports.mcpContinuumDaoAttachInputSchema = mcpContinuumDaoAttachInputSchema;
|
|
8006
9879
|
exports.mcpContinuumDaoCastVoteBravoInputSchema = mcpContinuumDaoCastVoteBravoInputSchema;
|
|
8007
9880
|
exports.mcpContinuumDaoCastVoteDeltaInputSchema = mcpContinuumDaoCastVoteDeltaInputSchema;
|
|
@@ -8166,13 +10039,17 @@ exports.mcpMorphoFetchEarnVaultsInputSchema = mcpMorphoFetchEarnVaultsInputSchem
|
|
|
8166
10039
|
exports.mcpMorphoFetchEarnVaultsOutputSchema = mcpMorphoFetchEarnVaultsOutputSchema;
|
|
8167
10040
|
exports.mcpMorphoFetchMidnightBooksInputSchema = mcpMorphoFetchMidnightBooksInputSchema;
|
|
8168
10041
|
exports.mcpMorphoFetchMidnightBooksOutputSchema = mcpMorphoFetchMidnightBooksOutputSchema;
|
|
10042
|
+
exports.mcpMorphoFetchMidnightOffersInputSchema = mcpMorphoFetchMidnightOffersInputSchema;
|
|
10043
|
+
exports.mcpMorphoFetchMidnightOffersOutputSchema = mcpMorphoFetchMidnightOffersOutputSchema;
|
|
8169
10044
|
exports.mcpMorphoFetchMidnightPositionsInputSchema = mcpMorphoFetchMidnightPositionsInputSchema;
|
|
8170
10045
|
exports.mcpMorphoFetchMidnightPositionsOutputSchema = mcpMorphoFetchMidnightPositionsOutputSchema;
|
|
8171
10046
|
exports.mcpMorphoFetchMidnightQuoteInputSchema = mcpMorphoFetchMidnightQuoteInputSchema;
|
|
8172
10047
|
exports.mcpMorphoFetchMidnightQuoteOutputSchema = mcpMorphoFetchMidnightQuoteOutputSchema;
|
|
8173
10048
|
exports.mcpMorphoMerklClaimInputSchema = mcpMorphoMerklClaimInputSchema;
|
|
8174
10049
|
exports.mcpMorphoMidnightBorrowInputSchema = mcpMorphoMidnightBorrowInputSchema;
|
|
10050
|
+
exports.mcpMorphoMidnightCancelLendOfferInputSchema = mcpMorphoMidnightCancelLendOfferInputSchema;
|
|
8175
10051
|
exports.mcpMorphoMidnightLendInputSchema = mcpMorphoMidnightLendInputSchema;
|
|
10052
|
+
exports.mcpMorphoMidnightLendOfferInputSchema = mcpMorphoMidnightLendOfferInputSchema;
|
|
8176
10053
|
exports.mcpMorphoMidnightRepayInputSchema = mcpMorphoMidnightRepayInputSchema;
|
|
8177
10054
|
exports.mcpMorphoVaultDepositInputSchema = mcpMorphoVaultDepositInputSchema;
|
|
8178
10055
|
exports.mcpMorphoVaultWithdrawInputSchema = mcpMorphoVaultWithdrawInputSchema;
|