Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SUBGRAPH] Gda total amount received #1773

Merged
merged 517 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
517 commits
Select commit Hold shift + click to select a range
e2d31f0
SuperfluidUpgradeableBeaconTest test contract
0xdavinchee May 9, 2023
0b72a40
adjustment fr
0xdavinchee May 10, 2023
bf15987
Update GeneralDistributionAgreement.t.sol
0xdavinchee May 10, 2023
d23360e
more testing cleanup
0xdavinchee May 10, 2023
8672e9b
we'll do it LIVE!
0xdavinchee May 11, 2023
84396b1
formatting
0xdavinchee May 11, 2023
7657161
wip cleanups + test removals
0xdavinchee May 11, 2023
1b4764d
address some review comments
0xdavinchee May 11, 2023
1943217
Merge branch 'dev' into gda
0xdavinchee May 12, 2023
b40b313
review comments cont.
0xdavinchee May 12, 2023
8b019f2
fix build
0xdavinchee May 12, 2023
1afddba
Merge branch 'dev' into gda
0xdavinchee May 12, 2023
feb8662
should fix build + allow deploy
0xdavinchee May 15, 2023
5780d72
fix deployments
0xdavinchee May 15, 2023
1d24090
Merge branch 'dev' into gda
0xdavinchee May 16, 2023
276ac20
GDA wip
0xdavinchee May 16, 2023
2846a83
Merge branch 'dev' into gda
0xdavinchee May 18, 2023
99ccc25
flow nft cleanup/fixes
0xdavinchee May 22, 2023
e0ae9e1
workflow cleanups
0xdavinchee May 22, 2023
743fb4b
Merge branch 'dev' into gda
0xdavinchee May 22, 2023
d71e16d
Merge branch 'flow-nft-deployments-fixes' into gda
0xdavinchee May 22, 2023
01bb967
Merge branch 'dev' into gda
0xdavinchee May 22, 2023
8f17082
fix up framework deployment
0xdavinchee May 23, 2023
c23ae95
wip
0xdavinchee May 23, 2023
fcd0162
cleanup
0xdavinchee May 23, 2023
3ad46fe
Merge branch 'dev' into gda
0xdavinchee May 23, 2023
bbd6bbb
Merge branch 'dev' into gda
0xdavinchee May 30, 2023
e2131b7
Pool NFTs WIP
0xdavinchee May 30, 2023
020f010
add erc20 to superfluidpool
0xdavinchee Jun 5, 2023
271fdea
pool nft integration
0xdavinchee Jun 5, 2023
180c51f
gda wip
0xdavinchee Jun 5, 2023
e0a93b9
validate + make test more robust
0xdavinchee Jun 6, 2023
acb6f2e
Merge branch 'dev' into gda
0xdavinchee Jun 6, 2023
3dd82aa
gda tests cleanup
0xdavinchee Jun 6, 2023
6cf8eaa
fix verification
0xdavinchee Jun 7, 2023
aada469
Merge branch 'dev' into gda
0xdavinchee Jun 7, 2023
85b9aad
flow nft on distribute flow
0xdavinchee Jun 7, 2023
61b7dec
testing cleanup
0xdavinchee Jun 7, 2023
7faeedd
fix transfer test too
0xdavinchee Jun 8, 2023
46279e1
GDAv1 in SuperTokenV1Library
0xdavinchee Jun 8, 2023
8c47f8f
full coverage
0xdavinchee Jun 9, 2023
25c0acc
wip
0xdavinchee Jun 13, 2023
3c96788
Merge branch 'dev' into gda
0xdavinchee Jun 13, 2023
224e21f
Update deploy-framework.js
0xdavinchee Jun 13, 2023
68f2fe1
Merge branch 'dev' into gda
0xdavinchee Jun 13, 2023
adfc914
Update ISuperToken.sol
0xdavinchee Jun 13, 2023
9143d89
using lib for ISuperToken
0xdavinchee Jun 13, 2023
6054bce
add tests for lib
0xdavinchee Jun 13, 2023
f39f9b8
gda wip
0xdavinchee Jun 26, 2023
08a2a28
Merge branch 'dev' into gda
0xdavinchee Jun 26, 2023
2303bf2
Merge branch 'dev' into gda
0xdavinchee Jun 26, 2023
e4c23d4
fix build
0xdavinchee Jun 26, 2023
4bb9144
function renaming + comments
0xdavinchee Jun 27, 2023
cee4f48
gda harness cleanup
0xdavinchee Jun 27, 2023
d84122b
gda subgraph hemingway bridge
0xdavinchee Jun 27, 2023
612eb46
Merge branch 'dev' into gda
0xdavinchee Jun 27, 2023
f83062f
gdav1 forwarder wip
0xdavinchee Jun 27, 2023
499aba0
mapping functions WIP
0xdavinchee Jun 28, 2023
63a4885
Merge branch 'dev' into gda
0xdavinchee Jun 28, 2023
5e96151
aggregate entities schema
0xdavinchee Jun 29, 2023
5113979
- add docs for new properties
0xdavinchee Jun 29, 2023
2c7c24b
Delete hardhat.json
0xdavinchee Jun 29, 2023
5a082bb
nft's wip
0xdavinchee Jul 4, 2023
f88f79c
add transfer units to pool test
0xdavinchee Jul 4, 2023
7f9f080
nft testing wip
0xdavinchee Jul 4, 2023
396d67a
Merge branch 'dev' into gda
0xdavinchee Jul 4, 2023
598fe84
fix build
0xdavinchee Jul 5, 2023
7498a5c
wip + refactoring tests
0xdavinchee Jul 5, 2023
41198b3
fix build
0xdavinchee Jul 5, 2023
d2d4f8a
testing wip
0xdavinchee Jul 5, 2023
9f92968
tests refactor
0xdavinchee Jul 6, 2023
262bd19
pool nft tests wip + cleanup
0xdavinchee Jul 6, 2023
6b25dc7
Merge branch 'dev' into gda
0xdavinchee Jul 6, 2023
c009cca
add assertions for nft's in gda helpers
0xdavinchee Jul 6, 2023
04e6b3d
add GDA to SDK-Core
0xdavinchee Jul 7, 2023
68ddd15
TSDoc for SuperfluidPool
0xdavinchee Jul 7, 2023
26dd75f
GDA in SDK-Core WIP
0xdavinchee Jul 10, 2023
683d77a
more tests and coverage WIP
0xdavinchee Jul 11, 2023
e44f7c2
Merge branch 'dev' into gda
0xdavinchee Jul 12, 2023
2975fab
wip
0xdavinchee Jul 12, 2023
0711146
fix build + add tests
0xdavinchee Jul 12, 2023
00b1251
force artifact creation
0xdavinchee Jul 13, 2023
fce17ec
undo force
0xdavinchee Jul 13, 2023
bf1b792
final SDK-Core tests for GDA
0xdavinchee Jul 13, 2023
15f9ba1
Merge branch 'dev' into gda
0xdavinchee Jul 13, 2023
c581907
make yarn dev use forge by default
0xdavinchee Jul 13, 2023
8105e19
refactor tests
0xdavinchee Jul 13, 2023
bc611da
Update package.json
0xdavinchee Jul 13, 2023
3b30683
tidying up
0xdavinchee Jul 14, 2023
4e7f2ac
add total connected flow rate to pool
0xdavinchee Jul 17, 2023
00ef1f4
fix distribute tests
0xdavinchee Jul 17, 2023
d5eb580
add batch liquidator + toga to Framework struct
0xdavinchee Jul 17, 2023
bf199f7
does not exist error
0xdavinchee Jul 17, 2023
47d0ccb
batch liquidator modified to handle GDA
0xdavinchee Jul 17, 2023
8d9be0e
fix code size too large
0xdavinchee Jul 19, 2023
9ba5fd8
updateMemberUnits name change, _toSemanticMoneyUnit added, set TOGA a…
0xdavinchee Jul 21, 2023
3c50222
toSemanticMoney
0xdavinchee Jul 21, 2023
fca2cd0
merge dev
0xdavinchee Jul 21, 2023
468b809
Merge remote-tracking branch 'origin/dev' into gda
ngmachado Jul 21, 2023
2a34c78
merge dev
0xdavinchee Jul 21, 2023
e492f40
testing wip
0xdavinchee Jul 22, 2023
5a86043
fix build to unblock
0xdavinchee Jul 24, 2023
71f3e1b
fix build
0xdavinchee Jul 24, 2023
472d0fa
Update SuperTokenV1Library.sol: make isMemberConnected internal
hellwolf Jul 24, 2023
83aace3
Merge branch 'dev' into gda
0xdavinchee Jul 27, 2023
0a5b0e8
cleanup and wip
0xdavinchee Jul 27, 2023
312e0ea
gda test cleanup
0xdavinchee Jul 27, 2023
e12efc0
add assertions for distribute claimable
0xdavinchee Jul 27, 2023
4206b43
check actual flow rate
0xdavinchee Jul 27, 2023
a11b4d0
final helper assertion for distribute flow
0xdavinchee Jul 28, 2023
edbf5f3
fix build
0xdavinchee Jul 28, 2023
f79b9b8
subgraph progress
0xdavinchee Jul 28, 2023
7f89c9b
subgraph wip
0xdavinchee Jul 31, 2023
466dd16
superfluidpool mapping
0xdavinchee Jul 31, 2023
281ec11
Update mappingHelpers.ts
0xdavinchee Jul 31, 2023
fc76766
subgraph tests wip
0xdavinchee Aug 3, 2023
0f2f275
fix subgraph tests
0xdavinchee Aug 7, 2023
b4178d5
Merge branch 'dev' into gda
0xdavinchee Aug 8, 2023
be2a7a9
clean up tests
0xdavinchee Aug 8, 2023
23f962a
add gda addresses
0xdavinchee Aug 10, 2023
75d4d35
fix tests
0xdavinchee Aug 10, 2023
17dc948
fix deployment
0xdavinchee Aug 10, 2023
b7808a2
contracts notes
0xdavinchee Aug 10, 2023
f8510b4
tests cleanup
0xdavinchee Aug 10, 2023
d714681
Merge branch 'dev' into gda
0xdavinchee Aug 11, 2023
79db147
uncommented test
0xdavinchee Aug 11, 2023
760d708
more tests + helpers added
0xdavinchee Aug 11, 2023
14f29f3
more helpers and abstractions!
0xdavinchee Aug 11, 2023
bb9b119
Merge branch 'dev' into gda
hellwolf Aug 12, 2023
356bd3e
fix lint:sol errors
hellwolf Aug 15, 2023
fb9115b
fix echidna
hellwolf Aug 15, 2023
b89be6b
warnings cleanup
0xdavinchee Aug 15, 2023
75abb49
break windows
hellwolf Aug 15, 2023
981e2f7
Merge branch 'dev' into keep-up-with-solhint-recommendations
hellwolf Aug 15, 2023
1af5b04
add one more test
0xdavinchee Aug 15, 2023
643b8be
Merge branch 'dev' into keep-up-with-solhint-recommendations
0xdavinchee Aug 15, 2023
11556bb
Merge branch 'dev' into gda
0xdavinchee Aug 15, 2023
4e95e3c
Merge branch 'dev' into gda
0xdavinchee Aug 15, 2023
4ea7145
use supertokenv1library
0xdavinchee Aug 15, 2023
1600d0a
fixing warnings
hellwolf Aug 16, 2023
f8a0801
Merge branch 'dev' into keep-up-with-solhint-recommendations
0xdavinchee Aug 16, 2023
51d4650
fix semantic money
hellwolf Aug 16, 2023
a4f062e
clean up build warnings
0xdavinchee Aug 16, 2023
23e43ea
do not ignore success flag from low level call
hellwolf Aug 16, 2023
d1b297f
disable deny_warnings for now
hellwolf Aug 16, 2023
f36076b
Merge branch 'keep-up-with-solhint-recommendations' into gda
0xdavinchee Aug 16, 2023
e0b2c5e
fix up build and lint
0xdavinchee Aug 16, 2023
615d6e3
fix build
0xdavinchee Aug 16, 2023
18abf14
clean up echidna
0xdavinchee Aug 16, 2023
01fd215
cleanup
0xdavinchee Aug 16, 2023
54fde1b
Merge branch 'dev' into gda
0xdavinchee Aug 16, 2023
f4dc04f
fixes
0xdavinchee Aug 16, 2023
e49b358
fix some of the gda invariance issues
0xdavinchee Aug 17, 2023
0db4551
testing cleanup
0xdavinchee Aug 18, 2023
5d63759
merge dev
d10r Aug 21, 2023
4f74f98
add a few more actions
0xdavinchee Aug 22, 2023
57b2431
fix tests
0xdavinchee Aug 22, 2023
d2bb068
Merge branch 'dev' into gda
0xdavinchee Aug 22, 2023
d271952
Update getAbi.js
0xdavinchee Aug 22, 2023
53bd618
fix build
0xdavinchee Aug 22, 2023
3135ef4
Merge branch 'dev' into gda
0xdavinchee Aug 22, 2023
d1aafec
Merge branch 'dev' into gda
0xdavinchee Aug 23, 2023
c6b7e8e
Update bundled-abi-contracts-list.json
0xdavinchee Aug 23, 2023
8ef8381
GDA tooling (#1602)
d10r Aug 23, 2023
c2cc19c
merge gda toolling
0xdavinchee Aug 23, 2023
29c4477
Merge branch 'dev' into gda
0xdavinchee Aug 23, 2023
aa46442
gdav1 forwarder tested
0xdavinchee Aug 23, 2023
c2fd5af
Merge branch 'dev' into gda
0xdavinchee Aug 23, 2023
db9d117
fix tests
0xdavinchee Aug 23, 2023
da66fd3
add required ISuperToken ABIs
0xdavinchee Aug 24, 2023
86e92a8
Merge branch 'dev' into gda
0xdavinchee Aug 24, 2023
93ac7ce
include resolver/ISuperfluid abis
0xdavinchee Aug 24, 2023
39582e0
fix build
0xdavinchee Aug 24, 2023
dce768d
subgraph tests wip
0xdavinchee Aug 24, 2023
44e6b50
pool distributor tests
0xdavinchee Aug 24, 2023
487aa93
more echidna actions
0xdavinchee Aug 24, 2023
2a456d6
clean up hot fuzz + gda
0xdavinchee Aug 25, 2023
20ccc42
Merge branch 'dev' into gda
0xdavinchee Aug 25, 2023
47ef968
add token actions
0xdavinchee Aug 25, 2023
a70b77d
Merge branch 'dev' into gda
0xdavinchee Aug 29, 2023
2346966
add TOGA as account
0xdavinchee Aug 29, 2023
a62bf99
fix test cases
0xdavinchee Aug 29, 2023
53ddbf2
Merge branch 'dev' into gda
0xdavinchee Aug 29, 2023
ca27f58
Merge branch 'dev' into gda
0xdavinchee Aug 30, 2023
d4d555a
Merge branch 'dev' into gda
0xdavinchee Sep 5, 2023
cf9f746
fix formatting
0xdavinchee Sep 5, 2023
b36001e
Merge branch 'dev' into gda
0xdavinchee Sep 8, 2023
9babdd4
fix formatting
0xdavinchee Sep 8, 2023
63bfc24
fix lint errors
0xdavinchee Sep 11, 2023
423acde
add callAgreement wrappers
0xdavinchee Sep 11, 2023
e155786
with ctx functions added
0xdavinchee Sep 11, 2023
c102eb7
cleanup
0xdavinchee Sep 12, 2023
4360182
add to event
0xdavinchee Sep 13, 2023
5a9e889
fix gda address for avalanche-fuji
0xdavinchee Sep 14, 2023
3bff74e
Merge branch 'dev' into gda
0xdavinchee Sep 14, 2023
9cb26b7
subgraph and sdk-core changes
0xdavinchee Sep 14, 2023
d1eff31
wip
0xdavinchee Sep 14, 2023
d8dce7b
deploy script for gda forwarder & addition to framework deploy script
d10r Sep 14, 2023
1688c87
added gdaV1Forwarder addresses for testnets
d10r Sep 14, 2023
0fb3b53
fix subgraph tests
0xdavinchee Sep 15, 2023
686daef
Merge branch 'gda' of github.com:superfluid-finance/protocol-monorepo…
0xdavinchee Sep 15, 2023
85adc7f
deployment env
0xdavinchee Sep 15, 2023
b21b0e3
change file structure
0xdavinchee Sep 15, 2023
39100ff
unnecessary suffering
0xdavinchee Sep 15, 2023
78fe49f
cleanup
0xdavinchee Sep 15, 2023
292e676
fix hot fuzz breaking
0xdavinchee Sep 18, 2023
95fbcee
Merge branch 'dev' into gda
0xdavinchee Sep 18, 2023
04b0c99
Update bundled-abi-contracts-list.json
0xdavinchee Sep 18, 2023
ce38baa
Merge branch 'gda' of github.com:superfluid-finance/protocol-monorepo…
0xdavinchee Sep 18, 2023
e336282
remove GDAv1Internal
hellwolf Sep 18, 2023
286e5cb
Delete GDAv1Internal.sol
0xdavinchee Sep 18, 2023
7bbc99c
Merge branch 'gda' of github.com:superfluid-finance/protocol-monorepo…
0xdavinchee Sep 18, 2023
eb7a538
more memory for the job
0xdavinchee Sep 18, 2023
b95567a
rename test functions
0xdavinchee Sep 18, 2023
06189a9
Merge branch 'dev' into gda
0xdavinchee Sep 18, 2023
cca6812
explicitly set parallel to false
0xdavinchee Sep 18, 2023
52840c2
clean up build warnings
0xdavinchee Sep 18, 2023
80c9748
Merge branch 'dev' into gda
0xdavinchee Sep 19, 2023
7635eb3
pass via env:
0xdavinchee Sep 21, 2023
940f093
Merge branch 'dev' into gda
0xdavinchee Sep 21, 2023
719e27c
fix build
0xdavinchee Sep 21, 2023
fb15095
Merge branch 'dev' into gda
0xdavinchee Sep 26, 2023
fcb7780
fixes attempt
0xdavinchee Sep 26, 2023
4d5af72
fix build
0xdavinchee Sep 26, 2023
3ee5966
fix contract size issue
0xdavinchee Sep 26, 2023
32df67d
use correct sig + add gda address to config
0xdavinchee Sep 26, 2023
e4ac410
gda address can be null
0xdavinchee Sep 26, 2023
c6ccbdd
fix broken unit tests
0xdavinchee Sep 26, 2023
40f7db0
Merge branch 'dev' into gda
0xdavinchee Sep 26, 2023
f0fbec6
fix flakey tests
0xdavinchee Sep 27, 2023
1e1894e
Merge branch 'dev' into gda
0xdavinchee Sep 28, 2023
f5e5b97
more consistent naming of verification related vars
d10r Sep 29, 2023
f499fe5
Merge branch 'dev' into gda
0xdavinchee Oct 2, 2023
dc51639
pool config
0xdavinchee Oct 2, 2023
1a01cae
cleanup
0xdavinchee Oct 2, 2023
7da8e92
move pool config out of interface
0xdavinchee Oct 3, 2023
2afdfe6
move struct to interface
0xdavinchee Oct 3, 2023
27d9a1c
fix build
0xdavinchee Oct 3, 2023
6dacae5
fix build attempt
0xdavinchee Oct 3, 2023
799f0af
fix build
0xdavinchee Oct 4, 2023
0989e43
Merge branch 'dev' into gda
hellwolf Oct 9, 2023
4ece1a3
Merge branch 'dev' into gda
0xdavinchee Oct 10, 2023
a13efce
[ETHEREUM-CONTRACTS] [GDA] Fixes for GDA (#1729)
0xdavinchee Jan 5, 2024
c28853d
Merge branch 'dev' into gda
0xdavinchee Jan 8, 2024
75c8c55
wip
0xdavinchee Jan 8, 2024
dbc7321
mapping
0xdavinchee Jan 8, 2024
9837d77
better terminology
0xdavinchee Jan 10, 2024
a90b670
merge dev
0xdavinchee Jan 10, 2024
7cd6bb3
fix init mapping
0xdavinchee Jan 10, 2024
77555f8
divide by zero error
0xdavinchee Jan 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1809,6 +1809,8 @@ type PoolMember @entity {
units: BigInt!
isConnected: Boolean!
totalAmountClaimed: BigInt!
poolTotalAmountDistributedUntilUpdatedAt: BigInt!
totalAmountReceivedUntilUpdatedAt: BigInt!

account: Account!
pool: Pool!
Expand Down Expand Up @@ -2259,7 +2261,6 @@ type AccountTokenSnapshot @entity {
"""
totalCFANumberOfActiveStreams: Int!

# delete this property
"""
The count of currently open streams for an account, both incoming and outgoing for the GDA.
"""
Expand Down Expand Up @@ -2290,7 +2291,6 @@ type AccountTokenSnapshot @entity {
"""
activeCFAIncomingStreamCount: Int!

# delete this property
"""
The count of active incoming streams to this account for the GDA.
"""
Expand Down
24 changes: 24 additions & 0 deletions packages/subgraph/src/mappingHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,8 @@ export function getOrInitPoolMember(
poolMember.units = BIG_INT_ZERO;
poolMember.isConnected = false;
poolMember.totalAmountClaimed = BIG_INT_ZERO;
poolMember.poolTotalAmountDistributedUntilUpdatedAt = BIG_INT_ZERO;
poolMember.totalAmountReceivedUntilUpdatedAt = BIG_INT_ZERO;

poolMember.account = poolMemberAddress.toHex();
poolMember.pool = poolAddress.toHex();
Expand Down Expand Up @@ -1608,3 +1610,25 @@ export function updateAggregateEntitiesTransferData(
tokenStatistic.totalAmountTransferredUntilUpdatedAt.plus(value);
tokenStatistic.save();
}

/**
* Updates `totalAmountReceivedUntilUpdatedAt` and `poolTotalAmountDistributedUntilUpdatedAt` fields
* Requires an explicit save on the PoolMember entity.
* Requires `pool.totalAmountDistributedUntilUpdatedAt` to be updated prior to calling this function.
* @param pool the pool entity
* @param poolMember the pool member entity
* @returns the updated pool member entity to be saved
*/
export function updatePoolMemberTotalAmountUntilUpdatedAtFields(pool: Pool, poolMember: PoolMember): PoolMember {
const amountReceivedDelta = pool.totalUnits.equals(BIG_INT_ZERO)
? BIG_INT_ZERO
: pool.totalAmountDistributedUntilUpdatedAt
.minus(poolMember.poolTotalAmountDistributedUntilUpdatedAt)
.div(pool.totalUnits)
.times(poolMember.units);
poolMember.totalAmountReceivedUntilUpdatedAt =
poolMember.totalAmountReceivedUntilUpdatedAt.plus(amountReceivedDelta);
poolMember.poolTotalAmountDistributedUntilUpdatedAt = pool.totalAmountDistributedUntilUpdatedAt;

return poolMember;
}
7 changes: 6 additions & 1 deletion packages/subgraph/src/mappings/gdav1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
updateATSStreamedAndBalanceUntilUpdatedAt,
updateAggregateDistributionAgreementData,
updatePoolDistributorTotalAmountFlowedAndDistributed,
updatePoolMemberTotalAmountUntilUpdatedAtFields,
updatePoolTotalAmountFlowedAndDistributed,
updateSenderATSStreamData,
updateTokenStatisticStreamData,
Expand Down Expand Up @@ -83,7 +84,7 @@ export function handlePoolConnectionUpdated(
event: PoolConnectionUpdated
): void {
// Update Pool Member Entity
const poolMember = getOrInitPoolMember(
let poolMember = getOrInitPoolMember(
event,
event.params.pool,
event.params.account
Expand Down Expand Up @@ -128,6 +129,10 @@ export function handlePoolConnectionUpdated(
}
pool.save();

// Update totalAmountDistributedUntilUpdatedAt
poolMember = updatePoolMemberTotalAmountUntilUpdatedAtFields(pool, poolMember);
poolMember.save();

// Update Token Stats Streamed Until Updated At
updateTokenStatsStreamedUntilUpdatedAt(event.params.token, event.block);
// Update ATS Balance and Streamed Until Updated At
Expand Down
10 changes: 8 additions & 2 deletions packages/subgraph/src/mappings/superfluidPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
getOrInitPoolMember,
updateATSStreamedAndBalanceUntilUpdatedAt,
updateAggregateDistributionAgreementData,
updatePoolMemberTotalAmountUntilUpdatedAtFields,
updatePoolTotalAmountFlowedAndDistributed,
updateTokenStatsStreamedUntilUpdatedAt,
} from "../mappingHelpers";
Expand All @@ -27,8 +28,10 @@ export function handleDistributionClaimed(event: DistributionClaimed): void {
pool.save();

// Update PoolMember
const poolMember = getOrInitPoolMember(event, event.address, event.params.member);
let poolMember = getOrInitPoolMember(event, event.address, event.params.member);
poolMember.totalAmountClaimed = event.params.totalClaimed;

poolMember = updatePoolMemberTotalAmountUntilUpdatedAtFields(pool, poolMember);
poolMember.save();

// Update Token Statistics
Expand All @@ -47,7 +50,7 @@ export function handleDistributionClaimed(event: DistributionClaimed): void {
export function handleMemberUnitsUpdated(event: MemberUnitsUpdated): void {
// - PoolMember
// - units
const poolMember = getOrInitPoolMember(event, event.address, event.params.member);
let poolMember = getOrInitPoolMember(event, event.address, event.params.member);
const hasMembershipWithUnits = membershipWithUnitsExists(poolMember.id);

const previousUnits = poolMember.units;
Expand All @@ -73,6 +76,9 @@ export function handleMemberUnitsUpdated(event: MemberUnitsUpdated): void {
pool.totalUnits = pool.totalUnits.plus(unitsDelta);
pool.save();

poolMember = updatePoolMemberTotalAmountUntilUpdatedAtFields(pool, poolMember);
poolMember.save();

// 0 units to > 0 units
if (previousUnits.equals(BIG_INT_ZERO) && event.params.newUnits.gt(BIG_INT_ZERO)) {
pool.totalMembers = pool.totalMembers + 1;
Expand Down
Loading