Other Helpful Queries
Other useful queries for your integration
Other Helpful Queries
How can I query month-on-month stats for Superfluid stream senders? e.g. monthly amount streamed, number of streams started/stopped, etc?
π‘ NOTE: you probably want to define what start/end of the month means and be consistent and transparent about it: e.g. 12AM of the first of month 11:59PM on the last day of the month.
ATS = AccountTokenSnapshot
it requires queries at the start and end of a month and a set of sender addresses and tokens they are interested in.
find the
block.timestamp
for the months youβre interested inexecute a query for
ATS
(s) for a set of senders and token at the start of a month/end of a month (timestamps).you could then get the delta between the two entities (end date
ATS
- start dateATS
) on the two queries on the follow fields ofAccountTokenSnapshot
totalNumberOfActiveStreams
totalNumberOfClosedStream
totalAmountStreamedInUntilUpdatedAt
for this last property, you need to do a check for both the start and end of month timestamp values you used for the query and check if it is equal to
updatedAtTimestamp
(itβs pretty much almost never going to be)and youβll need to calculate the actual
totalAmountStreamedIn
e.g. if
totalAmountStreamedUntilUpdatedAt = 1
,updatedAtTimestamp = 10
andstart of month timestamp = 15
andoutflowRate = 1
, your actualtotalAmountStreamedIn
for start of month is6
Youβll have to do the same for the end of the month
Last updated