Overview
ERC20TvlModule contract handles the calculation of TVL for ERC20 tokens within a vault. It provides a standardized mechanism to assess the value of a vault’s ERC20 assets.
Key Features
- TVL Calculation: Computes the total value locked for each ERC20 token held in a vault.
- Direct Balance Access: Uses the ERC20
balanceOffunction to assess token balances. - Accurate Accounting: Returns detailed data structures containing token information and their amounts.
Core Method
- TVL Calculation
tvl(address): Computes the total value locked for all ERC20 tokens in a given vault.- vault: The address of the vault.
- Returns: An array of
Datastructures containing information on each ERC20 token:- token: Address of the ERC20 token.
- underlyingToken: Same as
tokenbecause it’s an ERC20 token. - amount: The balance of the token held by the vault.
- underlyingAmount: Identical to
amount.