r0gue-io / pop-node

Pop Network makes it easy for smart contract developers to use the Power of Polkadot.
The Unlicense
24 stars 6 forks source link

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

Open al3mart opened 1 week ago

al3mart commented 1 week ago

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:

evilrobot-01 commented 6 days 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.

soloking1412 commented 4 days ago

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

Krayt78 commented 1 day ago

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

evilrobot-01 commented 19 hours ago

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.