gno icon indicating copy to clipboard operation
gno copied to clipboard

RFC(grc20): standardizing token precision

Open moul opened this issue 6 months ago • 2 comments

We need to decide whether GRC20 tokens should use int64 (64-bit) or uint256 (256-bit).

Context

  • GnoVM and std.Coin use int64, including gas and bank logic.
  • Gnoswap is the only contract using uint256, and only temporarily, for Uniswap ported math. It still stores values as int64.

Options

  1. Use int64 (my preference)
  • Fully compatible with Gno’s native coin system
  • Follows token philosophy
  • Keeps the ecosystem simpler
  • We can provide a helper lib (e.g. p/tokeninterop) for interop with 256-bit systems
  1. Use uint256
  • Matches Uniswap-style math, and increase native compatibility with other ecosystems
  • Adds complexity, type conversions, and risks
  1. Support both
  • Define grc20 and grc20u256 (question: how to name them?)
  • Adds flexibility, but splits ecosystem and increases maintenance

Future with Gno2

Gno2 could support native uint256 types (compiling to big.Int or something else), making dual precision cleaner in the long term.

Let’s agree on a direction so future contracts have clear guidance. I’m in favor of sticking with int64, and helping with optional interop libraries.

cc @gnolang/onbloc

moul avatar Jun 13 '25 09:06 moul

related issue #4335

notJoon avatar Jun 13 '25 23:06 notJoon

also somewhat related: https://github.com/gnolang/gno/issues/3692

leohhhn avatar Jun 16 '25 13:06 leohhhn