Skip to content

Commit

Permalink
chore: update test3.gno.land backup
Browse files Browse the repository at this point in the history
  • Loading branch information
gfanton authored and github-actions[bot] committed Jun 25, 2024
1 parent f6c907c commit b2b8ae4
Show file tree
Hide file tree
Showing 23 changed files with 187 additions and 53 deletions.
Empty file.
21 changes: 18 additions & 3 deletions test3.gno.land/extracted/p/stuyk/test/package.gno
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
package hello
package userinvokes

func Render(path string) string {
return "Hello World!"
import "fmt"

var user_invokes map[string]int

func Render(name string) string {
if (!user_invokes) {
user_invokes = make(map[string]int)
}


if (!user_invokes[name]) {
user_invokes[name] += 1
} else {
user_invokes = 1
}

return fmt.Println("Total user invokes %d", user_invokes[name])
}
2 changes: 1 addition & 1 deletion test3.gno.land/extracted/p/test/hello/pkg_metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"creator":"g1fsu3z335h5qngf7t3lmakvpmpwg9ae76tqwh7c","deposit":"1ugnot"}
{"creator":"g15x46up6w3v9ey7wkltf05jt20pa6g39kkjjx8a","deposit":""}
120 changes: 110 additions & 10 deletions test3.gno.land/extracted/p/test/test/package.gno
Original file line number Diff line number Diff line change
@@ -1,17 +1,117 @@
package counter
package mynonfungibletoken

import "fmt"
import (
"std"
"gno.land/p/demo/grc/grc721"
"gno.land/p/demo/users"
"gno.land/p/demo/ufmt"
)

var count int
var (
admin std.Address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // set admin account
mynonfungibletoken = grc721.NewBasicNFT("mynonfungibletoken", "MNFT")
)

func Increment() {
count++
func init() {
mintNNFT(admin, 10) // @administrator (initial supply = 10 NFTs)
}

func Decrement() {
count--
func mintNNFT(owner std.Address, n uint64) {
count := mynonfungibletoken.TokenCount()
for i := count; i < count+n; i++ {
tid := grc721.TokenID(ufmt.Sprintf("%d", i))
mynonfungibletoken.Mint(owner, tid)
}
}

func Render(_ string) string {
return fmt.Sprintf("Count: %d", count)
}
// Getters

func BalanceOf(user users.AddressOrName) uint64 {
balance, err := mynonfungibletoken.BalanceOf(user.Resolve())
if err != nil {
panic(err)
}
return balance
}

func OwnerOf(tid grc721.TokenID) std.Address {
owner, err := mynonfungibletoken.OwnerOf(tid)
if err != nil {
panic(err)
}
return owner
}

func IsApprovedForAll(owner, user users.AddressOrName) bool {
return mynonfungibletoken.IsApprovedForAll(owner.Resolve(), user.Resolve())
}

func GetApproved(tid grc721.TokenID) std.Address {
addr, err := mynonfungibletoken.GetApproved(tid)
if err != nil {
panic(err)
}
return addr
}

// Setters

func Approve(user users.AddressOrName, tid grc721.TokenID) {
err := mynonfungibletoken.Approve(user.Resolve(), tid)
if err != nil {
panic(err)
}
}

func SetApprovalForAll(user users.AddressOrName, approved bool) {
err := mynonfungibletoken.SetApprovalForAll(user.Resolve(), approved)
if err != nil {
panic(err)
}
}

func TransferFrom(from, to users.AddressOrName, tid grc721.TokenID) {
err := mynonfungibletoken.TransferFrom(from.Resolve(), to.Resolve(), tid)
if err != nil {
panic(err)
}
}

// Admin

func Mint(to users.AddressOrName, tid grc721.TokenID) {
caller := std.PrevRealm().Addr()
assertIsAdmin(caller)
err := mynonfungibletoken.Mint(to.Resolve(), tid)
if err != nil {
panic(err)
}
}

func Burn(tid grc721.TokenID) {
caller := std.PrevRealm().Addr()
assertIsAdmin(caller)
err := mynonfungibletoken.Burn(tid)
if err != nil {
panic(err)
}
}

// Render

func Render(path string) string {
switch {
case path == "":
return mynonfungibletoken.RenderHome()
default:
return "404\n"
}
}

// Util

func assertIsAdmin(address std.Address) {
if address != admin {
panic("restricted access")
}
}
2 changes: 1 addition & 1 deletion test3.gno.land/extracted/p/test/test/pkg_metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"creator":"g1ghfakgzr6q77etpg8jtas6llg4uvqnfl8skxxq","deposit":"1ugnot"}
{"creator":"g1dnllrdzwfhxv3evyk09y48mgn5phfjvtyrlzm7","deposit":""}
12 changes: 9 additions & 3 deletions test3.gno.land/extracted/r/bluehoneybadger/person/person.gno
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
package person

// Importing `strconv` to be able to cast the age to string so it can be concatenated
import "strconv"

var (
myName = "John Smith"
myAge = 42
myAddress = "123 Main Street"
)

function Render(path string) string {
return "My name is: " + myName "my Age is: " + myAge "& my Address is: " myAddress
func Render(path string) string {
// You could also use "gno.land/p/demo/ufmt" package, check `ufmt.Sprintf()`
// See: https://test3.gno.land/p/demo/ufmt/ufmt.gno
// It works like standard Go's "Sprintf" but it only support "%s" and "%d" it think
return "My name is: " + myName + "my Age is: " + strconv.Itoa(myAge) + "& my Address is: " + myAddress
}

function UpdateAdddress(NewAddress string) string {
func updateAddress(NewAddress string) string {
myAddress = NewAddress
return "Your address has been updated"
}
2 changes: 1 addition & 1 deletion test3.gno.land/extracted/r/demo/apple/GRC20.gno
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

var (
apple *grc20.AdminToken
admin std.Address = "g1hqzeju0p0eup9rgxa0pxvyc0y7wnzjrdvppsy5"
admin std.Address = "g1sycj68ur0n7xytglx0me3f207ktudm80aqpysm"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion test3.gno.land/extracted/r/demo/apple/pkg_metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"creator":"g1098kpwkwv3r08cat9ssucrq4mznxyv855jgqvx","deposit":""}
{"creator":"g1sycj68ur0n7xytglx0me3f207ktudm80aqpysm","deposit":""}
28 changes: 14 additions & 14 deletions test3.gno.land/extracted/r/demo/gemcoin/GRC20.gno
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gemcoin
package GemCoin

import (
"std"
Expand All @@ -10,13 +10,13 @@ import (
)

var (
gemcoin *grc20.AdminToken
GemCoin *grc20.AdminToken
admin std.Address = "g17np07gtd7nj5rh4x582srdhd8247xa3s3us3y3"
)

func init() {
gemcoin = grc20.NewAdminToken("gemcoinToken", "GEM", 6)
gemcoin.Mint(admin, 1000000000) // @administrator
GemCoin = grc20.NewAdminToken("GemCoin", "Gem", 6)
GemCoin.Mint(admin, 1000000000) // @administrator
}

// method proxies as public functions.
Expand All @@ -25,19 +25,19 @@ func init() {
// getters.

func TotalSupply() uint64 {
return gemcoin.TotalSupply()
return GemCoin.TotalSupply()
}

func BalanceOf(owner users.AddressOrName) uint64 {
balance, err := gemcoin.BalanceOf(owner.Resolve())
balance, err := GemCoin.BalanceOf(owner.Resolve())
if err != nil {
panic(err)
}
return balance
}

func Allowance(owner, spender users.AddressOrName) uint64 {
allowance, err := gemcoin.Allowance(owner.Resolve(), spender.Resolve())
allowance, err := GemCoin.Allowance(owner.Resolve(), spender.Resolve())
if err != nil {
panic(err)
}
Expand All @@ -48,31 +48,31 @@ func Allowance(owner, spender users.AddressOrName) uint64 {

func Transfer(to users.AddressOrName, amount uint64) {
caller := std.GetOrigCaller()
gemcoin.Transfer(caller, to.Resolve(), amount)
GemCoin.Transfer(caller, to.Resolve(), amount)
}

func Approve(spender users.AddressOrName, amount uint64) {
caller := std.GetOrigCaller()
gemcoin.Approve(caller, spender.Resolve(), amount)
GemCoin.Approve(caller, spender.Resolve(), amount)
}

func TransferFrom(from, to users.AddressOrName, amount uint64) {
caller := std.GetOrigCaller()
gemcoin.TransferFrom(caller, from.Resolve(), to.Resolve(), amount)
GemCoin.TransferFrom(caller, from.Resolve(), to.Resolve(), amount)
}

// administration.

func Mint(address users.AddressOrName, amount uint64) {
caller := std.GetOrigCaller()
assertIsAdmin(caller)
gemcoin.Mint(address.Resolve(), amount)
GemCoin.Mint(address.Resolve(), amount)
}

func Burn(address users.AddressOrName, amount uint64) {
caller := std.GetOrigCaller()
assertIsAdmin(caller)
gemcoin.Burn(address.Resolve(), amount)
GemCoin.Burn(address.Resolve(), amount)
}

// render.
Expand All @@ -84,10 +84,10 @@ func Render(path string) string {

switch {
case path == "":
return gemcoin.RenderHome()
return GemCoin.RenderHome()
case c == 2 && parts[0] == "balance":
owner := users.AddressOrName(parts[1])
balance, _ := gemcoin.BalanceOf(owner.Resolve())
balance, _ := GemCoin.BalanceOf(owner.Resolve())
return ufmt.Sprintf("%d\n", balance)
default:
return "404\n"
Expand Down
4 changes: 2 additions & 2 deletions test3.gno.land/extracted/r/demo/grass/GRC20.gno
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (

var (
grass *grc20.AdminToken
admin std.Address = "g10jtus48tdlp93l9jw9q0tws5jh7gmpjdtyqkxh"
admin std.Address = "g148vmqxzgp4yc996pasredy3v9sw8sxzsgem0qv"
)

func init() {
grass = grc20.NewAdminToken("grassToken", "grass", 6)
grass.Mint(admin, 1000000000) // @administrator
grass.Mint(admin, 2443000) // @administrator
}

// method proxies as public functions.
Expand Down
2 changes: 1 addition & 1 deletion test3.gno.land/extracted/r/demo/grass/pkg_metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"creator":"g10jtus48tdlp93l9jw9q0tws5jh7gmpjdtyqkxh","deposit":""}
{"creator":"g148vmqxzgp4yc996pasredy3v9sw8sxzsgem0qv","deposit":""}
2 changes: 1 addition & 1 deletion test3.gno.land/extracted/r/demo/hello/pkg_metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"creator":"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5","deposit":""}
{"creator":"g1ndzpczjr2rzrchtkm3tsut2xjfn50mlgax2v77","deposit":"1ugnot"}
6 changes: 3 additions & 3 deletions test3.gno.land/extracted/r/demo/yas/GRC20.gno
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (

var (
yas *grc20.AdminToken
admin std.Address = "g1ggcgpqp2jfs2sgsnlcmzscd38jjvgk0y66sl2x"
admin std.Address = "g1s67msjqmq0jwyzqlm8y578stkxppzyrt6nuhsw"
)

func init() {
yas = grc20.NewAdminToken("yasToken", "yas", 6)
yas = grc20.NewAdminToken("YasToken", "YAS", 6)
yas.Mint(admin, 1000000000) // @administrator
}

Expand Down Expand Up @@ -98,4 +98,4 @@ func assertIsAdmin(address std.Address) {
if address != admin {
panic("restricted access")
}
}
}
2 changes: 1 addition & 1 deletion test3.gno.land/extracted/r/demo/yas/pkg_metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"creator":"g1ggcgpqp2jfs2sgsnlcmzscd38jjvgk0y66sl2x","deposit":""}
{"creator":"g1s67msjqmq0jwyzqlm8y578stkxppzyrt6nuhsw","deposit":"1ugnot"}
2 changes: 1 addition & 1 deletion test3.gno.land/extracted/r/demo/yep/pkg_metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"creator":"g1p809wnm9glgxu8lauaeattqlwh92gd0vcrlm46","deposit":""}
{"creator":"g140pvdhzwxtg8yazp5zfqtmshqnt2mefs764yrw","deposit":""}
13 changes: 11 additions & 2 deletions test3.gno.land/extracted/r/demo2/greeting/package.gno
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
package hello

func Render(path string) string {
return "Hello World!"
var (
greeting string
)

func SetGreeting(msg string) {
greeting = msg
}

func GetGreeting()) string {
return "greeting"
}

2 changes: 1 addition & 1 deletion test3.gno.land/extracted/r/hello/hello/pkg_metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"creator":"g10y2y4l4g7cx23tkl9jy5u638lw5aykvx7upqaz","deposit":"1ugnot"}
{"creator":"g15wmukt79xymnnu6c4de32trnufudqum60yrxu8","deposit":""}
6 changes: 5 additions & 1 deletion test3.gno.land/extracted/r/hello15/hello/package.gno
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package hello

func Render(path string) string {
func B(path []string) string {
return "Hello World!"
}

func A(path string) string {
return "Hello World!"
}
2 changes: 1 addition & 1 deletion test3.gno.land/extracted/r/hello15/hello/pkg_metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"creator":"g1uf8u5jf2m9l80g0zsfq7tufl3qufqc4393jtkl","deposit":"1ugnot"}
{"creator":"g1ejrxf88yp390dr48a0wxyaed3vxj0243at292p","deposit":"1ugnot"}
2 changes: 1 addition & 1 deletion test3.gno.land/extracted/r/test/hello/pkg_metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"creator":"g15wmukt79xymnnu6c4de32trnufudqum60yrxu8","deposit":"1ugnot"}
{"creator":"g10y2y4l4g7cx23tkl9jy5u638lw5aykvx7upqaz","deposit":"1ugnot"}
Loading

0 comments on commit b2b8ae4

Please sign in to comment.