Skip to main content

arbitrum

Divvi Protocol - KPI calculation functions


Divvi Protocol - KPI calculation functions / arbitrum

arbitrum

Functions

calculateKpi()

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

Defined in: arbitrum/index.ts:47

Calculates gas usage for Arbitrum network activity.

KPI Unit: Gas units (computational units consumed)

Business Purpose: Measures the computational resources (gas) consumed by a specific user's transactions on Arbitrum network. This metric quantifies the infrastructure utilization generated by user interactions and supports gas usage analysis for Layer 2 scaling solutions and network efficiency.

Protocol Context: Arbitrum is a Layer 2 scaling solution for Ethereum that uses optimistic rollups to provide faster and cheaper transactions. Gas usage tracking helps measure network utilization and infrastructure impact of user activities on the Layer 2 network.

Network: Arbitrum One (Layer 2)

Data Sources:

  • HyperSync: Transaction and gas usage data from Arbitrum network via HyperSync client
  • Block Data: Timestamps via getBlockRange utility for temporal filtering

Business Assumptions:

  • Gas usage accurately represents computational resource consumption on Layer 2
  • User's network impact is proportional to total gas consumed within time window
  • Layer 2 gas measurements provide meaningful metrics for infrastructure utilization
  • All transaction types contribute to network utilization regardless of purpose
  • Gas consumption patterns on Arbitrum reflect user engagement with Layer 2 infrastructure

Gas Types: Transaction execution gas, contract interaction gas, token transfer gas, and smart contract deployment gas

Calculation Method:

  1. Queries all transactions initiated by user wallet within the specified time window on Arbitrum
  2. Retrieves transaction receipts to extract gas used for each transaction
  3. Filters transactions by block timestamp to ensure they fall within the time range
  4. Aggregates total gas consumed across all user transactions
  5. Returns total gas usage representing user's Layer 2 infrastructure utilization

Parameters

params

Calculation parameters

address

string

User wallet address to calculate gas usage for

endTimestampExclusive

Date

End of time window for gas calculation (exclusive)

startTimestamp

Date

Start of time window for gas calculation (inclusive)

Returns

Promise<KpiResult<string>>

Promise resolving to total gas units consumed by user's transactions on Arbitrum