ICRC-1 icon indicating copy to clipboard operation
ICRC-1 copied to clipboard

ICRC-1: Add icrc1:token-integer-width metadata

Open MarioDfinity opened this issue 2 years ago • 1 comments

The ICRC-1 standard uses nat for numbers. An issue with using nat is that who integrates with the Ledger is left guessing the real type behind it. For example, the ICP Ledger uses nat64 and all the integrators, e.g. UIs, will downcast nat to nat64 based on the implicit knowledge they have of the Ledger. Not all ICRC-1 implementations will use nat64 and integrators should not be left guessing. A concrete example would be a ICRC-1 implementation for ERC-20 tokens.

I propose to expose the number of bits as the metadata icrc1:token-integer-width which integrators can use it to properly integrate with any ledger.

MarioDfinity avatar Mar 10 '23 10:03 MarioDfinity

The idea LGTM, but I find the metadata entry name somewhat confusing. Maybe we could call it icrc1:token-integer-width or something similar?

roman-kashitsyn avatar Mar 10 '23 11:03 roman-kashitsyn