Skip to content

Commit c8826cc

Browse files
authored
Fix:Dinari (DefiLlama#15352)
1 parent 0fd7bfb commit c8826cc

File tree

1 file changed

+13
-24
lines changed

1 file changed

+13
-24
lines changed

projects/dinari/index.js

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,25 @@ const config = {
1919
usdplus: "0x98C6616F1CC0D3E938A16200830DD55663dd7DD3"
2020
},
2121
plume: {
22-
factory: "0x84ad0De589B0075E057123c800959f10C29869D8"
22+
// factory: "0x84ad0De589B0075E057123c800959f10C29869D8"
2323
},
2424
plume_mainnet: {
2525
factory: "0x7a861Ae8C708DC6171006C57c9163BD2BB57a8Aa",
2626
usdplus: "0x1fA3671dF7300DF728858B88c7216708f22dA3Fb"
2727
}
2828
}
2929

30-
async function getTokens(api) {
31-
const abi = config[api.chain].getTokensAbi ?? "function getDShares() external view returns (address[] memory, address[] memory)"
32-
return (await api.call({
33-
target: config[api.chain].factory,
34-
abi
35-
}))[0];
30+
const abi = "function getDShares() external view returns (address[] memory, address[] memory)"
31+
32+
const tvl = async (api) => {
33+
const { factory, usdplus } = config[api.chain]
34+
if (usdplus) api.add(usdplus, await api.call({ target: usdplus, abi: 'erc20:totalSupply'}))
35+
if (!factory) return
36+
const [tokens] = await api.call({ target: factory, abi })
37+
const balances = await api.multiCall({ calls: tokens, abi: 'erc20:totalSupply' })
38+
api.add(tokens, balances)
3639
}
3740

38-
Object.keys(config).forEach( chain => {
39-
module.exports[chain] = {
40-
tvl: async (api) => {
41-
// get dShare tokens
42-
const tokens = await getTokens(api, chain)
43-
const bals = await api.multiCall({ chain: chain, abi: 'erc20:totalSupply', calls: tokens})
44-
// add USD+
45-
const usdplus = config[chain].usdplus
46-
if (usdplus) {
47-
const usdplusBal = await api.call({chain: chain, target: usdplus, abi: 'erc20:totalSupply'})
48-
tokens.push(usdplus)
49-
bals.push(usdplusBal)
50-
}
51-
api.add(tokens, bals)
52-
}
53-
}
54-
})
41+
Object.keys(config).forEach((chain) => {
42+
module.exports[chain] = { tvl }
43+
})

0 commit comments

Comments
 (0)