Skip to content

Commit

Permalink
use more balance deltas
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparkallas committed May 30, 2024
1 parent 6437cd9 commit 4314ffd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
4 changes: 0 additions & 4 deletions packages/subgraph/src/mappingHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1042,10 +1042,6 @@ export function updateATSStreamedAndBalanceUntilUpdatedAt(
accountAddress: Address,
tokenAddress: Address,
block: ethereum.Block,

// TODO: we are currently always passing null here
// remove null one at a time and use validation script
// to compare v1 to feature
balanceDelta: BigInt | null
): void {
let accountTokenSnapshot = getOrInitAccountTokenSnapshot(
Expand Down
3 changes: 1 addition & 2 deletions packages/subgraph/src/mappings/cfav1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ export function handleFlowUpdated(event: FlowUpdated): void {
senderAddress,
tokenAddress,
event.block,
// @note when deleting, we do RPC call (prevents double accounting post-liquidation)
null
depositDelta
);
updateATSStreamedAndBalanceUntilUpdatedAt(
receiverAddress,
Expand Down
25 changes: 13 additions & 12 deletions packages/subgraph/src/mappings/gdav1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,6 @@ export function handleFlowDistributionUpdated(
);
_createTokenStatisticLogEntity(event, event.params.token, eventName);

// Update ATS
updateSenderATSStreamData(
event.params.distributor,
event.params.token,
event.params.newDistributorToPoolFlowRate,
flowRateDelta,
BIG_INT_ZERO,
isCreate,
isDelete,
false,
event.block
);
updateATSStreamedAndBalanceUntilUpdatedAt(
event.params.distributor,
event.params.token,
Expand All @@ -289,6 +277,19 @@ export function handleFlowDistributionUpdated(
eventName
);

// Update ATS
updateSenderATSStreamData(
event.params.distributor,
event.params.token,
event.params.newDistributorToPoolFlowRate,
flowRateDelta,
BIG_INT_ZERO,
isCreate,
isDelete,
false,
event.block
);

// Create Event Entity
_createFlowDistributionUpdatedEntity(event, poolDistributor.id, pool.totalUnits);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/subgraph/src/mappings/idav1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export function handleSubscriptionApproved(event: SubscriptionApproved): void {
event.params.subscriber,
event.params.token,
event.block,
null // will do RPC if any units exist anyways
balanceDelta
);

if (hasSubscriptionWithUnits) {
Expand Down

0 comments on commit 4314ffd

Please sign in to comment.