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/referral/v1

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
v1
Namespace
gnoswap / referral
Files
9 (README)(gnomod.toml)
Exported functions
8
Module
gno.land/r/gnoswap/referral/v1
gno
0.9

Files (9)

  • README.mdmarkdown
  • gnomod.tomltoml
  • assert.gnogno
  • doc.gnogno
  • errors.gnogno
  • global_keeper.gnogno
  • keeper.gnogno
  • render.gnogno
  • type.gnogno
  • render.gnogno
    1package referral23import (4	"strings"5	"time"67	"gno.land/p/moul/md/v0"8	"gno.land/p/moul/mdtable/v0"9	ufmt "gno.land/p/nt/ufmt/v0"10)1112// Render describes referral registration or shows the referral for an address.13func Render(path string) string {14	if path == "" {15		table := mdtable.Table{16			Headers: []string{"Rule", "Value"},17			Rows: [][]string{18				{"Minimum interval between registrations or updates", ufmt.Sprintf("%d hours", MinTimeBetweenUpdates/3600)},19			},20		}2122		return md.H1("Gnoswap Referrals") +23			"\n" +24			md.Paragraph("Authorized protocol contracts register a referrer for each address.") +25			md.H2("Registration") +26			"\n" +27			table.String() +28			"\n" +29			md.Paragraph(30				"Removing a referral bypasses the interval but does not reset the last registration time.\n"+31					"Address-specific records are available at "+md.InlineCode("address/<address>")+".",32			)33	}3435	parts := strings.Split(path, "/")36	if len(parts) != 2 || parts[0] != "address" || parts[1] == "" {37		return "404\n"38	}3940	addr := parts[1]41	if !HasReferral(addr) {42		return "404\n"43	}4445	lastOpTimestamp, err := GetLastOpTimestamp(addr)46	if err != nil {47		return "404\n"48	}4950	table := mdtable.Table{51		Headers: []string{"Field", "Value"},52		Rows: [][]string{53			{"Address", addr},54			{"Referrer", GetReferral(addr)},55			{"Last registration or update (UTC)", time.Unix(lastOpTimestamp, 0).UTC().Format("2006-01-02 15:04:05")},56		},57	}5859	return md.H1("Gnoswap Referral") +60		"\n" +61		md.H2("Referral record") +62		"\n" +63		table.String()64}65

    Functions

    • ContractAddress() string

    • GetLastOpTimestamp(addr string) (int64, interface {Error func() string})

    • GetReferral(addr string) string

    • HasReferral(addr string) bool

    • IsEmpty() bool

    • NewKeeper() interface {get func(.uverse.address) (.uverse.address, .uverse.error); getLastOpTimestamp func(.uverse.address) (int64, .uverse.error); has func(.uverse.address) bool; isEmpty func() bool; register func(.uverse.address, .uverse.address) (.uverse.address, .uverse.error)}

    • Render(path string) string

    • TryRegister(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}, addr string, referral string) string

    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.