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

feat(pop-api): expose read functions to obtain asset details #379

Open
al3mart opened this issue Nov 12, 2024 · 11 comments
Open

feat(pop-api): expose read functions to obtain asset details #379

al3mart opened this issue Nov 12, 2024 · 11 comments
Labels
api Pop API kudos List this issue on morekudos.com

Comments

@al3mart
Copy link
Collaborator

al3mart commented Nov 12, 2024

Right now we expose certain read functions so that contracts integrating pop-api::fungibles can read:

  • the total supply
  • the balance of a certain account
  • the allowance
  • the token name
  • the token symbol
  • the token decimals
  • and whether some token exists.

It would be great expanding the read capabilities such that a contract can obtain the following asset details:

  • roles
  • minimum balance for an asset
  • whether an asset is sufficient
@al3mart al3mart added api Pop API kudos List this issue on morekudos.com labels Nov 12, 2024
@evilrobot-01
Copy link
Collaborator

From an API perspective, it would be great if I could specify the attributes (bitflags) I want in a single call. I guess the only strongly typed return type would be a vector of enum variants though.

@soloking1412
Copy link

I propose expanding the pop-api::fungibles read functionality by adding methods to retrieve asset roles, minimum balance requirements, and sufficiency status.

@Krayt78
Copy link

Krayt78 commented Nov 18, 2024

@al3mart Could you expand a bit on these two please ? I cant quite understand what needs to be done

  • minimum balance for an asset
  • whether an asset is sufficient

@evilrobot-01
Copy link
Collaborator

Ale is off for a few days so thought I might try to answer your question. The fungibles pallet wraps the assets pallet from the SDK to provide a stable interface for contracts which is standards compliant and hopefully easier to use for smart contract devs. We have various read functions (example), so that a contract can query certain state of a fungible token as required. The current read functions available do not surface all of the useful state to contracts, as indicated by Ale.

It would therefore be great to add a few additional read functions for those attributes on https://github.com/paritytech/polkadot-sdk/blob/b71bd53f5fde0624c828461432a6b0f223c585c2/substrate/frame/assets/src/types.rs#L52 which are useful. Ale named roles, min balance and sufficiency. The existing implementation can be replicated for the additional ones added. Note that exposing such reads from the fungibles pallets will also require corresponding benchmarks (example)

Finally, at least from my perspective, it would be useful to improve the API so that a contract can specify multiple attributes to be queried in a single call, but this should probably be dealt with in a separate issue to keep the scope here limited.

@Krayt78
Copy link

Krayt78 commented Nov 23, 2024

Awesome thx for the explanations and the links !
@soloking1412 you were there first, do you want to take this issue?

@soloking1412
Copy link

@Krayt78 Yes sure

@mittal-parth
Copy link

@soloking1412 / @Krayt78 are you working on this?

@soloking1412
Copy link

@mittal-parth Can I start working on this ?

@mittal-parth
Copy link

Sure go ahead, if you are doing so

@soloking1412
Copy link

Ok , can you say like after I make changes how to submit ?

@mittal-parth
Copy link

You can make a PR by following this guide from GitHub

You can check this link for a general guide to contribute to any open source project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Pop API kudos List this issue on morekudos.com
Projects
None yet
Development

No branches or pull requests

5 participants