-
-
Save moul/113c2cc8bb27ce80969995192ddb4c7f to your computer and use it in GitHub Desktop.
txtar linguist mode comparison
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test for add package | |
## start a new node | |
gnoland start | |
# add registry | |
gnokey maketx addpkg -pkgdir $WORK/registry -pkgpath gno.land/r/registry -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, before it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'not found' | |
# add foo20, and foo20wrapper | |
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
# we call Transfer with foo20, after it's registered | |
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | |
stdout 'same address, success!' | |
-- registry/registry.gno -- | |
package registry | |
import "std" | |
type transferCb func(to std.Address, amount uint64) string | |
type pair struct {name string; cb transferCb} | |
var registry = []pair{} | |
func Register(name string, cb transferCb) { registry = append(registry, pair{name: name, cb: cb}) } | |
func TransferByName(name string, to string, amount uint64) string { | |
for _, pair := range registry { | |
if pair.name == name { | |
if std.CurrentRealm().Addr().String() == pair.cb(std.Address(to), amount) { | |
return "same address, success!" | |
} else { | |
return "invalid address, ownership issue :(" | |
} | |
return "registry=" + std.CurrentRealm().Addr().String() + " " + pair.cb(std.Address(to), amount) | |
} | |
} | |
return "not found" | |
} | |
-- foo20wrapper/foo20wrapper.gno -- | |
package foo20wrapper | |
import "gno.land/r/registry" | |
import "gno.land/r/foo20" | |
func init() { | |
registry.Register("foo20", foo20.Transfer) | |
} | |
-- foo20/foo20.gno -- | |
package foo20 | |
import "std" | |
func Transfer(to std.Address, amount uint64) string { | |
println("transfer from=" + std.PrevRealm().Addr().String() + " to=" + to.String() + " some-amount") | |
return std.PrevRealm().Addr().String() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment