Skip to main content

fonbnk

Divvi Protocol - KPI calculation functions


Divvi Protocol - KPI calculation functions / fonbnk

fonbnk

Functions

calculateKpi()

function calculateKpi(params): Promise<KpiResult<string>>

Defined in: fonbnk/index.ts:215

Calculates cash-in transaction volume from Fonbnk payout wallets to user.

KPI Unit: USD (United States Dollars)

Business Purpose: Measures the transaction volume attributable to cash-in transactions where a specific user receives payments from Fonbnk payout wallets. This metric quantifies the economic activity generated by Fonbnk's mobile telecom service distributions and supports transaction volume analysis.

Protocol Context: Fonbnk is a mobile telecom service platform that allows users to purchase airtime, data, and other mobile services using cryptocurrency. It operates across multiple networks and facilitates mobile service transactions for users globally.

Supported Networks: Multiple EVM-compatible networks where Fonbnk operates mobile telecom services

Data Sources:

  • HyperSync: Token transfer events from Fonbnk payout wallets to user addresses
  • Fonbnk API: Payout wallet discovery via GET /api/util/payout-wallets endpoint
  • Token Price API: Historical token prices via fetchTokenPrices utility for USD conversion
  • Block Data: Timestamps via getBlockRange utility for temporal filtering
  • Network RPCs: Multi-network transaction data via Viem public clients

Business Assumptions:

  • Transaction volume is measured by token transfers from Fonbnk payout wallets to user
  • User's volume contribution is the sum of all transfers received within the time window
  • USD conversion uses token prices at time of each transaction for accuracy
  • Only transfers from verified Fonbnk payout addresses are included
  • Transaction volume represents cash-in transactions from Fonbnk services

Service Types: Airtime top-ups, mobile data packages, mobile banking services, and other telecom services

Calculation Method:

  1. Retrieves verified Fonbnk payout wallet addresses from Fonbnk API
  2. Queries token transfer events from Fonbnk payout wallets to user address across all supported networks
  3. Filters transfers by the specified time window using block timestamp data
  4. Converts transfer amounts to USD using historical token prices at transaction timestamps
  5. Aggregates USD volume across all networks and token types
  6. Returns total transaction volume representing cash-in transactions received from Fonbnk

Parameters

params

Calculation parameters

address

string

User wallet address to calculate transaction volume for

endTimestampExclusive

Date

End of time window for volume calculation (exclusive)

startTimestamp

Date

Start of time window for volume calculation (inclusive)

Returns

Promise<KpiResult<string>>

Promise resolving to total cash-in transaction volume in USD