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/moul/x/framelab/v0

Package
Open in gnoweb ↗

Overview

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

Files (3)

  • README.mdmarkdown
  • gnomod.tomltoml
  • framelab.gnogno
framelab.gnogno
1// Package framelab probes, at runtime, which realm frame pure-package code2// executes in when a realm forwards its own `cur` into it.3//4// The whole instance-per-realm ("factory") pattern rests on the answer: if a5// p/ helper acting on `cur` binds to the *importing realm's* identity, then a6// 20-line instance realm can hold state and funds while every line of logic7// lives in one shared pure package. If instead the frame shifts, the pattern8// is dead and each instance has to carry its own copy of the logic.9package framelab1011import "gno.land/p/nt/grc20/v0"1213// The leading `_ int` is mandatory, not cosmetic: gno rejects a function whose14// FIRST parameter is `realm` when it is declared in a pure package ("crossing15// function declared in non-realm package"). Same reason grc20's Teller methods16// are shaped `Transfer(_ int, rlm realm, ...)`. The name matters too: only the17// first realm argument of a real crossing function may be called `cur`.18//19// Who reports the frame identity as seen from inside pure-package code.20func Who(_ int, rlm realm) (pkgPath string, addr address, isCurrent bool) {21	return rlm.PkgPath(), rlm.Address(), rlm.IsCurrent()22}2324// Pull performs the operation the pattern actually needs: a GRC20 pull done by25// pure-package code, under the importing realm's identity. It returns the26// address the teller bound to, which is the claim under test.27func Pull(_ int, rlm realm, tok *grc20.Token, from address, amount int64) address {28	self := rlm.Address()29	err := tok.RealmTeller(0, rlm).TransferFrom(0, rlm, from, self, amount)30	if err != nil {31		panic(err)32	}33	return self34}35

Functions

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

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