1package common23import (4 "errors"56 _ "gno.land/r/gnoswap/rbac/v1" // initialize readable contract role(s)78 "gno.land/p/gnoswap/store/v1"9 "gno.land/p/gnoswap/version_manager/v1"10)1112var (13 currentAddress address14 domainPath string1516 kvStore store.KVStore1718 versionManager version_manager.VersionManager19 implementation ICommon20)2122func init(cur realm) {23 currentAddress = cur.Address()24 domainPath = cur.PkgPath()2526 kvStore = store.NewKVStore(currentAddress)2728 versionManager = version_manager.NewVersionManager(29 domainPath,30 kvStore,31 initializeDomainStore,32 )3334 implementation = nil35}3637// common keeps no domain state; implementations only resolve tokens.38func initializeDomainStore(_ int, rlm realm, kvStore store.KVStore) any {39 return nil40}4142func getImplementation() ICommon {43 if implementation == nil {44 panic("implementation is not initialized")45 }4647 return implementation48}4950func updateImplementation() error {51 result := versionManager.GetCurrentImplementation()52 if result == nil {53 return errors.New("implementation is not initialized")54 }5556 impl, ok := result.(ICommon)57 if !ok {58 return errors.New("impl is not an ICommon")59 }6061 implementation = impl6263 return nil64}65Allowance(tokenKey string, owner string, spender string) int64
Approve(int, rlm 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}, tokenKey string, spender string, amount int64) interface {Error func() string}
AssertIsNotHandleNativeCoin()
BalanceOf(tokenKey string, addr string) int64
GetImplementationPackagePath() string
IsRegistered(tokenKey string) interface {Error func() string}
MustRegistered(tokenKeys ...string)
RegisterInitializer(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}, initializer func(int, .uverse.realm) gno.land/r/gnoswap/common.ICommon)
Render(path string) string
SafeGRC20Approve(int, rlm 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}, tokenKey string, spender string, amount int64)
SafeGRC20Transfer(int, rlm 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}, tokenKey string, to string, amount int64)
SafeGRC20TransferFrom(int, rlm 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}, tokenKey string, from string, to string, amount int64)
TotalSupply(tokenKey string) int64
Transfer(int, rlm 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}, tokenKey string, to string, amount int64) interface {Error func() string}
TransferFrom(int, rlm 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}, tokenKey string, from string, to string, amount int64) interface {Error func() string}
UpgradeImpl(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}, packagePath string)
ValidateRegistered(tokenKeys ...string) interface {Error func() string}
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
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.