gno
gno copied to clipboard
RFC(grc20): standardizing token precision
We need to decide whether GRC20 tokens should use int64 (64-bit) or uint256 (256-bit).
Context
- GnoVM and
std.Coinuseint64, 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
- 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
- Use
uint256
- Matches Uniswap-style math, and increase native compatibility with other ecosystems
- Adds complexity, type conversions, and risks
- Support both
- Define
grc20andgrc20u256(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
related issue #4335
also somewhat related: https://github.com/gnolang/gno/issues/3692