dfinity / ICRC-1

A fungible token standard developed by the Ledger & Tokenization working group for the IC.
Apache License 2.0
80 stars 36 forks source link

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

Open MarioDfinity opened 1 year ago

MarioDfinity commented 1 year ago

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.

roman-kashitsyn commented 1 year ago

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