QuoteGroupFunding
Aggregated funding for one grouped position, folded from the per-quote QuoteFundingData rows the analytics subgraph returned for its children. Produced by aggregateGroupFunding.
Every amount is 18-decimal wei bigint, matching UnifiedQuote.
Sign convention — netReceived = received − paid, the P&L perspective. A positive netReceived means the group has earned funding; a negative one means it has paid for it. This matches QuoteFundingData.netReceived and QuoteGroupUpnl.upnl, so a “green = income” UI renders it directly. It is the inverse of the on-chain int256, which is cost-positive.
Settled to date only — these totals cover funding the protocol has already charged and the analytics subgraph has indexed. Funding accrued since the last charge is not included: it is not indexed anywhere, so it cannot be part of this sum.
Properties
paidbigintrequiredΣ funding partyA paid across the group’s resolved children (wei).
receivedbigintrequiredΣ funding partyA received across the group’s resolved children (wei).
netReceivedbigintrequiredΣ received − paid across the group’s resolved children (wei). Positive = the group earned funding; negative =
it paid for it. A lower bound while isComplete is false — it is never suppressed to 0n.
resolvedCountnumberrequiredNumber of distinct child quote ids that produced a funding row.
expectedCountnumberrequiredNumber of distinct on-chain quote ids among the children — the rows this group expects. Optimistic children (no
quoteId yet) are not counted.
missingQuoteIdsbigint[]requiredExpected quote ids with no funding row yet (subgraph indexing lag), in the order the ids first appear in the group’s children.
isCompletebooleanrequiredtrue only when the group has at least one on-chain child and every one of them resolved — i.e. the amounts
above are the group’s complete settled-to-date funding. Check it before presenting netReceived as final.
Why a consumer must check isComplete
netReceived is always the sum over whatever resolved, so an incomplete aggregate still renders a number — just a smaller one than the truth. isComplete: false means one of two things, and both are “funding unknown”, never “no funding”:
missingQuoteIdsis non-empty — the subgraph has not indexed those children yet. Show a loading or partial state.expectedCountis0— the group is all-optimistic (or empty), so there is nothing to resolve.netReceivedis0nbecause nothing was summed, not because funding was zero.
if (!funding.isComplete) {
/** Still indexing (or nothing on-chain yet) — do not render `netReceived` as the final total. */
return <FundingSkeleton />;
}Related
aggregateGroupFunding— produces this.QuoteGroup— the grouped position whosequotesare folded.QuoteGroupMetrics— the price-independent metrics on the same group.- React
useQuoteGroupFunding— the hook that returns this for a live group.