pendulum-chain / pendulum-squids

The subsquid squids we use for Pendulum/Amplitude/Foucoco.
GNU General Public License v3.0
0 stars 0 forks source link

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

Closed prayagd closed 5 months ago

prayagd commented 8 months ago

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

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:

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 commented 8 months ago

Follow up of this ticket

prayagd commented 8 months ago

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

ebma commented 8 months ago

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 commented 8 months ago

Yes

ebma commented 8 months ago

I added the technical considerations for this ticket.

TorstenStueber commented 7 months ago

Note that this PR is still open which redefines some of the Nabla related entities: https://github.com/pendulum-chain/pendulum-squids/pull/52#pullrequestreview-1893920980

TorstenStueber commented 7 months ago

@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 commented 7 months ago

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 commented 7 months ago

Hey team! Please add your planning poker estimate with Zenhub @b-yap @bogdanS98 @ebma @gianfra-t @TorstenStueber