Skip to content

Commit 34203a9

Browse files
0xpeluche0xpelucheg1nt0ki
authored
Fix adapter, Phuture outdated (7d) (DefiLlama#11446)
Co-authored-by: 0xpeluche <[email protected]> Co-authored-by: g1nt0ki <[email protected]>
1 parent 2c8b106 commit 34203a9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

projects/phuture/index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,19 @@ const indexTvl = (chain) => async (timestamp, block, chainBlocks) => {
7171

7272
const savingsVaultTvl = (chain) => async (api) => {
7373
const calls = networks[chain]["savingsVaults"]
74-
const assets = await api.multiCall({
75-
abi: savingsVaultAbi.asset, calls,
76-
})
77-
const totalAssets = await api.multiCall({
78-
abi: savingsVaultAbi.totalAssets, calls,
79-
})
80-
const balances = {}
74+
const [assets, totalAssets] = await Promise.all([
75+
api.multiCall({ abi: savingsVaultAbi.asset, calls }),
76+
api.multiCall({ abi: savingsVaultAbi.totalAssets, calls, permitFailure: true })
77+
])
8178

82-
totalAssets.forEach((bal, i) => {
83-
const token = assets[i]
84-
if (!bal && calls[i].toLowerCase() === '0x6bad6a9bcfda3fd60da6834ace5f93b8cfed9598') return;
85-
sdk.util.sumSingleBalance(balances, token, bal, chain)
79+
const balances = {};
80+
calls.forEach((call, i) => {
81+
const asset = assets[i]
82+
const bal = totalAssets[i]
83+
if(!bal) return;
84+
sdk.util.sumSingleBalance(balances, asset, bal, chain)
8685
})
86+
8787
return balances
8888
};
8989

0 commit comments

Comments
 (0)