mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-04-29 05:15:28 +08:00
* ic * revert package lock change * bump version --------- Co-authored-by: 0xngmi <0xngmi@protonmail.com>
33 lines
674 B
JavaScript
33 lines
674 B
JavaScript
const sdk = require("@defillama/sdk");
|
|
const { graphQuery } = require('../helper/http')
|
|
|
|
const subgraphUrl = sdk.graph.modifyEndpoint('9xteTELUdzjii1yLASJm6CxSpYuS1bmE6DGWMMhgkq2k');
|
|
|
|
const vaultsQuery = `
|
|
query {
|
|
vaults {
|
|
baseToken {
|
|
id
|
|
priceByUsd
|
|
decimals
|
|
}
|
|
id
|
|
availableAmount
|
|
totalDeposit
|
|
totalDebt
|
|
}
|
|
}
|
|
`;
|
|
|
|
async function tvl(api) {
|
|
const { vaults } = await graphQuery(subgraphUrl, vaultsQuery)
|
|
vaults.forEach(({ baseToken: { id, decimals }, totalDebt, totalDeposit}) => {
|
|
api.add(id, (totalDeposit - totalDebt) * ( 10 ** decimals))
|
|
})
|
|
}
|
|
|
|
module.exports = {
|
|
arbitrum: {
|
|
tvl,
|
|
}
|
|
};
|