Spock Analytics
  • Introduction
  • The Spock Thesis
  • Spock Analytics
    • Explore: The Data Warehouse for DApps
    • Probe: Strategic Data Reports
    • Engage: Improve User Conversion and Retention
  • Spock API
    • Build Custom Campaigns Using On-chain Data
    • Decipher Web3 Wallets Landscape
  • Guides
    • Maximize NFT Lending: Strategies For NFTFi DApps
    • 10x NFT Borrower Engagement: Strategies For NFTFi DApps
    • Offer Gas Refunds to Newly Converted Users
    • Boost Your Liquidity Providers Conversion Rate
    • Increase Transaction Submissions by 15% Using Probe
  • Configuration
    • Onboarding
    • Contracts
    • SDK
      • API Reference
      • Supporting Wallets
      • NPM Package
      • Example Application
      • SDK Code
    • Adapter
      • Transformers
      • TVL Extractors
      • How to code an adapter?
      • Functions we have written so you don't have to
        • Multicall
        • Sum Balances
      • GitHub repo
  • Pricing
    • Explore & Probe
    • Engage
    • Pricing Calculations & FAQs
  • Data Catalog
    • Wallet
    • Global
    • This Protocol
    • Session
    • Other Protocols
    • Transaction
Powered by GitBook
On this page
  • sumBalancesUSD
  • tokenBalanceUSD
  • sumSingleBalance
  • sumMultipleBalance
  1. Configuration
  2. Adapter
  3. Functions we have written so you don't have to

Sum Balances

Functions for adding up the balances or their USD conversions.

PreviousMulticallNextExplore & Probe

Last updated 1 year ago

sumBalancesUSD

It calculates the USD prices of given tokens and can then converts the balances of given tokens into USD and returns their total sum.

tokenBalanceUSD

Works similarly to sumBalanceUSD, and can be used when you have to convert a single token balance into USD.

sumSingleBalance

Used for adding balances of tokens one by one in TVL calculation.

sumMultipleBalance

Adding up multiple token balances returned from the abi.erc20MultiBalanceOf method in TVL calculation.

spock-adapters/sumBalances.ts at main · xorddotcom/spock-adaptersGitHub
spock-adapters/sumBalances.ts at main · xorddotcom/spock-adaptersGitHub
spock-adapters/sumBalances.ts at main · xorddotcom/spock-adaptersGitHub
spock-adapters/sumBalances.ts at main · xorddotcom/spock-adaptersGitHub
Logo
Logo
Logo
Logo