Skip to content

Calculating TVL for the pool contracts #11057

Answered by 0xtomoon
0xmonkeyking asked this question in Q&A
Discussion options

You must be logged in to vote

@0xmonkeyking
There are several functions in the projects/helper/unWrapLPs.js
You can use sumTokens2 function to get tokens balance from pool contracts.

https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/stargatefinance-v2/index.js#L91

const createTvlFunction = (pools) => {
  return async (api) => {
    const tokens = await api.multiCall({ abi: 'address:token', calls: pools, })
    return sumTokens2({ api, tokensAndOwners2: [tokens, pools] })
  };
};

Here is one example which uses sumTokens2. Hope it answers your question.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by 0xmonkeyking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants