Skip to content

Conversation

MarkChen1213866
Copy link

@MarkChen1213866 MarkChen1213866 commented Sep 1, 2025

This PR fixes the TVL calculation precision issues in the volo-vsui adapter:

  • Corrected token decimal handling for USDC, xBTC, and wBTC
  • Removed unnecessary try-catch blocks
  • Fixed total TVL calculation to properly sum all tokens

Replace old API endpoint with NAVI Open API for vault TVL data
@llamabutler
Copy link

The adapter at projects/volo-vsui exports TVL:

sui                       0

total                    0.07881206981510985 

@llamabutler
Copy link

Error while running adapter at projects/volo-vsui:

Error: 
    Please move the following keys into the chain: tvl

    We have a new adapter export specification now where tvl and other chain specific information are moved inside chain export.
    For example if your protocol is on ethereum and has tvl and pool2, the export file would look like:
    
        module.exports = {
          methodlogy: '...',
          ethereum: {
            tvl: 
            pool2:
          }
        }

    
Error saving cache: Error: ENOENT: no such file or directory, open '/home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/node_modules/@defillama/sdk/build/util/local_cache/zlib-1.0/BlockCache.json'


async function getVaultTVL() {
try {
const response = await axios.get(`${naviApiURL}/api/volo/volo-vaults?type=tvl`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use on chain data and our sui helper functions

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of our protocol’s design, we cannot compute TVL by reading objects directly, it must be derived from event emissions. This PR follows the same approach as Haedal vaults by fetching vault metadata from API and helper to aggregate balances. Please understand this is the only feasible way to calculate TVL on our protocol, and future changes can simply adjust the packageId or API endpoint without modifying on-chain logic. Thank you for understanding🙏

console.error('Invalid response format from NAVI API:', response.data);
return {};
}
} catch (error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please no try catch

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@waynebruce0x
Copy link
Collaborator

please fill the PR description

@waynebruce0x
Copy link
Collaborator

and please test before maing a PR, see the CI errors

@waynebruce0x waynebruce0x self-assigned this Sep 1, 2025
@llamabutler
Copy link

Error while running adapter at projects/volo-vsui:

Error: 
    Please move the following keys into the chain: tvl

    We have a new adapter export specification now where tvl and other chain specific information are moved inside chain export.
    For example if your protocol is on ethereum and has tvl and pool2, the export file would look like:
    
        module.exports = {
          methodlogy: '...',
          ethereum: {
            tvl: 
            pool2:
          }
        }

    
Error saving cache: Error: ENOENT: no such file or directory, open '/home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/node_modules/@defillama/sdk/build/util/local_cache/zlib-1.0/BlockCache.json'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants