id
, underlyingAddress
, etc.) are lowercase (i.e. not checksummed). Be sure to convert addresses to lowercase first before making queries.totalSubscriptions
on the Index
, AccountTokenSnapshot
and TokenStatistic
types is now totalSubscriptionsWithUnits
.Subscriber
entity has been changed to Subscription
. If you have been using the subscriber
property when querying any events, this has been changed to subscriptions
everywhere. The only place where subscriber
is still a field is on the Subscription
entity as a property of type Account
.createdAt
and updatedAt
fields are now createdAtTimestamp
and updatedAtTimestamp
on every type.schema.graphql
file and will be viewable in the playground as well. These entities are created once and never updated. For example, the FlowUpdatedEvent
type will mirror the properties on the FlowUpdated
event inside of the Superfluid contracts.Note: Each event entityid
is formulated as follows:eventName-transactionHash-logIndex
.
Note: event types in our legacy subgraph did not have 'Event' appended onto the end of their name. In our new v1 implementation, every event type is named 'Event Name' + 'Event.' For example,FlowUpdated
is nowFlowUpdatedEvent
andIndexCreated
is nowIndexCreatedEvent
. This schema is applied to every other event type as well.
Account
Token
Index
Index
within a Superfluid instant distribution agreement (IDA)IndexSubscription
subscriber
account of a particular index
Stream
sender
and a receiver
. An account can create a stream or update its flow rate, but when they delete it, it is considered "dead." The next stream that is created between the same sender
and receiver
will generate a new stream entity. Therefore, multiple stream entities can be created between the same sender
and receiver
.StreamPeriod
Stream
with a specific constant flowRate. You can think of it as a portion of a Stream
. Each time a Stream's flowRate
is updated, a new StreamPeriod
will be created.Note: the stream type is a replacement for the previously used Flow type (as of October '21). The below image provides a good visual outline of how theStream
andStreamPeriod
types compare to the previously usedFlow
type.
TokenStatistic
AccountTokenSnapshot
token
.first
parameterNote: keep in mind that a maximum of 1000 items may be returned in a single query.
token
will return the token entity type - with the symbol
and id
in this case.createdAtTimestamp
will return the timestamp at which the stream
was created.updatedAtTimestamp
will return the timestamp of the last time the stream was updated.currentFlowRate
will return the current flow rate of the stream.streamedUntilUpdatedAt
will return the amount streamed until updatedAtTimestamp
/updatedAtBlock
Note: to get the current (dynamic) total amount streamed, you can use the following formula: streamedUntilUpdatedAt + ((current time in seconds) - updatedAtTimestamp) * currentFlowRate
first
, orderBy
and orderDirection
to get the 10 most recently updated flows.Note: as explained in the previous higher order level entities section under theStream
type, it's important to understand the difference between a Flow and a Stream. A Flow represents all streaming activity between 2 addresses for a given token, while a Stream may only represent a portion of that flow. A new stream period is created each time theflowRate
is updated, and a new stream is created each time a stream is terminated and restarted again (with the creation happening upon restarting)
oldFlowRate
- the flowRate of the previous stream (will return "0" if this is a newly created Flow)flowRate
- the flowRate of the current streamstream
- the Stream type associated with the flow. In our case, the next few items will come from the Stream type. Several streams may be returned if there have been multiple streams created for this flow
.token
- the token
used in the updated flow. Here we are returning this token's symbol
sender
- the sender
of the updated flow. Here we will return this sender's id
(their address)receiver
- the receiver
of the updated flow. Here we will return this receiver's id
(their address)subscriptions
will return an IndexSubscription
type for each Index
that this account is subscribed totoken
- the Token
used in each subscription. Here we display the symbol
.id
- the ID of the IndexSubscription
. This ID is composed of: subscriberAddress
-publisherAddress
-tokenAddress
-IndexId
approved
- a boolean value that represents whether or not the subscription is approved
. Approved subscriptions don't require subscribers to claim tokens that are distributed from the publisher.units
- the total number of units allocated to this account in the index. If units
is 0, it indicates that the subscription is "deleted". They are no longer subscribed to the index.totalAmountReceivedUntilUpdatedAt
- the total amount of tokens that this account has received via this IDA index until updatedAtTimestamp
/updatedAtBlock
.indexValue
- used to calculate the distribution amount that a user receives when the publisher updates the index value. The distribution amount can be calculated using the following formula:(index.indexValue - subscriber.indexValue) * subscriber.units
totalUnitsPending
- he number of units allocated by the Index
that are pending. This refers to the current (as of updatedAt) totalUnitsPending
- not all that has ever been pending.totalUnitsApproved
- he number of units allocated by the Index
that have been approved. This refers to the current (as of updatedAt) totalUnitsApproved
- not all that has ever been approved.totalUnits
- the sum of totalUnitsPending
and totalUnitsApproved
.token
- the type Token
used in the index.symbol
- the symbol of the Token
used in the indextotalNumberOfActiveStreams
- the total count of active streams using the token.totalNumberOfActiveIndexes
- total number of active IDA indexes for the token.totalAmountStreamedUntilUpdatedAt
- all-time total amount streamed until the updatedAtTimestamp
/updatedAtBlock
.totalOutFlowRate
- total outflow rate of the token
(how much value is being moved).totalAmountDistributedUntilUpdatedAt
- all-time total amount distributed until the updatedAtTimestamp
/updatedAtBlock
.Account
entity will return an AccountTokenSnapshot
for every token used for each id
(i.e. for each Account's address).Account
entity:isSuperApp
- returns true
if the account is a super app, false
if not.inflows
- will return all Streams
where Account
is the sender
.outflows
- will return all Streams
where Account
is the receiver
.AccountTokenSnapshot
entity:token
- the address of the token used in streams or subscriptionstotalNumberOfActiveStreams
- the total number of streams the account is associated with for the given tokentotalNetFlowRate
- the total net flow rate of the account
for the given token as of updatedAtTimestamp
/updatedAtBlock
.NOTE: Please refer to the above section on Breaking Changes as of October 2021, and the section on Streams vs Flows in the above section on the V1 Subgraph documentation. For example, you'll notice in the below example that theFlow
type is used in a query. This type has been deprecated.
sum
since the last on-chain event (flowUpdated
, flowCreated
, or flowDeleted
). Therefore, if flowRate
is greater than zero, you will need to calculate the tokens flowed since the last event. Use this equation to get the the total sum of tokens flowed: