Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Playground

gnomod.toml

module = "gno.land/r/moul/x/upgrade/adminreg/impl/v0"
gno = "0.9"

[addpkg]
  creator = "g1manfred47kzduec920z88wfr64ylksmdcedlf5"
  height = 410018
  max_deposit = "5000000ugnot"

impl.gno

// Package impl is version 0 of the implementation realm of the "propose and
// accept" upgrade pattern (pattern F; see ../../README.md).
//
// Deploying it only nominates it. It serves nothing until the facade's owner
// accepts this path.
package impl

import (
	facade "gno.land/r/moul/x/upgrade/adminreg/facade/v0"
)

type greeter struct{}

func (greeter) Greet(name string) string { return "hello, " + name }
func (greeter) Version() string          { return "impl/v0" }

// Instance exposes the singleton.
func Instance() facade.Impl { return greeter{} }

func init(cur realm) {
	facade.Propose(cross(cur), Instance())
}

// Propose re-nominates this implementation. init does it at deploy; exposing it
// as a transaction lets a candidate be restored without redeploying.
func Propose(cur realm) {
	facade.Propose(cross(cur), Instance())
}

// Path is this realm's own package path, the string the facade owner accepts.
const Path = "gno.land/r/moul/x/upgrade/adminreg/impl/v0"