Divvi Protocol - KPI calculation functions / baseV0
Functions
calculateKpi()
- HyperSync: Transaction and gas usage data from Base network via HyperSync client
- Block Data: Timestamps via
getBlockRange
utility for temporal filtering
- Gas usage accurately represents computational resource consumption
- User’s infrastructure impact is proportional to total gas consumed within time window
- All transaction types contribute equally to network utilization regardless of purpose
- Gas measurements include both successful and failed transaction attempts
- Infrastructure funding allocation can be based on proportional gas contribution
- Queries all transactions initiated by user wallet within the specified time window
- 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 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)
redis?
RedisClientType
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 and metadata including total transactions
Suggest changes to this pageLast updated: Aug 6, 2025, 3:51 PM