@continuumdao/ctm-mpc-defi 0.2.42 → 0.2.44
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 +352 -36
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +1542 -236
- package/dist/agent/catalog.js +343 -37
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/aave-v4/SKILL.md +9 -1
- package/dist/agent/skills/aerodrome/SKILL.md +1 -1
- package/dist/agent/skills/arcus/SKILL.md +1 -1
- package/dist/agent/skills/euler-v2/SKILL.md +9 -0
- package/dist/agent/skills/morpho/SKILL.md +39 -6
- package/dist/agent/skills/yield-compare/SKILL.md +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/merklDistributor-CdqtZC9N.d.ts +65 -0
- package/dist/multisign-Dr0j9fHm.d.ts +489 -0
- package/dist/protocols/evm/aave-v4/index.cjs +207 -2
- package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/aave-v4/index.d.ts +12 -467
- package/dist/protocols/evm/aave-v4/index.js +192 -3
- package/dist/protocols/evm/aave-v4/index.js.map +1 -1
- package/dist/protocols/evm/aerodrome/index.cjs +67 -48
- package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
- package/dist/protocols/evm/aerodrome/index.d.ts +8 -8
- package/dist/protocols/evm/aerodrome/index.js +82 -63
- package/dist/protocols/evm/aerodrome/index.js.map +1 -1
- package/dist/protocols/evm/euler-v2/index.cjs +209 -1
- package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
- package/dist/protocols/evm/euler-v2/index.d.ts +9 -1
- package/dist/protocols/evm/euler-v2/index.js +208 -2
- package/dist/protocols/evm/euler-v2/index.js.map +1 -1
- package/dist/protocols/evm/morpho/index.cjs +610 -56
- package/dist/protocols/evm/morpho/index.cjs.map +1 -1
- package/dist/protocols/evm/morpho/index.d.ts +131 -2
- package/dist/protocols/evm/morpho/index.js +573 -58
- package/dist/protocols/evm/morpho/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -412,6 +412,10 @@ function formatMorphoUsd(n) {
|
|
|
412
412
|
if (n >= 1e3) return `$${(n / 1e3).toFixed(2)}K`;
|
|
413
413
|
return `$${n.toFixed(2)}`;
|
|
414
414
|
}
|
|
415
|
+
function formatMorphoUtilizationPct(n) {
|
|
416
|
+
if (n == null || !Number.isFinite(n)) return "\u2014";
|
|
417
|
+
return `${(n * 100).toFixed(1)}%`;
|
|
418
|
+
}
|
|
415
419
|
function marketParamsFromApiRow(row) {
|
|
416
420
|
const loanToken = viem.getAddress(row.loanAsset.address ?? "");
|
|
417
421
|
const collateralToken = viem.getAddress(row.collateralAsset.address ?? "");
|
|
@@ -1263,6 +1267,20 @@ async function morphoResolveListedEarnVaultByAddress(args) {
|
|
|
1263
1267
|
const hit = rows.find((r) => r.vaultAddress.toLowerCase() === viem.getAddress(addr).toLowerCase());
|
|
1264
1268
|
return hit ?? null;
|
|
1265
1269
|
}
|
|
1270
|
+
var MARKET_ITEM_FIELDS = `
|
|
1271
|
+
marketId
|
|
1272
|
+
loanAsset { address symbol decimals price { usd } }
|
|
1273
|
+
collateralAsset { address symbol decimals price { usd } }
|
|
1274
|
+
lltv
|
|
1275
|
+
oracle { address }
|
|
1276
|
+
irmAddress
|
|
1277
|
+
morphoBlue { address }
|
|
1278
|
+
state {
|
|
1279
|
+
supplyApy borrowApy netSupplyApy netBorrowApy
|
|
1280
|
+
supplyAssetsUsd borrowAssetsUsd collateralAssetsUsd utilization
|
|
1281
|
+
rewards { supplyApr borrowApr asset { address symbol } }
|
|
1282
|
+
}
|
|
1283
|
+
`;
|
|
1266
1284
|
function lltvToPctLabel(lltv) {
|
|
1267
1285
|
try {
|
|
1268
1286
|
const wad = BigInt(lltv);
|
|
@@ -1274,28 +1292,34 @@ function lltvToPctLabel(lltv) {
|
|
|
1274
1292
|
}
|
|
1275
1293
|
}
|
|
1276
1294
|
async function fetchMorphoMarketsForChain(chainId, first = 200) {
|
|
1295
|
+
return fetchMorphoMarketsWhere({ chainId, first });
|
|
1296
|
+
}
|
|
1297
|
+
async function fetchMorphoMarketsWhere(args) {
|
|
1298
|
+
const first = args.first ?? 200;
|
|
1299
|
+
const collateralIn = (args.collateralAddresses ?? []).filter((a) => viem.isAddress(a)).map((a) => viem.getAddress(a));
|
|
1300
|
+
const loanIn = (args.loanAddresses ?? []).filter((a) => viem.isAddress(a)).map((a) => viem.getAddress(a));
|
|
1301
|
+
let whereClause = "chainId_in: [$chainId]";
|
|
1302
|
+
const variables = { chainId: args.chainId, first };
|
|
1303
|
+
if (collateralIn.length) {
|
|
1304
|
+
whereClause += ", collateralAssetAddress_in: $collateralIn";
|
|
1305
|
+
variables.collateralIn = collateralIn;
|
|
1306
|
+
}
|
|
1307
|
+
if (loanIn.length) {
|
|
1308
|
+
whereClause += ", loanAssetAddress_in: $loanIn";
|
|
1309
|
+
variables.loanIn = loanIn;
|
|
1310
|
+
}
|
|
1311
|
+
const varDecls = ["$chainId: Int!", "$first: Int!"];
|
|
1312
|
+
if (collateralIn.length) varDecls.push("$collateralIn: [String!]");
|
|
1313
|
+
if (loanIn.length) varDecls.push("$loanIn: [String!]");
|
|
1277
1314
|
const d = await morphoGql(
|
|
1278
1315
|
`
|
|
1279
|
-
query MorphoMarkets($
|
|
1280
|
-
markets(first: $first, where: {
|
|
1281
|
-
items {
|
|
1282
|
-
marketId
|
|
1283
|
-
loanAsset { address symbol decimals price { usd } }
|
|
1284
|
-
collateralAsset { address symbol decimals price { usd } }
|
|
1285
|
-
lltv
|
|
1286
|
-
oracle { address }
|
|
1287
|
-
irmAddress
|
|
1288
|
-
morphoBlue { address }
|
|
1289
|
-
state {
|
|
1290
|
-
supplyApy borrowApy netSupplyApy netBorrowApy
|
|
1291
|
-
supplyAssetsUsd borrowAssetsUsd collateralAssetsUsd utilization
|
|
1292
|
-
rewards { supplyApr borrowApr asset { address symbol } }
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1316
|
+
query MorphoMarkets(${varDecls.join(", ")}) {
|
|
1317
|
+
markets(first: $first, where: { ${whereClause} }, orderBy: BorrowAssetsUsd, orderDirection: Desc) {
|
|
1318
|
+
items { ${MARKET_ITEM_FIELDS} }
|
|
1295
1319
|
}
|
|
1296
1320
|
}
|
|
1297
1321
|
`,
|
|
1298
|
-
|
|
1322
|
+
variables
|
|
1299
1323
|
);
|
|
1300
1324
|
return d.markets?.items ?? [];
|
|
1301
1325
|
}
|
|
@@ -1323,35 +1347,167 @@ function morphoMarketToBorrowRow(m) {
|
|
|
1323
1347
|
supplyAprLabel: formatMorphoApyPct(r.supplyApr)
|
|
1324
1348
|
})).filter((r) => r.supplyAprLabel !== "\u2014"),
|
|
1325
1349
|
borrowAssetsUsdLabel: formatMorphoUsd(m.state?.borrowAssetsUsd),
|
|
1350
|
+
supplyAssetsUsdLabel: formatMorphoUsd(m.state?.supplyAssetsUsd),
|
|
1351
|
+
utilizationLabel: formatMorphoUtilizationPct(m.state?.utilization),
|
|
1326
1352
|
lltvLabel: lltvToPctLabel(m.lltv),
|
|
1327
1353
|
marketLabel: `${colSym}/${loanSym}`
|
|
1328
1354
|
};
|
|
1329
1355
|
}
|
|
1330
|
-
|
|
1331
|
-
const key = morphoKeyForAssetRow({ contractAddress: args.collateralAddress });
|
|
1332
|
-
if (!key) return [];
|
|
1333
|
-
const markets = await fetchMorphoMarketsForChain(args.chainId, 300);
|
|
1356
|
+
function rowsFromApi(items) {
|
|
1334
1357
|
const out = [];
|
|
1335
|
-
for (const m of
|
|
1336
|
-
const col = (m.collateralAsset?.address ?? "").trim().toLowerCase();
|
|
1337
|
-
if (!col || col !== key) continue;
|
|
1358
|
+
for (const m of items) {
|
|
1338
1359
|
const row = morphoMarketToBorrowRow(m);
|
|
1339
1360
|
if (row) out.push(row);
|
|
1340
1361
|
}
|
|
1341
1362
|
return out;
|
|
1342
1363
|
}
|
|
1364
|
+
async function fetchMorphoBorrowMarketsForCollateral(args) {
|
|
1365
|
+
const key = morphoKeyForAssetRow({ contractAddress: args.collateralAddress });
|
|
1366
|
+
if (!key) return [];
|
|
1367
|
+
const markets = await fetchMorphoMarketsWhere({
|
|
1368
|
+
chainId: args.chainId,
|
|
1369
|
+
first: 100,
|
|
1370
|
+
collateralAddresses: [key]
|
|
1371
|
+
});
|
|
1372
|
+
return rowsFromApi(markets);
|
|
1373
|
+
}
|
|
1343
1374
|
async function fetchMorphoBorrowMarketsForLoan(args) {
|
|
1344
1375
|
const key = morphoKeyForAssetRow({ contractAddress: args.loanAddress });
|
|
1345
1376
|
if (!key) return [];
|
|
1346
|
-
const markets = await
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1377
|
+
const markets = await fetchMorphoMarketsWhere({
|
|
1378
|
+
chainId: args.chainId,
|
|
1379
|
+
first: 200,
|
|
1380
|
+
loanAddresses: [key]
|
|
1381
|
+
});
|
|
1382
|
+
return rowsFromApi(markets);
|
|
1383
|
+
}
|
|
1384
|
+
async function fetchMorphoBorrowMarketsForCollaterals(args) {
|
|
1385
|
+
const addrs = args.collateralAddresses.filter((a) => viem.isAddress(a));
|
|
1386
|
+
if (!addrs.length) return [];
|
|
1387
|
+
const markets = await fetchMorphoMarketsWhere({
|
|
1388
|
+
chainId: args.chainId,
|
|
1389
|
+
first: 200,
|
|
1390
|
+
collateralAddresses: addrs
|
|
1391
|
+
});
|
|
1392
|
+
return rowsFromApi(markets);
|
|
1393
|
+
}
|
|
1394
|
+
var COINBASE_B20_STOCK_TOKENS = [
|
|
1395
|
+
{ symbol: "AAPLc", name: "Apple Inc.", address: "0xb200000000000000000000C2e324d24d7eEcd1fb" },
|
|
1396
|
+
{ symbol: "NVDAc", name: "NVIDIA Corporation", address: "0xb20000000000000000000078ee7ce2fE4908108C" },
|
|
1397
|
+
{ symbol: "METAc", name: "Meta Platforms Inc.", address: "0xb2000000000000000000008bC8786B856E61707C" },
|
|
1398
|
+
{ symbol: "GOOGLc", name: "Alphabet Inc.", address: "0xb2000000000000000000002D0BA3164cc74f58B7" },
|
|
1399
|
+
{ symbol: "AMZNc", name: "Amazon.com Inc.", address: "0xb200000000000000000000d9192b6B456483C2E8" },
|
|
1400
|
+
{ symbol: "TSLAc", name: "Tesla Inc.", address: "0xb2000000000000000000001e800a7f5189430cD0" },
|
|
1401
|
+
{ symbol: "MSFTc", name: "Microsoft Corporation", address: "0xB200000000000000000000Ab99cFa739E253872B" },
|
|
1402
|
+
{ symbol: "COINc", name: "Coinbase Global Inc.", address: "0xb200000000000000000000c85a31389D71F3ecfb" },
|
|
1403
|
+
{ symbol: "MSTRc", name: "Strategy Inc.", address: "0xb2000000000000000000004884b426556b92883d" },
|
|
1404
|
+
{ symbol: "CRCLc", name: "Circle Internet Group Inc.", address: "0xB20000000000000000000019f6E7C675b73C2e4D" },
|
|
1405
|
+
{ symbol: "INTCc", name: "Intel Corporation", address: "0xB2000000000000000000004AFF16039bA04bdFBc" },
|
|
1406
|
+
{ symbol: "SNDKc", name: "Sandisk Corporation", address: "0xb200000000000000000000397293Cb8cda9a10c5" },
|
|
1407
|
+
{ symbol: "SPCXc", name: "Space Exploration Technologies Corp.", address: "0xb2000000000000000000007b9fcbd005511aCBd5" }
|
|
1408
|
+
];
|
|
1409
|
+
var COINBASE_B20_STOCK_DECIMALS = 8;
|
|
1410
|
+
var COINBASE_B20_ASSET_PREFIX = "0xb200000000000000000000";
|
|
1411
|
+
function isCoinbaseB20AssetToken(address) {
|
|
1412
|
+
try {
|
|
1413
|
+
return viem.getAddress(address).toLowerCase().startsWith(COINBASE_B20_ASSET_PREFIX);
|
|
1414
|
+
} catch {
|
|
1415
|
+
return false;
|
|
1353
1416
|
}
|
|
1354
|
-
|
|
1417
|
+
}
|
|
1418
|
+
function looksLikeCoinbaseStockSymbol(symbol) {
|
|
1419
|
+
return /^[A-Za-z][A-Za-z0-9]{0,10}c$/.test((symbol ?? "").trim());
|
|
1420
|
+
}
|
|
1421
|
+
function coinbaseB20StockAddresses() {
|
|
1422
|
+
return COINBASE_B20_STOCK_TOKENS.map((t) => viem.getAddress(t.address));
|
|
1423
|
+
}
|
|
1424
|
+
function lookupCoinbaseB20StockToken(token) {
|
|
1425
|
+
const key = (token ?? "").trim();
|
|
1426
|
+
if (!key) return null;
|
|
1427
|
+
const lower = key.toLowerCase();
|
|
1428
|
+
const bySymbol = COINBASE_B20_STOCK_TOKENS.find((t) => t.symbol.toLowerCase() === lower);
|
|
1429
|
+
if (bySymbol) {
|
|
1430
|
+
return {
|
|
1431
|
+
address: viem.getAddress(bySymbol.address),
|
|
1432
|
+
symbol: bySymbol.symbol,
|
|
1433
|
+
decimals: COINBASE_B20_STOCK_DECIMALS
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
try {
|
|
1437
|
+
const address = viem.getAddress(key);
|
|
1438
|
+
const byAddr = COINBASE_B20_STOCK_TOKENS.find((t) => viem.getAddress(t.address).toLowerCase() === address.toLowerCase());
|
|
1439
|
+
if (byAddr) {
|
|
1440
|
+
return { address, symbol: byAddr.symbol, decimals: COINBASE_B20_STOCK_DECIMALS };
|
|
1441
|
+
}
|
|
1442
|
+
} catch {
|
|
1443
|
+
}
|
|
1444
|
+
return null;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
// src/protocols/evm/morpho/assetRef.ts
|
|
1448
|
+
var MORPHO_BASE_USDC = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
1449
|
+
var MORPHO_BASE_USDT = "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2";
|
|
1450
|
+
var MORPHO_ETHEREUM_USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
1451
|
+
var MORPHO_ETHEREUM_USDT = "0xdAC17F958D2ee523a2206206994597C13D831ec7";
|
|
1452
|
+
var MORPHO_ARC_USDC = "0x3600000000000000000000000000000000000000";
|
|
1453
|
+
var LOAN_TOKEN_BY_CHAIN = {
|
|
1454
|
+
8453: {
|
|
1455
|
+
usdc: viem.getAddress(MORPHO_BASE_USDC),
|
|
1456
|
+
usdt: viem.getAddress(MORPHO_BASE_USDT)
|
|
1457
|
+
},
|
|
1458
|
+
1: {
|
|
1459
|
+
usdc: viem.getAddress(MORPHO_ETHEREUM_USDC),
|
|
1460
|
+
usdt: viem.getAddress(MORPHO_ETHEREUM_USDT)
|
|
1461
|
+
},
|
|
1462
|
+
[ARC_MAINNET_CHAIN_ID]: {
|
|
1463
|
+
usdc: viem.getAddress(MORPHO_ARC_USDC)
|
|
1464
|
+
},
|
|
1465
|
+
[ARC_TESTNET_CHAIN_ID]: {
|
|
1466
|
+
usdc: viem.getAddress(MORPHO_ARC_USDC)
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
function isMorphoStockQuery(query) {
|
|
1470
|
+
const q = (query ?? "").trim().toLowerCase();
|
|
1471
|
+
if (!q) return false;
|
|
1472
|
+
return /^(stocks?|tokenized(\s+stocks?)?|coinbase(\s+stocks?)?)$/.test(q);
|
|
1473
|
+
}
|
|
1474
|
+
function resolveMorphoAssetRef(token, chainId) {
|
|
1475
|
+
const raw = (token ?? "").trim();
|
|
1476
|
+
if (!raw) return null;
|
|
1477
|
+
if (viem.isAddress(raw)) return viem.getAddress(raw);
|
|
1478
|
+
const stock = lookupCoinbaseB20StockToken(raw);
|
|
1479
|
+
if (stock) return stock.address;
|
|
1480
|
+
const loan = raw.toLowerCase();
|
|
1481
|
+
if (chainId != null && Number.isFinite(chainId)) {
|
|
1482
|
+
const mapped = LOAN_TOKEN_BY_CHAIN[chainId]?.[loan];
|
|
1483
|
+
if (mapped) return mapped;
|
|
1484
|
+
}
|
|
1485
|
+
return null;
|
|
1486
|
+
}
|
|
1487
|
+
function morphoB20CollateralAddresses() {
|
|
1488
|
+
return coinbaseB20StockAddresses();
|
|
1489
|
+
}
|
|
1490
|
+
function isMorphoB20Collateral(address) {
|
|
1491
|
+
return isCoinbaseB20AssetToken(address);
|
|
1492
|
+
}
|
|
1493
|
+
function morphoAssetLabel(address) {
|
|
1494
|
+
const stock = lookupCoinbaseB20StockToken(address);
|
|
1495
|
+
if (stock) return stock.symbol;
|
|
1496
|
+
try {
|
|
1497
|
+
const want = viem.getAddress(address).toLowerCase();
|
|
1498
|
+
if (want === viem.getAddress(MORPHO_BASE_USDC).toLowerCase() || want === viem.getAddress(MORPHO_ETHEREUM_USDC).toLowerCase()) {
|
|
1499
|
+
return "USDC";
|
|
1500
|
+
}
|
|
1501
|
+
if (want === viem.getAddress(MORPHO_BASE_USDT).toLowerCase() || want === viem.getAddress(MORPHO_ETHEREUM_USDT).toLowerCase()) {
|
|
1502
|
+
return "USDT";
|
|
1503
|
+
}
|
|
1504
|
+
if (want === viem.getAddress(MORPHO_ARC_USDC).toLowerCase()) return "USDC";
|
|
1505
|
+
} catch {
|
|
1506
|
+
}
|
|
1507
|
+
return address.length > 10 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
|
|
1508
|
+
}
|
|
1509
|
+
function looksLikeMorphoStockTicker(token) {
|
|
1510
|
+
return looksLikeCoinbaseStockSymbol(token) && lookupCoinbaseB20StockToken(token) != null;
|
|
1355
1511
|
}
|
|
1356
1512
|
|
|
1357
1513
|
// src/protocols/evm/morpho/blueDiscovery.ts
|
|
@@ -1369,19 +1525,32 @@ function toDiscoveryRow(row) {
|
|
|
1369
1525
|
borrowApyLabel: row.borrowApyLabel,
|
|
1370
1526
|
supplyApyLabel: row.supplyApyLabel,
|
|
1371
1527
|
netSupplyApyLabel: row.netSupplyApyLabel,
|
|
1528
|
+
lltvLabel: row.lltvLabel,
|
|
1529
|
+
borrowAssetsUsdLabel: row.borrowAssetsUsdLabel,
|
|
1530
|
+
supplyAssetsUsdLabel: row.supplyAssetsUsdLabel,
|
|
1531
|
+
utilizationLabel: row.utilizationLabel,
|
|
1372
1532
|
rewards: row.rewards
|
|
1373
1533
|
};
|
|
1374
1534
|
}
|
|
1375
1535
|
async function morphoFetchBlueMarketsSummary(args) {
|
|
1376
1536
|
const limit = Math.min(Math.max(args.limit ?? 50, 1), 200);
|
|
1377
1537
|
let rows = [];
|
|
1378
|
-
const
|
|
1379
|
-
const
|
|
1538
|
+
const collateralRaw = args.collateral?.trim();
|
|
1539
|
+
const loanRaw = args.loan?.trim();
|
|
1540
|
+
const q = (args.query ?? "").trim();
|
|
1541
|
+
const collateral = collateralRaw ? resolveMorphoAssetRef(collateralRaw, args.chainId) : null;
|
|
1542
|
+
const loan = loanRaw ? resolveMorphoAssetRef(loanRaw, args.chainId) : null;
|
|
1380
1543
|
if (collateral) {
|
|
1381
1544
|
rows = await fetchMorphoBorrowMarketsForCollateral({
|
|
1382
1545
|
chainId: args.chainId,
|
|
1383
1546
|
collateralAddress: collateral
|
|
1384
1547
|
});
|
|
1548
|
+
} else if (isMorphoStockQuery(q) || q && looksLikeMorphoStockTicker(q) && !loanRaw) {
|
|
1549
|
+
const tickerAddr = q && looksLikeMorphoStockTicker(q) ? resolveMorphoAssetRef(q, args.chainId) : null;
|
|
1550
|
+
rows = tickerAddr ? await fetchMorphoBorrowMarketsForCollateral({ chainId: args.chainId, collateralAddress: tickerAddr }) : await fetchMorphoBorrowMarketsForCollaterals({
|
|
1551
|
+
chainId: args.chainId,
|
|
1552
|
+
collateralAddresses: morphoB20CollateralAddresses()
|
|
1553
|
+
});
|
|
1385
1554
|
} else if (loan) {
|
|
1386
1555
|
rows = await fetchMorphoBorrowMarketsForLoan({
|
|
1387
1556
|
chainId: args.chainId,
|
|
@@ -1394,8 +1563,12 @@ async function morphoFetchBlueMarketsSummary(args) {
|
|
|
1394
1563
|
if (row) rows.push(row);
|
|
1395
1564
|
}
|
|
1396
1565
|
}
|
|
1397
|
-
|
|
1398
|
-
|
|
1566
|
+
if (loan && collateral) {
|
|
1567
|
+
const loanKey = loan.toLowerCase();
|
|
1568
|
+
rows = rows.filter((r) => r.loanAssetAddress.toLowerCase() === loanKey);
|
|
1569
|
+
}
|
|
1570
|
+
const qLower = q.toLowerCase();
|
|
1571
|
+
if (qLower && !isMorphoStockQuery(q) && !looksLikeMorphoStockTicker(q)) {
|
|
1399
1572
|
rows = rows.filter((r) => {
|
|
1400
1573
|
const hay = [
|
|
1401
1574
|
r.marketLabel,
|
|
@@ -1403,9 +1576,10 @@ async function morphoFetchBlueMarketsSummary(args) {
|
|
|
1403
1576
|
r.collateralAssetSymbol,
|
|
1404
1577
|
r.loanAssetSymbol,
|
|
1405
1578
|
r.collateralAssetAddress,
|
|
1406
|
-
r.loanAssetAddress
|
|
1579
|
+
r.loanAssetAddress,
|
|
1580
|
+
r.lltvLabel
|
|
1407
1581
|
].join(" ").toLowerCase();
|
|
1408
|
-
return hay.includes(
|
|
1582
|
+
return hay.includes(qLower);
|
|
1409
1583
|
});
|
|
1410
1584
|
}
|
|
1411
1585
|
return { markets: rows.slice(0, limit).map(toDiscoveryRow) };
|
|
@@ -1499,7 +1673,7 @@ async function fetchMorphoUserBluePositions(args) {
|
|
|
1499
1673
|
morphoBlue { address }
|
|
1500
1674
|
state { borrowApy supplyApy borrowAssetsUsd }
|
|
1501
1675
|
}
|
|
1502
|
-
state { collateral borrowAssets }
|
|
1676
|
+
state { collateral borrowAssets supplyAssets supplyAssetsUsd }
|
|
1503
1677
|
}
|
|
1504
1678
|
}
|
|
1505
1679
|
}
|
|
@@ -1510,17 +1684,21 @@ async function fetchMorphoUserBluePositions(args) {
|
|
|
1510
1684
|
for (const p of d.userByAddress?.marketPositions ?? []) {
|
|
1511
1685
|
const borrow = (p.state?.borrowAssets ?? "0").trim();
|
|
1512
1686
|
const collateral = (p.state?.collateral ?? "0").trim();
|
|
1513
|
-
|
|
1687
|
+
const supply = (p.state?.supplyAssets ?? "0").trim();
|
|
1688
|
+
if (isZeroPositionAmount(borrow) && isZeroPositionAmount(collateral) && isZeroPositionAmount(supply)) continue;
|
|
1514
1689
|
const borrowMarket = morphoMarketToBorrowRow(p.market);
|
|
1515
1690
|
if (!borrowMarket) continue;
|
|
1516
1691
|
const hf = p.healthFactor;
|
|
1692
|
+
const loanDecimals = borrowMarket.loanAssetDecimals;
|
|
1517
1693
|
out.push({
|
|
1518
1694
|
marketId: p.market.marketId,
|
|
1519
1695
|
marketLabel: borrowMarket.marketLabel,
|
|
1520
1696
|
loanAssetSymbol: borrowMarket.loanAssetSymbol,
|
|
1521
1697
|
collateralAssetSymbol: borrowMarket.collateralAssetSymbol,
|
|
1522
|
-
collateralHuman: collateral
|
|
1523
|
-
borrowHuman: borrow
|
|
1698
|
+
collateralHuman: formatMorphoPositionAssets(collateral, borrowMarket.collateralAssetDecimals),
|
|
1699
|
+
borrowHuman: formatMorphoPositionAssets(borrow, loanDecimals),
|
|
1700
|
+
supplyHuman: formatMorphoPositionAssets(supply, loanDecimals),
|
|
1701
|
+
supplyUsdLabel: formatMorphoUsd(p.state?.supplyAssetsUsd),
|
|
1524
1702
|
healthFactorLabel: hf != null && Number.isFinite(hf) ? hf.toFixed(2) : "\u2014",
|
|
1525
1703
|
borrowMarket
|
|
1526
1704
|
});
|
|
@@ -1561,6 +1739,26 @@ async function fetchMorphoUserPortfolioUsd(args) {
|
|
|
1561
1739
|
function formatMorphoMarketApySummary(apy) {
|
|
1562
1740
|
return formatMorphoApyPct(apy);
|
|
1563
1741
|
}
|
|
1742
|
+
async function morphoFetchPositionsSummary(args) {
|
|
1743
|
+
const [vaults, blueRows] = await Promise.all([
|
|
1744
|
+
fetchMorphoUserVaultPositions(args),
|
|
1745
|
+
fetchMorphoUserBluePositions(args)
|
|
1746
|
+
]);
|
|
1747
|
+
return {
|
|
1748
|
+
vaults,
|
|
1749
|
+
blue: blueRows.map((r) => ({
|
|
1750
|
+
marketId: r.marketId,
|
|
1751
|
+
marketLabel: r.marketLabel,
|
|
1752
|
+
loanAssetSymbol: r.loanAssetSymbol,
|
|
1753
|
+
collateralAssetSymbol: r.collateralAssetSymbol,
|
|
1754
|
+
collateralHuman: r.collateralHuman,
|
|
1755
|
+
borrowHuman: r.borrowHuman,
|
|
1756
|
+
supplyHuman: r.supplyHuman,
|
|
1757
|
+
supplyUsdLabel: r.supplyUsdLabel,
|
|
1758
|
+
healthFactorLabel: r.healthFactorLabel
|
|
1759
|
+
}))
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1564
1762
|
|
|
1565
1763
|
// src/protocols/evm/morpho/midnightTypes.ts
|
|
1566
1764
|
var MORPHO_MIDNIGHT_UNAVAILABLE_MESSAGE = "Morpho Midnight fixed-rate markets are available on supported chains (starting with Base). Open the Midnight tab to browse books.";
|
|
@@ -1648,13 +1846,8 @@ function morphoMidnightAprFromTick(tick, ttmSeconds) {
|
|
|
1648
1846
|
return morphoMidnightAprFromPriceWad(midnightSdk.TickLib.tickToPrice(tick), ttmSeconds);
|
|
1649
1847
|
}
|
|
1650
1848
|
}
|
|
1651
|
-
|
|
1652
|
-
// src/protocols/evm/morpho/midnightDiscovery.ts
|
|
1653
1849
|
init_midnightApi();
|
|
1654
1850
|
init_midnightConstants();
|
|
1655
|
-
function shortAddr(a) {
|
|
1656
|
-
return a.length > 10 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
1657
|
-
}
|
|
1658
1851
|
function maturityIso(maturity) {
|
|
1659
1852
|
if (!maturity || maturity <= 0) return "\u2014";
|
|
1660
1853
|
try {
|
|
@@ -1673,7 +1866,9 @@ function morphoMidnightBookToDiscoveryRow(book) {
|
|
|
1673
1866
|
const collaterals = book.collaterals.map((c) => viem.getAddress(c.token));
|
|
1674
1867
|
const primary = book.collaterals[0];
|
|
1675
1868
|
const primaryAddr = primary ? viem.getAddress(primary.token) : null;
|
|
1676
|
-
const
|
|
1869
|
+
const primaryLabel = primaryAddr ? morphoAssetLabel(primaryAddr) : "\u2014";
|
|
1870
|
+
const loanLabel = morphoAssetLabel(loan);
|
|
1871
|
+
const marketLabel = `${primaryLabel}/${loanLabel} \xB7 ${maturityIso(book.maturity)}`;
|
|
1677
1872
|
return {
|
|
1678
1873
|
marketId: book.marketId,
|
|
1679
1874
|
chainId: book.chainId,
|
|
@@ -1697,10 +1892,12 @@ function morphoMidnightBookToDiscoveryRow(book) {
|
|
|
1697
1892
|
}
|
|
1698
1893
|
async function morphoFetchMidnightBooksSummary(args) {
|
|
1699
1894
|
const limit = Math.min(Math.max(args.limit ?? exports.MORPHO_MIDNIGHT_BOOKS_MAX_LIMIT, 1), exports.MORPHO_MIDNIGHT_BOOKS_MAX_LIMIT);
|
|
1700
|
-
const
|
|
1701
|
-
const
|
|
1702
|
-
const
|
|
1703
|
-
const
|
|
1895
|
+
const loanRaw = args.loan?.trim();
|
|
1896
|
+
const collateralRaw = args.collateral?.trim();
|
|
1897
|
+
const loanResolved = loanRaw ? resolveMorphoAssetRef(loanRaw, args.chainId) : null;
|
|
1898
|
+
const collateralResolved = collateralRaw ? resolveMorphoAssetRef(collateralRaw, args.chainId) : null;
|
|
1899
|
+
const loanTokens = loanResolved ? [loanResolved] : void 0;
|
|
1900
|
+
const collateralTokens = collateralResolved ? [collateralResolved] : void 0;
|
|
1704
1901
|
const { data } = await fetchMorphoMidnightBooks({
|
|
1705
1902
|
chainId: args.chainId,
|
|
1706
1903
|
loanTokens,
|
|
@@ -1709,8 +1906,8 @@ async function morphoFetchMidnightBooksSummary(args) {
|
|
|
1709
1906
|
limit
|
|
1710
1907
|
});
|
|
1711
1908
|
let rows = data.map(morphoMidnightBookToDiscoveryRow);
|
|
1712
|
-
if (
|
|
1713
|
-
const col =
|
|
1909
|
+
if (collateralResolved) {
|
|
1910
|
+
const col = collateralResolved.toLowerCase();
|
|
1714
1911
|
rows = rows.filter((r) => r.collateralTokenAddresses.some((a) => a.toLowerCase() === col));
|
|
1715
1912
|
}
|
|
1716
1913
|
const side = args.side ?? "either";
|
|
@@ -1727,7 +1924,8 @@ async function morphoFetchMidnightBooksSummary(args) {
|
|
|
1727
1924
|
r.marketLabel,
|
|
1728
1925
|
r.loanTokenAddress,
|
|
1729
1926
|
r.primaryCollateralTokenAddress ?? "",
|
|
1730
|
-
...r.collateralTokenAddresses
|
|
1927
|
+
...r.collateralTokenAddresses,
|
|
1928
|
+
...r.collateralTokenAddresses.map((a) => morphoAssetLabel(a))
|
|
1731
1929
|
].join(" ").toLowerCase();
|
|
1732
1930
|
return hay.includes(q);
|
|
1733
1931
|
});
|
|
@@ -3418,6 +3616,8 @@ async function buildEvmMultisignBodyMorphoVaultWithdraw(args) {
|
|
|
3418
3616
|
});
|
|
3419
3617
|
}
|
|
3420
3618
|
var MORPHO_BLUE_COLLATERAL_DEPOSIT_FALLBACK_GAS = 1200000n;
|
|
3619
|
+
var MORPHO_BLUE_SUPPLY_FALLBACK_GAS = 1100000n;
|
|
3620
|
+
var MORPHO_BLUE_WITHDRAW_FALLBACK_GAS = 900000n;
|
|
3421
3621
|
var MORPHO_BLUE_BORROW_FALLBACK_GAS = 1100000n;
|
|
3422
3622
|
var MORPHO_BLUE_REPAY_FALLBACK_GAS = 1000000n;
|
|
3423
3623
|
var MORPHO_BLUE_COLLATERAL_WITHDRAW_FALLBACK_GAS = 900000n;
|
|
@@ -3430,11 +3630,27 @@ var erc20AllowanceAbi2 = viem.parseAbi([
|
|
|
3430
3630
|
]);
|
|
3431
3631
|
var erc20ApproveAbi2 = viem.parseAbi(["function approve(address spender, uint256 amount) returns (bool)"]);
|
|
3432
3632
|
var morphoBlueAbi3 = viem.parseAbi([
|
|
3633
|
+
"function supply((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv), uint256 assets, uint256 shares, address onBehalf, bytes data)",
|
|
3634
|
+
"function withdraw((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv), uint256 assets, uint256 shares, address onBehalf, address receiver)",
|
|
3433
3635
|
"function supplyCollateral((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv), uint256 assets, address onBehalf, bytes data)",
|
|
3434
3636
|
"function borrow((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv), uint256 assets, uint256 shares, address onBehalf, address receiver)",
|
|
3435
3637
|
"function repay((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv), uint256 assets, uint256 shares, address onBehalf, bytes data)",
|
|
3436
3638
|
"function withdrawCollateral((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv), uint256 assets, address onBehalf, address receiver)"
|
|
3437
3639
|
]);
|
|
3640
|
+
function encodeMorphoBlueSupplyCalldata(args) {
|
|
3641
|
+
return viem.encodeFunctionData({
|
|
3642
|
+
abi: morphoBlueAbi3,
|
|
3643
|
+
functionName: "supply",
|
|
3644
|
+
args: [marketParamsTuple(args.marketParams), args.assets, 0n, args.onBehalf, "0x"]
|
|
3645
|
+
});
|
|
3646
|
+
}
|
|
3647
|
+
function encodeMorphoBlueWithdrawCalldata(args) {
|
|
3648
|
+
return viem.encodeFunctionData({
|
|
3649
|
+
abi: morphoBlueAbi3,
|
|
3650
|
+
functionName: "withdraw",
|
|
3651
|
+
args: [marketParamsTuple(args.marketParams), args.assets, 0n, args.onBehalf, args.receiver]
|
|
3652
|
+
});
|
|
3653
|
+
}
|
|
3438
3654
|
function marketParamsTuple(p) {
|
|
3439
3655
|
return {
|
|
3440
3656
|
loanToken: p.loanToken,
|
|
@@ -3567,6 +3783,99 @@ async function buildEvmMultisignBodyMorphoBlueSupplyCollateralBatch(args) {
|
|
|
3567
3783
|
})
|
|
3568
3784
|
});
|
|
3569
3785
|
}
|
|
3786
|
+
async function buildEvmMultisignBodyMorphoBlueSupplyBatch(args) {
|
|
3787
|
+
const morphoBlue = viem.getAddress(args.morphoBlue);
|
|
3788
|
+
const onBehalf = viem.getAddress(args.onBehalf);
|
|
3789
|
+
const executor = viem.getAddress(args.executorAddress);
|
|
3790
|
+
const loan = viem.getAddress(args.loanToken);
|
|
3791
|
+
const dec = await readTokenDecimals3({ rpcUrl: args.rpcUrl, chainId: args.chainId, token: loan });
|
|
3792
|
+
const amountWei = viem.parseUnits(args.amountHuman, dec);
|
|
3793
|
+
if (amountWei === 0n) throw new Error("Supply amount is zero.");
|
|
3794
|
+
const approveSteps = await buildApproveSteps3({
|
|
3795
|
+
rpcUrl: args.rpcUrl,
|
|
3796
|
+
chainId: args.chainId,
|
|
3797
|
+
token: loan,
|
|
3798
|
+
spender: morphoBlue,
|
|
3799
|
+
amountWei,
|
|
3800
|
+
executor
|
|
3801
|
+
});
|
|
3802
|
+
const supplyData = encodeMorphoBlueSupplyCalldata({
|
|
3803
|
+
marketParams: args.marketParams,
|
|
3804
|
+
assets: amountWei,
|
|
3805
|
+
onBehalf
|
|
3806
|
+
});
|
|
3807
|
+
const marketLabel = (args.marketLabel ?? "").trim() || "Morpho Blue market";
|
|
3808
|
+
const evmSteps = stepsToEvm(approveSteps, {
|
|
3809
|
+
to: morphoBlue,
|
|
3810
|
+
data: supplyData,
|
|
3811
|
+
value: 0n,
|
|
3812
|
+
fallbackGas: MORPHO_BLUE_SUPPLY_FALLBACK_GAS
|
|
3813
|
+
});
|
|
3814
|
+
return buildEvmMultisignBatch({
|
|
3815
|
+
context: {
|
|
3816
|
+
chainCategory: "evm",
|
|
3817
|
+
keyGen: args.keyGen,
|
|
3818
|
+
purposeText: args.purposeText,
|
|
3819
|
+
chainId: args.chainId,
|
|
3820
|
+
rpcUrl: args.rpcUrl,
|
|
3821
|
+
executorAddress: executor,
|
|
3822
|
+
chainDetail: args.chainDetail,
|
|
3823
|
+
useCustomGas: args.useCustomGas,
|
|
3824
|
+
customGasChainDetails: args.customGasChainDetails
|
|
3825
|
+
},
|
|
3826
|
+
steps: evmSteps,
|
|
3827
|
+
purposeSuffix: `Morpho Blue: supply (${args.amountHuman}) to "${marketLabel}".`,
|
|
3828
|
+
firstMsgRawNo0x: evmSteps[0].data.slice(2),
|
|
3829
|
+
destinationAddress: morphoBlue,
|
|
3830
|
+
buildBatchMeta: ({ gasLimit }) => ({
|
|
3831
|
+
signatureText: JSON.stringify({ kind: "MorphoBlue", name: "supply", marketLabel, amountHuman: args.amountHuman }),
|
|
3832
|
+
evm: { type: "morpho_blue_supply", version: 1, chainId: String(args.chainId) },
|
|
3833
|
+
morpho: { marketLabel, amountHuman: args.amountHuman, gasBuild: { baseGasUnits: gasLimit.toString() } }
|
|
3834
|
+
})
|
|
3835
|
+
});
|
|
3836
|
+
}
|
|
3837
|
+
async function buildEvmMultisignBodyMorphoBlueWithdrawBatch(args) {
|
|
3838
|
+
const morphoBlue = viem.getAddress(args.morphoBlue);
|
|
3839
|
+
const onBehalf = viem.getAddress(args.onBehalf);
|
|
3840
|
+
const receiver = viem.getAddress(args.receiver);
|
|
3841
|
+
const executor = viem.getAddress(args.executorAddress);
|
|
3842
|
+
const loan = viem.getAddress(args.loanToken);
|
|
3843
|
+
const dec = await readTokenDecimals3({ rpcUrl: args.rpcUrl, chainId: args.chainId, token: loan });
|
|
3844
|
+
const amountWei = viem.parseUnits(args.amountHuman, dec);
|
|
3845
|
+
if (amountWei === 0n) throw new Error("Withdraw amount is zero.");
|
|
3846
|
+
const withdrawData = encodeMorphoBlueWithdrawCalldata({
|
|
3847
|
+
marketParams: args.marketParams,
|
|
3848
|
+
assets: amountWei,
|
|
3849
|
+
onBehalf,
|
|
3850
|
+
receiver
|
|
3851
|
+
});
|
|
3852
|
+
const marketLabel = (args.marketLabel ?? "").trim() || "Morpho Blue market";
|
|
3853
|
+
const evmSteps = [
|
|
3854
|
+
{ to: morphoBlue, data: withdrawData, value: 0n, fallbackGas: MORPHO_BLUE_WITHDRAW_FALLBACK_GAS }
|
|
3855
|
+
];
|
|
3856
|
+
return buildEvmMultisignBatch({
|
|
3857
|
+
context: {
|
|
3858
|
+
chainCategory: "evm",
|
|
3859
|
+
keyGen: args.keyGen,
|
|
3860
|
+
purposeText: args.purposeText,
|
|
3861
|
+
chainId: args.chainId,
|
|
3862
|
+
rpcUrl: args.rpcUrl,
|
|
3863
|
+
executorAddress: executor,
|
|
3864
|
+
chainDetail: args.chainDetail,
|
|
3865
|
+
useCustomGas: args.useCustomGas,
|
|
3866
|
+
customGasChainDetails: args.customGasChainDetails
|
|
3867
|
+
},
|
|
3868
|
+
steps: evmSteps,
|
|
3869
|
+
purposeSuffix: `Morpho Blue: withdraw (${args.amountHuman}) from "${marketLabel}".`,
|
|
3870
|
+
firstMsgRawNo0x: withdrawData.slice(2),
|
|
3871
|
+
destinationAddress: morphoBlue,
|
|
3872
|
+
buildBatchMeta: ({ gasLimit }) => ({
|
|
3873
|
+
signatureText: JSON.stringify({ kind: "MorphoBlue", name: "withdraw", marketLabel, amountHuman: args.amountHuman }),
|
|
3874
|
+
evm: { type: "morpho_blue_withdraw", version: 1, chainId: String(args.chainId) },
|
|
3875
|
+
morpho: { marketLabel, amountHuman: args.amountHuman, gasBuild: { baseGasUnits: gasLimit.toString() } }
|
|
3876
|
+
})
|
|
3877
|
+
});
|
|
3878
|
+
}
|
|
3570
3879
|
async function buildEvmMultisignBodyMorphoBlueBorrowBatch(args) {
|
|
3571
3880
|
const morphoBlue = viem.getAddress(args.morphoBlue);
|
|
3572
3881
|
const onBehalf = viem.getAddress(args.onBehalf);
|
|
@@ -3731,6 +4040,206 @@ async function buildEvmMultisignBodyMorphoMerklDistributorClaim(args) {
|
|
|
3731
4040
|
})
|
|
3732
4041
|
});
|
|
3733
4042
|
}
|
|
4043
|
+
var MERKL_API_BASE = "https://api.merkl.xyz";
|
|
4044
|
+
var MERKL_DISTRIBUTOR_ADDRESS = "0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae";
|
|
4045
|
+
var MERKL_DISTRIBUTOR_CLAIM_GAS_FALLBACK = 500000n;
|
|
4046
|
+
var MERKL_REWARDS_NOTES = "Wallet-wide Merkl on this chain (not protocol-filtered). Other venues\u2019 campaigns can appear. Claims the first Merkle root batch; call again if additionalRoots > 0. rEUL is omitted (Euler unlock flow). Merkl updates every 8\u201312 hours.";
|
|
4047
|
+
function normHex32(p) {
|
|
4048
|
+
const s = (p ?? "").trim();
|
|
4049
|
+
if (!s) return null;
|
|
4050
|
+
const x = s.startsWith("0x") ? s : `0x${s}`;
|
|
4051
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(x)) return null;
|
|
4052
|
+
return x;
|
|
4053
|
+
}
|
|
4054
|
+
function merklUserRewardsUrl(addr, chainId) {
|
|
4055
|
+
return `${MERKL_API_BASE}/v4/users/${encodeURIComponent(addr)}/rewards?chainId=${chainId}`;
|
|
4056
|
+
}
|
|
4057
|
+
async function loadMerklUserRewardsJson(args) {
|
|
4058
|
+
const addr = viem.getAddress(args.user);
|
|
4059
|
+
const url = merklUserRewardsUrl(addr, args.chainId);
|
|
4060
|
+
const res = await fetch(url, { cache: "no-store" });
|
|
4061
|
+
if (!res.ok) {
|
|
4062
|
+
let detail = `Merkl API error ${res.status}`;
|
|
4063
|
+
try {
|
|
4064
|
+
const j = await res.json();
|
|
4065
|
+
if (j?.error) {
|
|
4066
|
+
detail = j.details ? `${j.error}: ${j.details}` : j.error;
|
|
4067
|
+
}
|
|
4068
|
+
} catch {
|
|
4069
|
+
}
|
|
4070
|
+
throw new Error(detail);
|
|
4071
|
+
}
|
|
4072
|
+
return res.json();
|
|
4073
|
+
}
|
|
4074
|
+
function parseMerklUserRewardsToLeaves(raw, args) {
|
|
4075
|
+
const addr = viem.getAddress(args.user);
|
|
4076
|
+
if (!Array.isArray(raw)) {
|
|
4077
|
+
throw new Error("Merkl API returned an unexpected rewards shape.");
|
|
4078
|
+
}
|
|
4079
|
+
const collected = [];
|
|
4080
|
+
for (const block of raw) {
|
|
4081
|
+
for (const rw of block.rewards ?? []) {
|
|
4082
|
+
const root = (rw.root ?? "").trim();
|
|
4083
|
+
const dist = rw.distributionChainId;
|
|
4084
|
+
if (!root || dist !== args.chainId) continue;
|
|
4085
|
+
let recipient;
|
|
4086
|
+
try {
|
|
4087
|
+
recipient = viem.getAddress((rw.recipient ?? "").trim());
|
|
4088
|
+
} catch {
|
|
4089
|
+
continue;
|
|
4090
|
+
}
|
|
4091
|
+
if (recipient !== addr) continue;
|
|
4092
|
+
let amt = 0n;
|
|
4093
|
+
let clm = 0n;
|
|
4094
|
+
try {
|
|
4095
|
+
amt = BigInt((rw.amount ?? "0").toString().trim() || "0");
|
|
4096
|
+
clm = BigInt((rw.claimed ?? "0").toString().trim() || "0");
|
|
4097
|
+
} catch {
|
|
4098
|
+
continue;
|
|
4099
|
+
}
|
|
4100
|
+
if (amt <= clm) continue;
|
|
4101
|
+
let tokenAddr;
|
|
4102
|
+
try {
|
|
4103
|
+
tokenAddr = viem.getAddress((rw.token?.address ?? "").trim());
|
|
4104
|
+
} catch {
|
|
4105
|
+
continue;
|
|
4106
|
+
}
|
|
4107
|
+
const proofsRaw = rw.proofs ?? [];
|
|
4108
|
+
const proofs = [];
|
|
4109
|
+
for (const p of proofsRaw) {
|
|
4110
|
+
const h = normHex32(String(p));
|
|
4111
|
+
if (!h) continue;
|
|
4112
|
+
proofs.push(h);
|
|
4113
|
+
}
|
|
4114
|
+
if (proofsRaw.length > 0 && proofs.length !== proofsRaw.length) continue;
|
|
4115
|
+
const sym = (rw.token?.symbol ?? "").trim() || "\u2014";
|
|
4116
|
+
let dec = 18;
|
|
4117
|
+
try {
|
|
4118
|
+
const d = Number(rw.token?.decimals ?? 18);
|
|
4119
|
+
if (Number.isFinite(d) && d >= 0 && d <= 36) dec = d;
|
|
4120
|
+
} catch {
|
|
4121
|
+
dec = 18;
|
|
4122
|
+
}
|
|
4123
|
+
collected.push({ root, token: tokenAddr, amountWei: amt, proofs, symbol: sym, decimals: dec });
|
|
4124
|
+
}
|
|
4125
|
+
}
|
|
4126
|
+
return collected;
|
|
4127
|
+
}
|
|
4128
|
+
function selectFirstRootMerklLeaves(collected) {
|
|
4129
|
+
if (collected.length === 0) return [];
|
|
4130
|
+
const root0 = collected[0].root;
|
|
4131
|
+
return collected.filter((x) => x.root === root0);
|
|
4132
|
+
}
|
|
4133
|
+
function isMerklRewardEulLeaf(leaf) {
|
|
4134
|
+
const s = leaf.symbol.trim().toLowerCase().replace(/\s+/g, " ").trim();
|
|
4135
|
+
return s === "reul" || s === "reward eul";
|
|
4136
|
+
}
|
|
4137
|
+
function selectWalletWideMerklClaimLeaves(collected) {
|
|
4138
|
+
return selectFirstRootMerklLeaves(collected.filter((l) => !isMerklRewardEulLeaf(l)));
|
|
4139
|
+
}
|
|
4140
|
+
async function fetchAllMerklDistributorClaimLeaves(args) {
|
|
4141
|
+
const raw = await loadMerklUserRewardsJson(args);
|
|
4142
|
+
return parseMerklUserRewardsToLeaves(raw, args);
|
|
4143
|
+
}
|
|
4144
|
+
function encodeMerklDistributorClaimData(args) {
|
|
4145
|
+
if (args.leaves.length === 0) throw new Error("No Merkl claim leaves.");
|
|
4146
|
+
const u = viem.getAddress(args.user);
|
|
4147
|
+
const abi = viem.parseAbi([
|
|
4148
|
+
"function claim(address[] users, address[] tokens, uint256[] amounts, bytes32[][] proofs) external"
|
|
4149
|
+
]);
|
|
4150
|
+
const users = args.leaves.map(() => u);
|
|
4151
|
+
const tokens = args.leaves.map((l) => l.token);
|
|
4152
|
+
const amounts = args.leaves.map((l) => l.amountWei);
|
|
4153
|
+
const proofs = args.leaves.map((l) => [...l.proofs]);
|
|
4154
|
+
return viem.encodeFunctionData({
|
|
4155
|
+
abi,
|
|
4156
|
+
functionName: "claim",
|
|
4157
|
+
args: [users, tokens, amounts, proofs]
|
|
4158
|
+
});
|
|
4159
|
+
}
|
|
4160
|
+
function merklLeafToRow(leaf) {
|
|
4161
|
+
return {
|
|
4162
|
+
symbol: leaf.symbol,
|
|
4163
|
+
token: leaf.token,
|
|
4164
|
+
amountHuman: viem.formatUnits(leaf.amountWei, leaf.decimals),
|
|
4165
|
+
amountWei: leaf.amountWei.toString(),
|
|
4166
|
+
decimals: leaf.decimals,
|
|
4167
|
+
root: leaf.root
|
|
4168
|
+
};
|
|
4169
|
+
}
|
|
4170
|
+
async function fetchMerklRewardsSummary(args) {
|
|
4171
|
+
const user = viem.getAddress(args.user);
|
|
4172
|
+
const chainId = args.chainId;
|
|
4173
|
+
const all = await fetchAllMerklDistributorClaimLeaves({ chainId, user });
|
|
4174
|
+
const skippedReulCount = all.filter(isMerklRewardEulLeaf).length;
|
|
4175
|
+
const display = all.filter((l) => !isMerklRewardEulLeaf(l));
|
|
4176
|
+
const firstRoot = selectFirstRootMerklLeaves(display);
|
|
4177
|
+
const roots = new Set(display.map((l) => l.root));
|
|
4178
|
+
return {
|
|
4179
|
+
chainId,
|
|
4180
|
+
user,
|
|
4181
|
+
distributor: MERKL_DISTRIBUTOR_ADDRESS,
|
|
4182
|
+
claimable: display.map(merklLeafToRow),
|
|
4183
|
+
claimableCount: display.length,
|
|
4184
|
+
firstRootClaimableCount: firstRoot.length,
|
|
4185
|
+
additionalRoots: Math.max(0, roots.size - (firstRoot.length > 0 ? 1 : 0)),
|
|
4186
|
+
skippedReulCount,
|
|
4187
|
+
notes: MERKL_REWARDS_NOTES
|
|
4188
|
+
};
|
|
4189
|
+
}
|
|
4190
|
+
|
|
4191
|
+
// src/protocols/evm/morpho/merklRewards.ts
|
|
4192
|
+
async function morphoFetchMerklRewardsSummary(args) {
|
|
4193
|
+
return fetchMerklRewardsSummary(args);
|
|
4194
|
+
}
|
|
4195
|
+
|
|
4196
|
+
// src/protocols/evm/morpho/stockDiscovery.ts
|
|
4197
|
+
init_midnightApi();
|
|
4198
|
+
init_midnightConstants();
|
|
4199
|
+
var MORPHO_STOCK_MARKETS_DEFAULT_CHAIN_ID = exports.MORPHO_MIDNIGHT_BASE_CHAIN_ID;
|
|
4200
|
+
var MORPHO_STOCK_MARKETS_NOTES = "Coinbase B20 stock-backed Morpho markets on Base. Curators set LLTV, oracle, and IRM. Chainlink equity feeds are 24/5 (stale off cash hours). Tokens are Regulation S / not for U.S. persons. Liquidity is still thin. Variable = Blue; fixed = Midnight.";
|
|
4201
|
+
async function morphoFetchStockMarketsSummary(args) {
|
|
4202
|
+
const chainId = args.chainId ?? MORPHO_STOCK_MARKETS_DEFAULT_CHAIN_ID;
|
|
4203
|
+
const rate = args.rate ?? "both";
|
|
4204
|
+
const limit = Math.min(Math.max(args.limit ?? 50, 1), 200);
|
|
4205
|
+
const collateralRaw = args.collateral?.trim();
|
|
4206
|
+
const collateral = collateralRaw ? resolveMorphoAssetRef(collateralRaw, chainId) : null;
|
|
4207
|
+
if (collateralRaw && !collateral) {
|
|
4208
|
+
throw new Error(
|
|
4209
|
+
`Unknown Morpho stock collateral "${collateralRaw}". Pass a B20 ticker (AAPLc, NVDAc, \u2026) or 0x address.`
|
|
4210
|
+
);
|
|
4211
|
+
}
|
|
4212
|
+
let markets = [];
|
|
4213
|
+
let books = [];
|
|
4214
|
+
if (rate === "variable" || rate === "both") {
|
|
4215
|
+
const blue = await morphoFetchBlueMarketsSummary({
|
|
4216
|
+
chainId,
|
|
4217
|
+
collateral: collateral ?? void 0,
|
|
4218
|
+
query: collateral ? void 0 : "stock",
|
|
4219
|
+
limit
|
|
4220
|
+
});
|
|
4221
|
+
markets = blue.markets.filter((m) => isMorphoB20Collateral(m.collateralTokenAddress)).slice(0, limit);
|
|
4222
|
+
}
|
|
4223
|
+
if (rate === "fixed" || rate === "both") {
|
|
4224
|
+
if (collateral) {
|
|
4225
|
+
const midnight = await morphoFetchMidnightBooksSummary({
|
|
4226
|
+
chainId,
|
|
4227
|
+
collateral,
|
|
4228
|
+
limit: Math.min(limit, exports.MORPHO_MIDNIGHT_BOOKS_MAX_LIMIT)
|
|
4229
|
+
});
|
|
4230
|
+
books = midnight.books.filter((b) => b.collateralTokenAddresses.some((a) => isMorphoB20Collateral(a))).slice(0, limit);
|
|
4231
|
+
} else {
|
|
4232
|
+
const { data } = await fetchMorphoMidnightBooks({
|
|
4233
|
+
chainId,
|
|
4234
|
+
collateralTokens: morphoB20CollateralAddresses(),
|
|
4235
|
+
sort: "maturity",
|
|
4236
|
+
limit: exports.MORPHO_MIDNIGHT_BOOKS_MAX_LIMIT
|
|
4237
|
+
});
|
|
4238
|
+
books = data.map(morphoMidnightBookToDiscoveryRow).filter((b) => b.collateralTokenAddresses.some((a) => isMorphoB20Collateral(a))).slice(0, limit);
|
|
4239
|
+
}
|
|
4240
|
+
}
|
|
4241
|
+
return { chainId, markets, books, notes: MORPHO_STOCK_MARKETS_NOTES };
|
|
4242
|
+
}
|
|
3734
4243
|
|
|
3735
4244
|
// src/protocols/evm/morpho/index.ts
|
|
3736
4245
|
var MORPHO_PROTOCOL_ID = "morpho";
|
|
@@ -3748,10 +4257,16 @@ var morphoProtocolModule = {
|
|
|
3748
4257
|
{ id: "morpho.vault-deposit", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Deposit into Morpho-listed earn vault (V1 or V2)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3749
4258
|
{ id: "morpho.vault-withdraw", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw from Morpho earn vault (V1 or V2)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3750
4259
|
{ id: "morpho.blue-collateral-deposit", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Supply collateral to Morpho Blue market", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
4260
|
+
{ id: "morpho.blue-supply", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Supply loan token to Morpho Blue market", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
4261
|
+
{ id: "morpho.blue-withdraw", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw supplied loan token from Morpho Blue market", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3751
4262
|
{ id: "morpho.blue-borrow", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Borrow from Morpho Blue market", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3752
4263
|
{ id: "morpho.blue-repay", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Repay Morpho Blue borrow", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3753
4264
|
{ id: "morpho.blue-collateral-withdraw", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw Morpho Blue collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3754
|
-
{ id: "morpho.merkl-
|
|
4265
|
+
{ id: "morpho.fetch-merkl-rewards", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "List wallet-wide Merkl claimables on a chain", commonParams: [], params: {} },
|
|
4266
|
+
{ id: "morpho.merkl-claim", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Claim wallet-wide Merkl rewards", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
4267
|
+
{ id: "morpho.fetch-blue-markets", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Search Morpho Blue variable-rate markets", commonParams: [], params: {} },
|
|
4268
|
+
{ id: "morpho.fetch-stock-markets", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "List Coinbase B20 stock-backed Morpho Blue and Midnight markets on Base", commonParams: [], params: {} },
|
|
4269
|
+
{ id: "morpho.fetch-positions", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "List Morpho vault and Blue positions for a user", commonParams: [], params: {} },
|
|
3755
4270
|
{ id: "morpho.fetch-midnight-books", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "List Morpho Midnight fixed-rate books", commonParams: [], params: {} },
|
|
3756
4271
|
{ id: "morpho.fetch-midnight-quote", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Quote Morpho Midnight lend/borrow fill", commonParams: [], params: {} },
|
|
3757
4272
|
{ id: "morpho.fetch-midnight-positions", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "List Morpho Midnight user positions", commonParams: [], params: {} },
|
|
@@ -3766,14 +4281,27 @@ registerProtocolModule(morphoProtocolModule);
|
|
|
3766
4281
|
|
|
3767
4282
|
exports.ARC_MAINNET_CHAIN_ID = ARC_MAINNET_CHAIN_ID;
|
|
3768
4283
|
exports.ARC_TESTNET_CHAIN_ID = ARC_TESTNET_CHAIN_ID;
|
|
4284
|
+
exports.MERKL_API_BASE = MERKL_API_BASE;
|
|
4285
|
+
exports.MERKL_DISTRIBUTOR_ADDRESS = MERKL_DISTRIBUTOR_ADDRESS;
|
|
4286
|
+
exports.MERKL_DISTRIBUTOR_CLAIM_GAS_FALLBACK = MERKL_DISTRIBUTOR_CLAIM_GAS_FALLBACK;
|
|
4287
|
+
exports.MERKL_REWARDS_NOTES = MERKL_REWARDS_NOTES;
|
|
4288
|
+
exports.MORPHO_ARC_USDC = MORPHO_ARC_USDC;
|
|
4289
|
+
exports.MORPHO_BASE_USDC = MORPHO_BASE_USDC;
|
|
4290
|
+
exports.MORPHO_BASE_USDT = MORPHO_BASE_USDT;
|
|
3769
4291
|
exports.MORPHO_BLUE_BORROW_FALLBACK_GAS = MORPHO_BLUE_BORROW_FALLBACK_GAS;
|
|
3770
4292
|
exports.MORPHO_BLUE_COLLATERAL_DEPOSIT_FALLBACK_GAS = MORPHO_BLUE_COLLATERAL_DEPOSIT_FALLBACK_GAS;
|
|
3771
4293
|
exports.MORPHO_BLUE_COLLATERAL_WITHDRAW_FALLBACK_GAS = MORPHO_BLUE_COLLATERAL_WITHDRAW_FALLBACK_GAS;
|
|
3772
4294
|
exports.MORPHO_BLUE_REPAY_FALLBACK_GAS = MORPHO_BLUE_REPAY_FALLBACK_GAS;
|
|
4295
|
+
exports.MORPHO_BLUE_SUPPLY_FALLBACK_GAS = MORPHO_BLUE_SUPPLY_FALLBACK_GAS;
|
|
4296
|
+
exports.MORPHO_BLUE_WITHDRAW_FALLBACK_GAS = MORPHO_BLUE_WITHDRAW_FALLBACK_GAS;
|
|
4297
|
+
exports.MORPHO_ETHEREUM_USDC = MORPHO_ETHEREUM_USDC;
|
|
4298
|
+
exports.MORPHO_ETHEREUM_USDT = MORPHO_ETHEREUM_USDT;
|
|
3773
4299
|
exports.MORPHO_EXTRA_SUPPORTED_CHAIN_IDS = MORPHO_EXTRA_SUPPORTED_CHAIN_IDS;
|
|
3774
4300
|
exports.MORPHO_GRAPHQL_URL = MORPHO_GRAPHQL_URL;
|
|
3775
4301
|
exports.MORPHO_MIDNIGHT_UNAVAILABLE_MESSAGE = MORPHO_MIDNIGHT_UNAVAILABLE_MESSAGE;
|
|
3776
4302
|
exports.MORPHO_PROTOCOL_ID = MORPHO_PROTOCOL_ID;
|
|
4303
|
+
exports.MORPHO_STOCK_MARKETS_DEFAULT_CHAIN_ID = MORPHO_STOCK_MARKETS_DEFAULT_CHAIN_ID;
|
|
4304
|
+
exports.MORPHO_STOCK_MARKETS_NOTES = MORPHO_STOCK_MARKETS_NOTES;
|
|
3777
4305
|
exports.MORPHO_VAULT_DEPOSIT_FALLBACK_GAS = MORPHO_VAULT_DEPOSIT_FALLBACK_GAS;
|
|
3778
4306
|
exports.MORPHO_VAULT_WITHDRAW_FALLBACK_GAS = MORPHO_VAULT_WITHDRAW_FALLBACK_GAS;
|
|
3779
4307
|
exports.ROBINHOOD_CHAIN_ID = ROBINHOOD_CHAIN_ID;
|
|
@@ -3784,7 +4312,9 @@ exports.ROBINHOOD_EARN_VAULT_SYMBOL = ROBINHOOD_EARN_VAULT_SYMBOL;
|
|
|
3784
4312
|
exports.applyRobinhoodEarnMultisignDefaults = applyRobinhoodEarnMultisignDefaults;
|
|
3785
4313
|
exports.buildEvmMultisignBodyMorphoBlueBorrowBatch = buildEvmMultisignBodyMorphoBlueBorrowBatch;
|
|
3786
4314
|
exports.buildEvmMultisignBodyMorphoBlueRepayBatch = buildEvmMultisignBodyMorphoBlueRepayBatch;
|
|
4315
|
+
exports.buildEvmMultisignBodyMorphoBlueSupplyBatch = buildEvmMultisignBodyMorphoBlueSupplyBatch;
|
|
3787
4316
|
exports.buildEvmMultisignBodyMorphoBlueSupplyCollateralBatch = buildEvmMultisignBodyMorphoBlueSupplyCollateralBatch;
|
|
4317
|
+
exports.buildEvmMultisignBodyMorphoBlueWithdrawBatch = buildEvmMultisignBodyMorphoBlueWithdrawBatch;
|
|
3788
4318
|
exports.buildEvmMultisignBodyMorphoBlueWithdrawCollateralBatch = buildEvmMultisignBodyMorphoBlueWithdrawCollateralBatch;
|
|
3789
4319
|
exports.buildEvmMultisignBodyMorphoMerklDistributorClaim = buildEvmMultisignBodyMorphoMerklDistributorClaim;
|
|
3790
4320
|
exports.buildEvmMultisignBodyMorphoMidnightBorrowBatch = buildEvmMultisignBodyMorphoMidnightBorrowBatch;
|
|
@@ -3795,17 +4325,24 @@ exports.buildEvmMultisignBodyMorphoMidnightRepayBatch = buildEvmMultisignBodyMor
|
|
|
3795
4325
|
exports.buildEvmMultisignBodyMorphoVaultDepositBatch = buildEvmMultisignBodyMorphoVaultDepositBatch;
|
|
3796
4326
|
exports.buildEvmMultisignBodyMorphoVaultWithdraw = buildEvmMultisignBodyMorphoVaultWithdraw;
|
|
3797
4327
|
exports.emptyMorphoEarnVaultDetailFields = emptyMorphoEarnVaultDetailFields;
|
|
4328
|
+
exports.encodeMerklDistributorClaimData = encodeMerklDistributorClaimData;
|
|
3798
4329
|
exports.encodeMorphoBlueMarketParamsCallbackData = encodeMorphoBlueMarketParamsCallbackData;
|
|
4330
|
+
exports.encodeMorphoBlueSupplyCalldata = encodeMorphoBlueSupplyCalldata;
|
|
4331
|
+
exports.encodeMorphoBlueWithdrawCalldata = encodeMorphoBlueWithdrawCalldata;
|
|
3799
4332
|
exports.enrichMorphoEarnOfferingRows = enrichMorphoEarnOfferingRows;
|
|
3800
4333
|
exports.enrichMorphoEarnOfferingRowsForAgent = enrichMorphoEarnOfferingRowsForAgent;
|
|
3801
4334
|
exports.ensureMorphoChainAssetCache = ensureMorphoChainAssetCache;
|
|
4335
|
+
exports.fetchAllMerklDistributorClaimLeaves = fetchAllMerklDistributorClaimLeaves;
|
|
4336
|
+
exports.fetchMerklRewardsSummary = fetchMerklRewardsSummary;
|
|
3802
4337
|
exports.fetchMorphoBorrowMarketsForCollateral = fetchMorphoBorrowMarketsForCollateral;
|
|
4338
|
+
exports.fetchMorphoBorrowMarketsForCollaterals = fetchMorphoBorrowMarketsForCollaterals;
|
|
3803
4339
|
exports.fetchMorphoBorrowMarketsForLoan = fetchMorphoBorrowMarketsForLoan;
|
|
3804
4340
|
exports.fetchMorphoChains = fetchMorphoChains;
|
|
3805
4341
|
exports.fetchMorphoEarnOfferingsForAsset = fetchMorphoEarnOfferingsForAsset;
|
|
3806
4342
|
exports.fetchMorphoEarnVaultDetails = fetchMorphoEarnVaultDetails;
|
|
3807
4343
|
exports.fetchMorphoMarketById = fetchMorphoMarketById;
|
|
3808
4344
|
exports.fetchMorphoMarketsForChain = fetchMorphoMarketsForChain;
|
|
4345
|
+
exports.fetchMorphoMarketsWhere = fetchMorphoMarketsWhere;
|
|
3809
4346
|
exports.fetchMorphoMidnightBook = fetchMorphoMidnightBook;
|
|
3810
4347
|
exports.fetchMorphoMidnightBookQuote = fetchMorphoMidnightBookQuote;
|
|
3811
4348
|
exports.fetchMorphoMidnightBooks = fetchMorphoMidnightBooks;
|
|
@@ -3828,22 +4365,35 @@ exports.formatMorphoFeePct = formatMorphoFeePct;
|
|
|
3828
4365
|
exports.formatMorphoMarketApySummary = formatMorphoMarketApySummary;
|
|
3829
4366
|
exports.formatMorphoMidnightAprPct = formatMorphoMidnightAprPct;
|
|
3830
4367
|
exports.formatMorphoUsd = formatMorphoUsd;
|
|
4368
|
+
exports.formatMorphoUtilizationPct = formatMorphoUtilizationPct;
|
|
4369
|
+
exports.isMerklRewardEulLeaf = isMerklRewardEulLeaf;
|
|
3831
4370
|
exports.isMorphoArcChainId = isMorphoArcChainId;
|
|
4371
|
+
exports.isMorphoB20Collateral = isMorphoB20Collateral;
|
|
4372
|
+
exports.isMorphoStockQuery = isMorphoStockQuery;
|
|
3832
4373
|
exports.isMorphoVaultListed = isMorphoVaultListed;
|
|
3833
4374
|
exports.isRobinhoodEarnProductFlag = isRobinhoodEarnProductFlag;
|
|
3834
4375
|
exports.isRobinhoodEarnQuery = isRobinhoodEarnQuery;
|
|
4376
|
+
exports.loadMerklUserRewardsJson = loadMerklUserRewardsJson;
|
|
3835
4377
|
exports.loadMorphoSupportedChainIds = loadMorphoSupportedChainIds;
|
|
4378
|
+
exports.looksLikeMorphoStockTicker = looksLikeMorphoStockTicker;
|
|
3836
4379
|
exports.mapMorphoIncentiveRewards = mapMorphoIncentiveRewards;
|
|
3837
4380
|
exports.marketParamsFromApiRow = marketParamsFromApiRow;
|
|
3838
4381
|
exports.mergeMorphoSupportedChainIds = mergeMorphoSupportedChainIds;
|
|
4382
|
+
exports.merklLeafToRow = merklLeafToRow;
|
|
4383
|
+
exports.merklUserRewardsUrl = merklUserRewardsUrl;
|
|
4384
|
+
exports.morphoAssetLabel = morphoAssetLabel;
|
|
4385
|
+
exports.morphoB20CollateralAddresses = morphoB20CollateralAddresses;
|
|
3839
4386
|
exports.morphoEarnOfferingToDiscoveryRow = morphoEarnOfferingToDiscoveryRow;
|
|
3840
4387
|
exports.morphoFetchBlueMarketsSummary = morphoFetchBlueMarketsSummary;
|
|
3841
4388
|
exports.morphoFetchEarnVaultsSummary = morphoFetchEarnVaultsSummary;
|
|
4389
|
+
exports.morphoFetchMerklRewardsSummary = morphoFetchMerklRewardsSummary;
|
|
3842
4390
|
exports.morphoFetchMidnightBooksSummary = morphoFetchMidnightBooksSummary;
|
|
3843
4391
|
exports.morphoFetchMidnightMakerOffersSummary = morphoFetchMidnightMakerOffersSummary;
|
|
3844
4392
|
exports.morphoFetchMidnightPositionsSummary = morphoFetchMidnightPositionsSummary;
|
|
3845
4393
|
exports.morphoFetchMidnightQuote = morphoFetchMidnightQuote;
|
|
3846
4394
|
exports.morphoFetchMidnightQuoteSummary = morphoFetchMidnightQuoteSummary;
|
|
4395
|
+
exports.morphoFetchPositionsSummary = morphoFetchPositionsSummary;
|
|
4396
|
+
exports.morphoFetchStockMarketsSummary = morphoFetchStockMarketsSummary;
|
|
3847
4397
|
exports.morphoGql = morphoGql;
|
|
3848
4398
|
exports.morphoKeyForAssetRow = morphoKeyForAssetRow;
|
|
3849
4399
|
exports.morphoMarketToBorrowRow = morphoMarketToBorrowRow;
|
|
@@ -3863,11 +4413,15 @@ exports.morphoMidnightTtmSeconds = morphoMidnightTtmSeconds;
|
|
|
3863
4413
|
exports.morphoMidnightUnitsFromAssets = morphoMidnightUnitsFromAssets;
|
|
3864
4414
|
exports.morphoProtocolModule = morphoProtocolModule;
|
|
3865
4415
|
exports.morphoResolveListedEarnVaultByAddress = morphoResolveListedEarnVaultByAddress;
|
|
4416
|
+
exports.parseMerklUserRewardsToLeaves = parseMerklUserRewardsToLeaves;
|
|
3866
4417
|
exports.parseMorphoMidnightAprInput = parseMorphoMidnightAprInput;
|
|
3867
4418
|
exports.parseMorphoMidnightPriceWad = parseMorphoMidnightPriceWad;
|
|
3868
4419
|
exports.pickBestBlueSupplyMarketForLoan = pickBestBlueSupplyMarketForLoan;
|
|
3869
4420
|
exports.previewMorphoBlueHealthAfterCollateralWithdraw = previewMorphoBlueHealthAfterCollateralWithdraw;
|
|
4421
|
+
exports.resolveMorphoAssetRef = resolveMorphoAssetRef;
|
|
3870
4422
|
exports.resolveRobinhoodEarnFetchQuery = resolveRobinhoodEarnFetchQuery;
|
|
3871
4423
|
exports.searchMorphoListedEarnVaults = searchMorphoListedEarnVaults;
|
|
4424
|
+
exports.selectFirstRootMerklLeaves = selectFirstRootMerklLeaves;
|
|
4425
|
+
exports.selectWalletWideMerklClaimLeaves = selectWalletWideMerklClaimLeaves;
|
|
3872
4426
|
//# sourceMappingURL=index.cjs.map
|
|
3873
4427
|
//# sourceMappingURL=index.cjs.map
|