Skip to content

Commit 4af1cdb

Browse files
fix multicall issue
1 parent 54281d1 commit 4af1cdb

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

projects/multichainz/index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,18 @@ const tvl = async (api) => {
5555
const borrowed = async (api) => {
5656
const { pool } = config[api.chain]
5757
const tokens = (await getTokens(api, pool)).filter(addr => addr.toLowerCase() !== ADDRESSES.null)
58-
const bals = await api.multiCall({ abi: abi.getTotalTokenBorrowed, calls: tokens, target: pool })
59-
api.add(tokens, bals)
58+
59+
// For plume_mainnet, avoid multiCall due to Multicall3 issues
60+
if (api.chain === 'plume_mainnet') {
61+
// Make individual calls instead of multiCall
62+
for (const token of tokens) {
63+
const bal = await api.call({ abi: abi.getTotalTokenBorrowed, target: pool, params: [token] })
64+
api.add(token, bal)
65+
}
66+
} else {
67+
const bals = await api.multiCall({ abi: abi.getTotalTokenBorrowed, calls: tokens, target: pool })
68+
api.add(tokens, bals)
69+
}
6070
}
6171

6272
module.exports.methodology = "Counts the tokens locked in the multichainz pool contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. The TVL calculation includes all tokens held by the pool contract, and DefiLlama automatically subtracts borrowed amounts to show available liquidity."
@@ -65,3 +75,4 @@ Object.entries(config).forEach(([chain, { deprecated, isStakingPool }]) => {
6575
? { tvl: () => ({}), borrowed: () => ({}) }
6676
: isStakingPool ? {tvl} : { tvl, borrowed }
6777
})
78+

0 commit comments

Comments
 (0)