Skip to content

Conversation

FonsSicca
Copy link
Contributor

Implements:

  • Pool mint and burn refactoring
  • Refactoring of the way user entity is created

@FonsSicca FonsSicca requested a review from WooSungD October 3, 2025 16:46
type User {
id: ID! # user address
# Entity for tracking user activity and positions in specific pools
type UserStatsPerPool {
Copy link
Contributor Author

@FonsSicca FonsSicca Oct 3, 2025

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

Copy link
Contributor

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)

Copy link
Contributor Author

@FonsSicca FonsSicca Oct 6, 2025

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

}
}

/**
Copy link
Contributor Author

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";

/**
Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice refactor! 🚀

@FonsSicca FonsSicca merged commit e1b40b0 into main Oct 6, 2025
1 check passed
@FonsSicca FonsSicca deleted the dan/pool-mint-burn-refactor-and-entity-refactor branch October 6, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants