1package probe23import (4 "chain"5 "testing"67 "gno.land/p/nt/testutils/v0"8 "gno.land/p/nt/uassert/v0"9)1011const selfPath = "gno.land/r/moul/x/framelab/probe/v0"1213func self() address { return chain.PackageAddress(selfPath) }1415// The claim: pure-package code called with a forwarded `cur` still runs in the16// importing realm's frame, so it reports that realm's path and address and its17// `cur` is still accepted as current by grc20's spoof check.18func TestPureCodeKeepsImportingRealmFrame(cur realm, t *testing.T) {19 alice := testutils.TestAddress("alice")20 testing.SetRealm(testing.NewUserRealm(alice))2122 path, addr, isCurrent := Frame(cross(cur))23 uassert.Equal(t, selfPath, path)24 uassert.Equal(t, self().String(), addr.String())25 uassert.True(t, isCurrent)26}2728// The same claim, exercised through the operation that actually matters: a29// GRC20 pull issued from inside the pure package must credit the instance30// realm's own address.31func TestPureCodePullsToImportingRealm(cur realm, t *testing.T) {32 alice := testutils.TestAddress("alice")33 ledger.Mint(alice, 1_000)34 ledger.Approve(alice, self(), 500)3536 testing.SetRealm(testing.NewUserRealm(alice))37 bound := Run(cross(cur), alice, 400)3839 uassert.Equal(t, self().String(), bound.String())40 uassert.Equal(t, int64(400), Token.BalanceOf(self()))41 uassert.Equal(t, int64(600), Token.BalanceOf(alice))42 uassert.Equal(t, int64(100), Token.Allowance(alice, self()))43}44Frame(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}) (string, string, bool)
Run(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) string
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
Render unavailable
rate limit exceeded — the render query is served by the Gnoland archive RPC.
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.