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

Ability to query total liquid supply in the system #7774

Closed
4 tasks
devashishdxt opened this issue Nov 2, 2020 · 7 comments
Closed
4 tasks

Ability to query total liquid supply in the system #7774

devashishdxt opened this issue Nov 2, 2020 · 7 comments

Comments

@devashishdxt
Copy link
Contributor

Summary

Support for querying total liquid supply, i.e., the total amount in the system which is immediately transferrable.

Problem Definition

What problems may be addressed by introducing this feature?

  • Currently, there is no easy way to query total liquid supply other than (querying each module for the amounts stored in their module accounts + total unvested amount in vesting accounts) and subtracting it from total supply.

What benefits does the SDK stand to gain by including this feature?

  • It'll be easy to query total liquid supply.

Are there any disadvantages of including this feature? No.

Proposal

Similar to the total supply, have hooks on bank module functions which transfers tokens from module accounts to account addresses and vice versa to keep track of total amounts stored in module accounts. In vesting module, keep track of all the vesting account addresses and add a function to calculate the total unvested amounts. Finally, when the user queries for liquid supply, calculate it by using above two values and subtracting it from total supply.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@fedekunze
Copy link
Collaborator

I think this issue is very relevant and should be prioritized. We had a lot of back and forth with Coinmarketcap in 2019 due to this same issue.

Take IBC for example, when you transfer a token from chain A -> B via IBC, you chain A locks the coins by sending them to the module account. Upon receiving it, chain B mints an IBC voucher and sends it to the recipient. The tokens from chain A are not liquid nor circulating, which is not recognized by the bank supply query.

The supply query now only returns a set of coins instead of the general Supply interface from bank.

cc: @cwgoes @colin-axner

@anilcse
Copy link
Collaborator

anilcse commented Jun 25, 2021

Akash has something I believe https://github.com/ovrclk/cosmos-supply-summary

@aaronc
Copy link
Member

aaronc commented Jun 25, 2021

In order for this to happen, we either need to:

  • track the liquid supply as an index (part of x/auth, x/bank and vesting Re-design #9336) so that the query doesn't have to iterate over all accounts
  • make sure that queries don't block ABCI, which I believe will be possible when ABCI++ and SMT are integrated

@tac0turtle
Copy link
Member

closing in favour of #7774

@devashishdxt
Copy link
Contributor Author

closing in favour of #7774

Closing in favor of same issue?

@anilcse
Copy link
Collaborator

anilcse commented Aug 9, 2022

closing in favour of #7774

Closing in favor of same issue?

I guess its in favor of #11239

@tac0turtle
Copy link
Member

sorry copied the wrong issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

7 participants