Open al3mart opened 1 week ago
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.
I propose expanding the pop-api::fungibles read functionality by adding methods to retrieve asset roles, minimum balance requirements, and sufficiency status.
@al3mart Could you expand a bit on these two please ? I cant quite understand what needs to be done
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.
Right now we expose certain read functions so that contracts integrating
pop-api::fungibles
can read:It would be great expanding the read capabilities such that a contract can obtain the following asset details: