Skip to content

Commit bad5d6a

Browse files
authored
Feat/morpho (#15057)
1 parent f7adc82 commit bad5d6a

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

projects/helper/abis/morpho.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,8 @@
1616
"idToMarketParams": "function idToMarketParams(bytes32 Id) returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv)",
1717
"market": "function market(bytes32 input) returns (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee)"
1818
},
19+
"metaMorphoFunctions": {
20+
"withdrawQueueLength": "function withdrawQueueLength() view returns (uint256)"
21+
},
1922
"pool": {}
2023
}

projects/morpho-blue/index.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ const config = {
8181
fromBlock: 3669141,
8282
},
8383
*/
84-
basecamp:{
85-
morphoBlue: "0xc7CAd9B1377Eb8103397Cb07Cb5c4f03eb2eBEa8",
86-
fromBlock: 4804080,
87-
blackList: ['0x68d6024e5168f16d3453a23b36f393a559be7aef'],
88-
},
84+
// basecamp:{
85+
// morphoBlue: "0xc7CAd9B1377Eb8103397Cb07Cb5c4f03eb2eBEa8",
86+
// fromBlock: 4804080,
87+
// blackList: ['0x68d6024e5168f16d3453a23b36f393a559be7aef'],
88+
// },
8989
hyperliquid:{
9090
morphoBlue: "0x68e37dE8d93d3496ae143F2E900490f6280C57cD",
9191
fromBlock: 1988429,
@@ -118,13 +118,25 @@ Object.keys(config).forEach((chain) => {
118118
const lowerCaseBlacklist = blacklistedMarketIds.map(id => id.toLowerCase());
119119
marketIds = marketIds.filter(id => !lowerCaseBlacklist.includes(id.toLowerCase()));
120120
}
121-
const tokens = (
122-
await api.multiCall({
123-
target: morphoBlue,
124-
calls: marketIds,
125-
abi: abi.morphoBlueFunctions.idToMarketParams,
126-
})
127-
)
121+
const marketInfo = await api.multiCall({
122+
target: morphoBlue,
123+
calls: marketIds,
124+
abi: abi.morphoBlueFunctions.idToMarketParams,
125+
});
126+
127+
// Filter out MetaMorpho vaults using multiCall
128+
const withdrawQueueLengths = await api.multiCall({
129+
calls: marketInfo.map(m => m.collateralToken),
130+
abi: abi.metaMorphoFunctions.withdrawQueueLength,
131+
permitFailure: true,
132+
});
133+
134+
const filteredMarketInfo = marketInfo.filter((_, i) => {
135+
const length = withdrawQueueLengths[i];
136+
return length === null || length > 30 || length < 0;
137+
});
138+
139+
const tokens = filteredMarketInfo
128140
.map((i) => [i.collateralToken, i.loanToken])
129141
.flat();
130142

0 commit comments

Comments
 (0)