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

Add query to fetch amount of non-vested staked INTR #59

Open
alexeiZamyatin opened this issue Jan 13, 2023 · 0 comments
Open

Add query to fetch amount of non-vested staked INTR #59

alexeiZamyatin opened this issue Jan 13, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@alexeiZamyatin
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently, we only query how much INTR was staked in total. However, it is possible to stake both liquid and unvested INTR.
This makes it impossible to check how much of the actual liquid supply has been staked. This metric is important to understand the attractivity of staking as a product and user behavior (unvested tokens "mess" this up because there is nothing else users can do with these unvested tokens).

Describe the solution you'd like
Add a query to compute how much vested (i.e., liquid) INTR has been staked.
Note: unvested = cannot be claimed. The query should exclude tokens that are theoretically vested but have not yet been claimed yet (users must manually call vesting.claim() to actually make the vested share of tokens transferable in their account).

Describe alternatives you've considered
None

Additional context
Note that storage keys for user accounts are different for each pallet. This is probably a non-issue for squid but adding just in case - this is how to convert storage keys to actual accounts in JS:

   const vestingSchedules = await api.query.vesting.vestingSchedules.entries();
    const vestingAccounts = vestingSchedules.map(([key, _]) => key.args[0].toHuman());
    const escrowLocked = await api.query.escrow.locked.entries();
    const escrowAccounts = escrowLocked.map(([key, _]) => key.args[0].toHuman());

storage key (in this case) is basically [pallet, itemName, mapKey]
hence key.args[0] to get the mapKey - the account

@alexeiZamyatin alexeiZamyatin added the enhancement New feature or request label Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant