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/r/gnoswap/gov/xgns

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
xgns
Namespace
gnoswap / gov
Files
4 (README)(gnomod.toml)
Exported functions
6
Module
gno.land/r/gnoswap/gov/xgns
gno
0.9
This realm implements a recognized token.xGNS →

Files (4)

  • README.mdmarkdown
  • gnomod.tomltoml
  • doc.gnogno
  • xgns.gnogno
xgns.gnogno
1package xgns23import (4	"chain"5	"errors"6	"strings"78	"gno.land/p/nt/grc20/v0"9	"gno.land/p/nt/ownable/v0"10	"gno.land/p/nt/ufmt/v0"1112	"gno.land/r/gnoswap/access/v1"13	"gno.land/r/gnoswap/halt/v1"1415	prbac "gno.land/p/gnoswap/rbac/v1"16)1718const tokenID = 01920var (21	admin = ownable.NewWithAddress(chain.PackageAddress(prbac.ROLE_GOV_STAKER.String()))2223	token  *grc20.Token24	ledger *grc20.PrivateLedger25)2627func init(cur realm) {28	token, ledger = grc20.NewToken("XGNS", "xGNS", 6, tokenID, cur)29}3031// TotalSupply returns the total supply of xGNS tokens.32//33// Returns:34//   - supply: total xGNS token supply35func TotalSupply() int64 {36	return token.TotalSupply()37}3839// BalanceOf returns token balance for address.40//41// Parameters:42//   - owner: address to check balance for43//44// Returns:45//   - balance: token balance amount46func BalanceOf(owner address) int64 {47	return token.BalanceOf(owner)48}4950// Render returns a formatted representation of the token state.51//52// Parameters:53//   - path: render path for specific views54//55// Returns:56//   - output: formatted token state representation57func Render(path string) string {58	if path == "" {59		return token.RenderHome()60	}6162	parts := strings.Split(path, "/")63	switch parts[0] {64	case "balance":65		if len(parts) != 2 {66			return "404\n"67		}68		balance := token.BalanceOf(address(parts[1]))69		return ufmt.Sprintf("%d\n", balance)70	default:71		return "404\n"72	}73}7475// Mint mints tokens to an address.76//77// Parameters:78//   - cur: current realm context; callers use cross(cur) when crossing into this79//     realm.80//   - to: recipient address receiving the newly minted tokens.81//   - amount: number of xGNS token units to mint.82//83// Only callable by governance staker contract.84func Mint(cur realm, to address, amount int64) {85	halt.AssertIsNotHaltedXGns()8687	caller := cur.Previous().Address()88	access.AssertIsGovStaker(caller)8990	checkErr(ledger.Mint(to, amount))91}9293// Burn burns tokens from an address.94//95// Parameters:96//   - cur: current realm context; callers use cross(cur) when crossing into this97//     realm.98//   - from: address whose xGNS balance is burned.99//   - amount: number of xGNS token units to burn.100//101// Only callable by governance staker contract.102func Burn(cur realm, from address, amount int64) {103	halt.AssertIsNotHaltedWithdraw()104105	caller := cur.Previous().Address()106	access.AssertIsGovStaker(caller)107108	checkErr(ledger.Burn(from, amount))109}110111// SupplyInfo returns supply breakdown information.112//113// Returns:114//   - totalIssued: total xGNS tokens issued115//   - issuedByDelegate: tokens issued through governance delegation116//   - issuedByDepositGns: tokens issued through launchpad deposit117//   - err: nil when the launchpad address is registered; an error when it cannot118//     be found.119func SupplyInfo() (totalIssued, issuedByDelegate, issuedByDepositGns int64, err error) {120	launchpad, ok := access.GetAddress(prbac.ROLE_LAUNCHPAD.String())121	if !ok {122		return 0, 0, 0, errors.New("launchpad address not found")123	}124125	totalIssued = token.TotalSupply()126	issuedByDepositGns = token.BalanceOf(launchpad)127	issuedByDelegate = totalIssued - issuedByDepositGns128129	return totalIssued, issuedByDelegate, issuedByDepositGns, nil130}131132func checkErr(err error) {133	if err != nil {134		panic(err)135	}136}137

Functions

  • BalanceOf(owner string) int64

  • Burn(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, from string, amount int64)

  • Mint(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, to string, amount int64)

  • Render(path string) string

  • SupplyInfo() (totalIssued int64, issuedByDelegate int64, issuedByDepositGns int64, err interface {Error func() string})

  • TotalSupply() int64

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

Rendered

RenderedRawgnoweb ↗

vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.