Skip to content

Commit

Permalink
update entities based on new subgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparkallas committed Mar 26, 2024
1 parent cc9cb43 commit 8131d69
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 76 deletions.
10 changes: 7 additions & 3 deletions packages/sdk-core/src/subgraph/entities/pool/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ export interface Pool {
totalAmountInstantlyDistributedUntilUpdatedAt: BigNumber;
totalAmountFlowedDistributedUntilUpdatedAt: BigNumber;
totalAmountDistributedUntilUpdatedAt: BigNumber;
totalFlowAdjustmentAmountDistributedUntilUpdatedAt: BigNumber;
totalUnits: BigNumber;
totalConnectedUnits: BigNumber;
totalDisconnectedUnits: BigNumber;
perUnitSettledValue: BigNumber;
perUnitFlowRate: BigNumber;
/**
* A member is any account which has more than 0 units in the pool.
*
*/
totalMembers: number;
/**
* A connected member is any account which has more than 0 units in the pool and is connected.
*
*/
totalConnectedMembers: number;
/**
* A disconnected member is any account which has more than 0 units in the pool and is not connected.
*
*/
totalDisconnectedMembers: number;
adjustmentFlowRate: BigNumber;
Expand Down Expand Up @@ -110,6 +110,10 @@ export class PoolQueryHandler extends SubgraphQueryHandler<
x.totalAmountFlowedDistributedUntilUpdatedAt,
totalAmountDistributedUntilUpdatedAt:
x.totalAmountDistributedUntilUpdatedAt,
totalFlowAdjustmentAmountDistributedUntilUpdatedAt:
x.totalFlowAdjustmentAmountDistributedUntilUpdatedAt,
perUnitFlowRate: x.perUnitFlowRate,
perUnitSettledValue: x.perUnitSettledValue,
admin: x.admin.id,
token: x.token.id,
}));
Expand Down
85 changes: 44 additions & 41 deletions packages/sdk-core/src/subgraph/entities/pool/pools.graphql
Original file line number Diff line number Diff line change
@@ -1,51 +1,54 @@
query getPool($id: ID!) {
pool(id: $id) {
...PoolPart
}
pool(id: $id) {
...PoolPart
}
}

query pools(
$first: Int = 10
$orderBy: Pool_orderBy = id
$orderDirection: OrderDirection = asc
$skip: Int = 0
$where: Pool_filter = {}
$block: Block_height
$first: Int = 10
$orderBy: Pool_orderBy = id
$orderDirection: OrderDirection = asc
$skip: Int = 0
$where: Pool_filter = {}
$block: Block_height
) {
pools(
first: $first
orderBy: $orderBy
orderDirection: $orderDirection
skip: $skip
where: $where
block: $block
) {
...PoolPart
}
pools(
first: $first
orderBy: $orderBy
orderDirection: $orderDirection
skip: $skip
where: $where
block: $block
) {
...PoolPart
}
}

fragment PoolPart on Pool {
id
createdAtTimestamp
createdAtBlockNumber
updatedAtTimestamp
updatedAtBlockNumber
flowRate
totalMembers
totalUnits
totalAmountDistributedUntilUpdatedAt
adjustmentFlowRate
totalAmountFlowedDistributedUntilUpdatedAt
totalAmountInstantlyDistributedUntilUpdatedAt
totalBuffer
totalConnectedMembers
totalConnectedUnits
totalDisconnectedMembers
totalDisconnectedUnits
admin {
id
}
token {
id
}
createdAtTimestamp
createdAtBlockNumber
updatedAtTimestamp
updatedAtBlockNumber
admin {
id
}
token {
id
}
totalMembers
totalUnits
totalConnectedMembers
totalConnectedUnits
totalDisconnectedMembers
totalDisconnectedUnits
totalAmountInstantlyDistributedUntilUpdatedAt
flowRate
perUnitSettledValue
perUnitFlowRate
totalBuffer
totalAmountFlowedDistributedUntilUpdatedAt
totalAmountDistributedUntilUpdatedAt
adjustmentFlowRate
totalFlowAdjustmentAmountDistributedUntilUpdatedAt
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export interface PoolMember {
totalAmountReceivedUntilUpdatedAt: BigNumber;
poolTotalAmountDistributedUntilUpdatedAt: BigNumber;
pool: Address;
syncedPerUnitFlowRate: BigNumber;
syncedPerUnitSettledValue: BigNumber;
}

export type PoolMembersListQuery = SubgraphListQuery<
Expand Down Expand Up @@ -70,6 +72,8 @@ export class PoolMemberQueryHandler extends SubgraphQueryHandler<
updatedAtBlockNumber: Number(x.updatedAtBlockNumber),
pool: x.pool.id,
token: x.pool.token.id,
syncedPerUnitFlowRate: x.syncedPerUnitFlowRate,
syncedPerUnitSettledValue: x.syncedPerUnitSettledValue,
}));

requestDocument = PoolMembersDocument;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
query poolMembers(
$first: Int = 10
$skip: Int = 0
$orderBy: PoolMember_orderBy = id
$orderDirection: OrderDirection = asc
$where: PoolMember_filter = {}
$block: Block_height
$first: Int = 10
$skip: Int = 0
$orderBy: PoolMember_orderBy = id
$orderDirection: OrderDirection = asc
$where: PoolMember_filter = {}
$block: Block_height
) {
poolMembers(
first: $first
orderBy: $orderBy
orderDirection: $orderDirection
skip: $skip
where: $where
block: $block
) {
id
createdAtTimestamp
createdAtBlockNumber
updatedAtTimestamp
updatedAtBlockNumber
units
pool {
id
token {
poolMembers(
first: $first
orderBy: $orderBy
orderDirection: $orderDirection
skip: $skip
where: $where
block: $block
) {
id
}
createdAtTimestamp
createdAtBlockNumber
updatedAtTimestamp
updatedAtBlockNumber
units
pool {
id
token {
id
}
}
account {
id
}
isConnected
totalAmountClaimed
totalAmountReceivedUntilUpdatedAt
poolTotalAmountDistributedUntilUpdatedAt
syncedPerUnitFlowRate
syncedPerUnitSettledValue
}
account {
id
}
isConnected
totalAmountClaimed
totalAmountReceivedUntilUpdatedAt
poolTotalAmountDistributedUntilUpdatedAt
}
}

0 comments on commit 8131d69

Please sign in to comment.