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

Setup queries for Nabla backend for campaign and mainnet reward program #58

Closed
prayagd opened this issue Mar 15, 2024 · 9 comments · Fixed by #62
Closed

Setup queries for Nabla backend for campaign and mainnet reward program #58

prayagd opened this issue Mar 15, 2024 · 9 comments · Fixed by #62
Assignees

Comments

@prayagd
Copy link
Contributor

prayagd commented Mar 15, 2024

Context

As the Nabla testnet is soon would be ready, growth wants to do a airflyft campaign where they want to track the actions user performed during a certain period of time. After the testnet campaign and mainnet launch, we also want to introduce a reward program based on points, where we will track certain KPI and reward user with points. This is to attract LPs.

Requirement

  • Following queries should be available in the Nabla squid
  • For testnet campaign, growth wants to track the following actions over a period of 1 week using airlyft
    • If the user did a swap
    • if the user added liquidity to the swap pools
    • If the user added liquidity to the backstop pool
  • For the reward program, we want to track the following factors (as of now not decided but probable approach)
    • Amount LPed (TVL)
    • Duration (for which the amount is LPed)
  • Above queries should be available for both Foucoco and Pendulum

Technical considerations

Currently, we have four entities for Nabla: Router, NablaToken, SwapPool and BackstopPool, see here. We are not storing data about events like swapping or depositing liquidity. We should:

  • Create a new entity NablaSwap based on the Swap entity we use already for Zenlink.
  • Create new entities NablaBackstopLiquidityDeposit and NablaSwapLiquidityDeposit based on the Mint entity
  • Create new entities NablaBackstopLiquidityWithdrawal and NablaSwapLiquidityWithdrawal based on the Burn entity

The new entities should store the relevant general metadata like id, transaction, timestamp and pair and then take the other data from the respective event emitted and processed by the indexer. The available events can be seen in the abi folder here and here.

To derive the values for 'Amount LPed (TVL)' and 'Duration (for which the amount is LPed)' we would then manually (or with a script) compare the NablaXDeposit and NablaXWithdrawal events for each user to be able to say how many tokens were provided as liquidity and for how long.

@prayagd
Copy link
Contributor Author

prayagd commented Mar 15, 2024

Follow up of this ticket

@prayagd
Copy link
Contributor Author

prayagd commented Mar 15, 2024

@pendulum-chain/devs this information enough to setup the queries?

@ebma
Copy link
Member

ebma commented Mar 15, 2024

I assume you want to be able to filter the 'Amount LPed (TVL)' and 'Duration (for which the amount is LPed)' per user?

This still needs some technical refinement before someone can work on it but I can do that later.

@prayagd
Copy link
Contributor Author

prayagd commented Mar 19, 2024

Yes

@ebma
Copy link
Member

ebma commented Mar 25, 2024

I added the technical considerations for this ticket.

@TorstenStueber
Copy link
Contributor

Note that this PR is still open which redefines some of the Nabla related entities: #52 (review)

@TorstenStueber
Copy link
Contributor

@ebma How does the StakePosition entity for Zenlink work? Just the linked definition of the schema is not enough for me to understand its semantics (without reading the code). Why would that be required in the first place in order to satisfy the requirements of the ticket – seems to me like the other three entities are sufficient.

I also propose to limit the stored data to the absolute necessary to satisfy this ticket, no need to go further if not required at the moment.

@ebma
Copy link
Member

ebma commented Apr 3, 2024

The StakePosition is used by Zenlink's farming pools and is updated each time a user deposits/withdraws some LP from the farming pool.

It's true that it might not be absolutely necessary to have this entity for Nabla based on the requirements of this ticket, as we can also derive it based on the other deposit/withdrawal entities. I'll remove it from the description again.

@annatekl
Copy link

annatekl commented Apr 4, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants