-
Notifications
You must be signed in to change notification settings - Fork 10
Pool Burn and Mint refactor + user and pool entity refactor #358
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
Pool Burn and Mint refactor + user and pool entity refactor #358
Conversation
type User { | ||
id: ID! # user address | ||
# Entity for tracking user activity and positions in specific pools | ||
type UserStatsPerPool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a user can have activity on multiple pools, so it's best to have an entity per ID where ID = userAddress_poolAddress_chainId
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so previously there was a single entity for all pools on all chains and now it is entity per pool per chain right?
we should just make a note to aggregate all of these different entities for same user address when swapping out previously used entity for the new ones (if relevant)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously the entity didn't have a pool-specific field. So basically all the stats would be from all pools on aggregate
I think separating and having a user entity per pool per chain allows to have more granularity that i'm almost certain that will be useful for metrics
} | ||
} | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grouped here pool loading logic
@@ -0,0 +1,164 @@ | |||
import type { UserStatsPerPool, handlerContext } from "generated"; | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
load or create user entity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
module that is used in both pool mint and pool burn event handlers, because they basically share the same logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice refactor! 🚀
Implements: