PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/p/nt/grc20/v0

Package
Open in gnoweb ↗

Overview

Kind
Pure package
Name
v0
Namespace
nt / grc20
Files
12 (gnomod.toml)
Exported functions
n/a — not supported for pure packages by the node (vm/qfuncs)
Module
gno.land/p/nt/grc20/v0
gno
0.9

Files (12)

  • gnomod.tomltoml
  • mock.gnogno
  • tellers.gnogno
  • token.gnogno
  • types.gnogno
  • caller_teller_sub_realm_filetest.gnogno
  • event_provenance_filetest.gno
gno
  • examples_test.gnogno
  • newtoken_event_filetest.gnogno
  • tellers_test.gnogno
  • token_identity_filetest.gnogno
  • token_test.gnogno
  • newtoken_event_filetest.gnogno
    1// PKGPATH: gno.land/r/demo/grc20dupsignal23// This filetest is the reference for the detection rule the NewToken event4// enables. The realm below reuses seqid 0 twice, so both tokens end up with the5// same Token.ID() and their Transfer events are indistinguishable — the6// long-standing event-provenance ambiguity.7//

    Functions

    not supported for pure packages by the node (vm/qfuncs)

    Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

    8
    // What changes is that the ambiguity is now *announced*. Two NewToken events
    9// carry the same "token" value, which is a complete signal: NewToken is the only
    10// way a Token can exist (Token's fields are unexported), so an indexer watching
    11// this event sees every token that will ever emit. On the second duplicate
    12// announcement it should flag the realm and stop trusting its token events.
    13package grc20dupsignal
    14
    15import (
    16 "gno.land/p/nt/grc20/v0"
    17)
    18
    19func main(cur realm) {
    20 first, firstLedger := grc20.NewToken("Same", "DUP", 6, 0, cur)
    21 second, secondLedger := grc20.NewToken("Same", "DUP", 6, 0, cur)
    22
    23 println("same id:", first.ID() == second.ID())
    24
    25 // Two independent ledgers, one identifier: these Transfers cannot be
    26 // attributed to either object from the event stream alone.
    27 firstLedger.Mint(cur.Address(), 1)
    28 secondLedger.Mint(cur.Address(), 999999)
    29}
    30
    31// Output:
    32// same id: true
    33
    34// Events:
    35// [
    36// {
    37// "type": "NewToken",
    38// "attrs": [
    39// {
    40// "key": "token",
    41// "value": "gno.land/r/demo/grc20dupsignal.DUP.0000000"
    42// },
    43// {
    44// "key": "name",
    45// "value": "Same"
    46// },
    47// {
    48// "key": "symbol",
    49// "value": "DUP"
    50// },
    51// {
    52// "key": "decimals",
    53// "value": "6"
    54// }
    55// ],
    56// "pkg_path": "gno.land/p/nt/grc20/v0"
    57// },
    58// {
    59// "type": "NewToken",
    60// "attrs": [
    61// {
    62// "key": "token",
    63// "value": "gno.land/r/demo/grc20dupsignal.DUP.0000000"
    64// },
    65// {
    66// "key": "name",
    67// "value": "Same"
    68// },
    69// {
    70// "key": "symbol",
    71// "value": "DUP"
    72// },
    73// {
    74// "key": "decimals",
    75// "value": "6"
    76// }
    77// ],
    78// "pkg_path": "gno.land/p/nt/grc20/v0"
    79// },
    80// {
    81// "type": "Transfer",
    82// "attrs": [
    83// {
    84// "key": "token",
    85// "value": "gno.land/r/demo/grc20dupsignal.DUP.0000000"
    86// },
    87// {
    88// "key": "from",
    89// "value": ""
    90// },
    91// {
    92// "key": "to",
    93// "value": "g1k29lxz0d8gx7m94n032ulum875p7gg0kduus5m"
    94// },
    95// {
    96// "key": "value",
    97// "value": "1"
    98// }
    99// ],
    100// "pkg_path": "gno.land/p/nt/grc20/v0"
    101// },
    102// {
    103// "type": "Transfer",
    104// "attrs": [
    105// {
    106// "key": "token",
    107// "value": "gno.land/r/demo/grc20dupsignal.DUP.0000000"
    108// },
    109// {
    110// "key": "from",
    111// "value": ""
    112// },
    113// {
    114// "key": "to",
    115// "value": "g1k29lxz0d8gx7m94n032ulum875p7gg0kduus5m"
    116// },
    117// {
    118// "key": "value",
    119// "value": "999999"
    120// }
    121// ],
    122// "pkg_path": "gno.land/p/nt/grc20/v0"
    123// }
    124// ]
    125