1// PKGPATH: gno.land/r/demo/grc20provenance23// This filetest is the reference for how an indexer attributes a grc20 event to4// the realm that issued the token. It is the cross-realm counterpart to5// newtoken_event_filetest.gno, which covers the within-realm duplicate signal.6//7// Two fields matter, and neither is sufficient alone:
Functions
not supported for pure packages by the node (vm/qfuncs)
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
8
//
9// - pkg_path is stamped by the VM from the package whose code calls
10// chain.Emit. Every genuine grc20 event therefore carries
11// gno.land/p/nt/grc20/v0 — a constant, so it identifies the library
12// but never the token.
13// - the "token" attribute carries Token.ID(), whose leading component is
14// rlm.PkgPath() captured under IsCurrent() in NewToken. A realm cannot
15// produce a Token whose id claims a different realm.
16//
17// Chained, they are sufficient: pkg_path proves the event came from grc20's
18// code, and grc20's code only ever writes an IsCurrent-verified realm prefix
19// into "token". So for any event bearing grc20's pkg_path, the realm prefix in
20// "token" is unforgeable.
21//
22// The realm below is an impostor trying to pass its own transfers off as
23// another realm's token, by both routes available to it, and failing at both.
24package grc20provenance
25
26import (
27"chain"
28
29"gno.land/p/nt/grc20/v0"
30)
31
32// Stand-in for a token issued and registered by some other realm. Written as a
33// literal rather than imported: a filetest under a /p/ package that imports an
34// /r/ realm which itself imports that /p/ package forms a genesis dependency