Token & DeFi balances

Definition

Balance data represents the portfolio structure of a specific wallet. It is a list of all crypto assets on the balance and DeFi positions (investments). We will operate with the following terminology:

Wallet - blockchain public address.

So this is the key enter to the group of endpoints and initial goal of Lambda - to provide portfolio data for wallets.

Crypto assets on the balance - tokens held in the balance of a specific wallet.

Pretty common data feed.

DeFi positions (investments) - tokens on the address of a smart contract (DeFi protocol) that were locked or generated as a result of the wallet’s interaction with that protocol.
We refer to such interactions as investments.

Examples of DeFi investment scenarios include:

  1. Liquid Staking. A user calls the stake method from their wallet via a UI or dApp. As a result, ETH is debited and added to a common pool, and in exchange, stETH (equivalent to the staked ETH) is received in the wallet. These stETH will grow in value relative to the user's share in the pool.
  2. Liquidity providing to a DEX pool (Yield generation protocol). Tokens are transferred to the pool’s (vault’s) address. They may have specific withdrawal periods or rates, and LP tokens are generated as rewards. These LP tokens may stay in the protocol and only appear in the wallet balance upon a claim action.
  3. Borrowing tokens in exchange for collateral on a Lend-Borrow protocol. Collateral is locked in the protocol, and the borrowed assets are transferred to the wallet. Thus, two positions are created: one on the smart contract address and another on the wallet.

There are even more complex combinations of DeFi positions, which is why we created Lambda—to standardize portfolio tracking for applications developing UIs for interacting with Web3.

API endpoints

  1. Get current balances (tokens and deFi investments): Get Balances API method
  2. Get historical balances: Get Balance History API method