Divvi Protocol - KPI calculation functions / arbitrum
Functions
calculateKpi()
- HyperSync: Transaction and gas usage data from Arbitrum network via HyperSync client
- Block Data: Timestamps via
getBlockRange
utility for temporal filtering
- 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
- Queries all transactions initiated by user wallet within the specified time window on Arbitrum
- Retrieves transaction receipts to extract gas used for each transaction
- Filters transactions by block timestamp to ensure they fall within the time range
- Aggregates total gas consumed across all user transactions
- Returns total gas usage representing user’s Layer 2 infrastructure utilization
Parameters
params
Calculation parametersaddress
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
Suggest changes to this pageLast updated: Aug 6, 2025, 3:51 PM