NewToken creates a Token whose origRealm is bound to the calling realm. rlm must be the caller's own captured cur (asserted via rlm.IsCurrent()), and rlm.PkgPath() — the calling realm itself — becomes the Token's origRealm. Token.ID() returns origRealm + "." + symbol + "." + id.
Because IsCurrent runtime-validates that rlm came from the live crossing frame, origRealm is unforgeable: an external realm cannot fabricate a Token claiming to belong to a different package.
Realms that create multiple tokens should allocate id from one persistent seqid.ID, shared by every creation path, to avoid conflicting identifiers:
Example
1var nextTokenID seqid.ID
2Token, ledger := grc20.NewToken("Foo", "FOO", 4, nextTokenID.Next(), cur)
A realm that creates only a single token can pass 0 directly, since no other token of that realm can collide with it.
If the Token should be discoverable, follow up with grc20reg.Register(cross(cur), Token, slug). The registry key is Token.ID().
Every successful call emits a NewToken event carrying the resulting Token.ID(). Because Token's fields are unexported, NewToken is the only way a Token can come into existence, so this event makes token creation fully observable: an indexer that sees the same Token.ID() announced twice knows the realm built two independent ledgers behind one identifier, and that every later Mint/Burn/Transfer/Approval carrying that id is ambiguous. Such a realm is emitting untrustworthy events and should be flagged or ignored wholesale.