-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b3e215
commit d7352ea
Showing
24 changed files
with
225 additions
and
79 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1dnllrdzwfhxv3evyk09y48mgn5phfjvtyrlzm7","send":"","pkg_path":"gno.land/r/test10/poll","func":"Vote","args":["red"]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"AsGEi/6/N0zRtRCWxHb7KZ1Z/BTfZIc77fvtkSRJlmwQ"},"signature":"kb+OZXXyCkLnYqGqIT08CVj+IC3Pplyc/UIih5feUO5hSPkSfVpGx5E/jBs7e3q/rtlV91Z6V3q4A3dY3F7fng=="}],"memo":"Called through gno.studio"},"blockNum":"316862"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1dnllrdzwfhxv3evyk09y48mgn5phfjvtyrlzm7","send":"","pkg_path":"gno.land/r/test10/poll","func":"Render","args":["hi"]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"AsGEi/6/N0zRtRCWxHb7KZ1Z/BTfZIc77fvtkSRJlmwQ"},"signature":"660mK8Hz3MoCEYHbIDhSS+/Ui0ajjLJYh05h/yI5mAU2kCj7jTJC6f/IPJVBszGdz+35/AxY+qBRI3SpR45I/w=="}],"memo":"Called through gno.studio"},"blockNum":"316865"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1dnllrdzwfhxv3evyk09y48mgn5phfjvtyrlzm7","send":"","pkg_path":"gno.land/r/test10/poll","func":"Vote","args":["blue"]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"AsGEi/6/N0zRtRCWxHb7KZ1Z/BTfZIc77fvtkSRJlmwQ"},"signature":"Toz3y3m5EIOrog5rH0cXFZM/pXon6s2hu2s/50ALwOMp8Y3kkgor10LkdeyA9FQWsVzFzAgYKpFiyT1xqYW0kA=="}],"memo":"Called through gno.studio"},"blockNum":"316867"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1dnllrdzwfhxv3evyk09y48mgn5phfjvtyrlzm7","send":"","pkg_path":"gno.land/r/test10/poll","func":"Vote","args":["blue"]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"AsGEi/6/N0zRtRCWxHb7KZ1Z/BTfZIc77fvtkSRJlmwQ"},"signature":"69Tm+0AuDXVJ7Ji56YpQ9WmKtR/lbxgqpMwuLNKfizRZfjheWMOxEsjIXmIhy4w01iAbn52vJsZWVBZDDf97nw=="}],"memo":"Called through gno.studio"},"blockNum":"316869"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g14vhcdsyf83ngsrrqc92kmw8q9xakqjm0v8448t","send":"","pkg_path":"gno.land/r/demo/minter","func":"Mint","args":["g1v83slepf0mdks4x97dpwpf70scmsts5d6qa2nf","ugnot","310000000"]}],"fee":{"gas_wanted":"1000000","gas_fee":"1ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"AgiTyNXOXskkkxKv2DXaDxFtabuTPHlltbYwCOBpHL3w"},"signature":"4PjgMk6zoyMbHcCY/M20GOeqpku4wj+Pf8coLRrF8RVmh0my4mAv9Q5PPB550fBwbLcgz20CsspeJRB0WNlaHw=="}],"memo":""},"blockNum":"316897"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1dnllrdzwfhxv3evyk09y48mgn5phfjvtyrlzm7","send":"","pkg_path":"gno.land/r/test10/poll","func":"Vote","args":["red"]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"AsGEi/6/N0zRtRCWxHb7KZ1Z/BTfZIc77fvtkSRJlmwQ"},"signature":"mQA6AGWKjxt8ELx5ky9kMAXXYrwty7JkVMgANKODqqoBR7LFlT09vnsZB3DR8ww3Wydg8yU/PLXk8MPFGkGviQ=="}],"memo":"Called through gno.studio"},"blockNum":"317036"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1dnllrdzwfhxv3evyk09y48mgn5phfjvtyrlzm7","send":"","pkg_path":"gno.land/r/test10/poll","func":"Vote","args":["red"]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"AsGEi/6/N0zRtRCWxHb7KZ1Z/BTfZIc77fvtkSRJlmwQ"},"signature":"VA9zAd749BPWC+CysyUOG6y44LWIvCeetuZwLeQtA+ddUCw9MHLaVPOPAco35fALIeH63Dr/oPSoEZAfDqUDOw=="}],"memo":"Called through gno.studio"},"blockNum":"317040"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g15wmukt79xymnnu6c4de32trnufudqum60yrxu8","send":"","pkg_path":"gno.land/r/test10/poll","func":"Vote","args":["test"]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A6QxDeE9T4utsKFysdC0JZTyVwnc4UgqQ7vhHJf5pp+p"},"signature":"uNn94FRVJTpm6vaAlVwSJYhoincd6tEL4HrRdEzK8R9/fmOmUFnwx80dUxt3mDCuM1akPs/s20yktKjCwyjT8w=="}],"memo":"Called through gno.studio"},"blockNum":"317067"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1fsu3z335h5qngf7t3lmakvpmpwg9ae76tqwh7c","send":"","pkg_path":"gno.land/r/test10/poll","func":"Vote","args":[""]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"ArpuZWPhPhGbXRDOr5vjwl7Ro++55QZaJ7/jUUbkpMHK"},"signature":"N7Dzb5mhjSBGcjxBDUsxpHMzykoh/EzZIPiBdeVDDjJZc0awKhWVTtEtbuIYAoXkmQFc8fwtqbDrd+F1DRCHWA=="}],"memo":"Called through gno.studio"},"blockNum":"317606"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1fsu3z335h5qngf7t3lmakvpmpwg9ae76tqwh7c","send":"","pkg_path":"gno.land/r/test10/poll","func":"Render","args":[""]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"ArpuZWPhPhGbXRDOr5vjwl7Ro++55QZaJ7/jUUbkpMHK"},"signature":"0enBR4mH5gbbc2Ih6/smEm7AOCn4blIRJOpRKehMKT5Pgr6ORy15szjvQg2yMYmshcza+wFnInAnxYPxMgcoVA=="}],"memo":"Called through gno.studio"},"blockNum":"317694"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1dnllrdzwfhxv3evyk09y48mgn5phfjvtyrlzm7","send":"","pkg_path":"gno.land/r/test10/poll","func":"Vote","args":[""]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"AsGEi/6/N0zRtRCWxHb7KZ1Z/BTfZIc77fvtkSRJlmwQ"},"signature":"3HMLPfAVrpJjamUA6ifZJd3zin8oP++helWorMb0LEAu3gGolacQO+Xt3ubzsRByjqTFIKx0R2HdvUzepohVSA=="}],"memo":"Called through gno.studio"},"blockNum":"317719"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1fsu3z335h5qngf7t3lmakvpmpwg9ae76tqwh7c","send":"","pkg_path":"gno.land/r/test10/poll","func":"Render","args":[""]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"ArpuZWPhPhGbXRDOr5vjwl7Ro++55QZaJ7/jUUbkpMHK"},"signature":"ufHshDt8warjILMGw7kc4eJtQIeWaLUlBudB8tYwWodCaLJPyZ1gxQr5w+9CzF8TQtML2+hgQktNM7qzd1gJJw=="}],"memo":"Called through gno.studio"},"blockNum":"317856"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1fsu3z335h5qngf7t3lmakvpmpwg9ae76tqwh7c","send":"","pkg_path":"gno.land/r/test10/poll","func":"Vote","args":[""]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"ArpuZWPhPhGbXRDOr5vjwl7Ro++55QZaJ7/jUUbkpMHK"},"signature":"ML+h9LP5IWHsVO44SjDVO19tdqWVli7j3aGPuW0YzbJwOqKRN41k7BEIQ3xpYCjbZLeahs195NLzQ0A/iUUdDg=="}],"memo":"Called through gno.studio"},"blockNum":"317858"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1fsu3z335h5qngf7t3lmakvpmpwg9ae76tqwh7c","send":"","pkg_path":"gno.land/r/test10/poll","func":"Vote","args":[""]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"ArpuZWPhPhGbXRDOr5vjwl7Ro++55QZaJ7/jUUbkpMHK"},"signature":"K1C2T7/8MDoXlekNXb+U7HZBWeng5dJvYiNNvulx8Mk+Is2StcblE8Jrj6Or7iSEhJM3DLQvybyczhFQD6wKug=="}],"memo":"Called through gno.studio"},"blockNum":"317866"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1fsu3z335h5qngf7t3lmakvpmpwg9ae76tqwh7c","send":"","pkg_path":"gno.land/r/test10/poll","func":"Render","args":[""]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"ArpuZWPhPhGbXRDOr5vjwl7Ro++55QZaJ7/jUUbkpMHK"},"signature":"e+VBDR6DhZoD5cLE/Kqe+87/kuC+TsVGhEMCUOsoqB86ARpK33pu+/d5RFkMUqfTJR+D7r3ScLCn2ixSimEEeg=="}],"memo":"Called through gno.studio"},"blockNum":"317868"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1fsu3z335h5qngf7t3lmakvpmpwg9ae76tqwh7c","send":"","pkg_path":"gno.land/r/boom/boom","func":"Mint","args":["",""]}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"ArpuZWPhPhGbXRDOr5vjwl7Ro++55QZaJ7/jUUbkpMHK"},"signature":"ZA28O19cxprV4pP7F/Bq4lPrf2mBNPTTKrvX7fEfPhk1o6bST61a2nJy/hm0rbeG4UFKb6BUnlIpcE6N4uLBzg=="}],"memo":"Called through gno.studio"},"blockNum":"317873"} | ||
{"tx":{"msg":[{"@type":"/vm.m_call","caller":"g1fsu3z335h5qngf7t3lmakvpmpwg9ae76tqwh7c","send":"","pkg_path":"gno.land/r/boom/boom","func":"TotalSupply","args":null}],"fee":{"gas_wanted":"10000000","gas_fee":"50000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"ArpuZWPhPhGbXRDOr5vjwl7Ro++55QZaJ7/jUUbkpMHK"},"signature":"FOsOUBRA/fs9N0OG5ma82jIPPSbX2oBetd0i7BewTNsAxBJvLlCd3W6yBgfUU9lEfex9M5MUmr19ccRj9rsDsw=="}],"memo":"Called through gno.studio"},"blockNum":"317875"} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,34 @@ | ||
package hello | ||
package foo | ||
|
||
import ( | ||
"std | ||
"strings | ||
|
||
"gno.land/p/demo/grc/grc20 | ||
"gno.land/p/demo/ufmt | ||
"gno.land/r/demo/users" | ||
) | ||
|
||
var ( | ||
foo *grc20.AdminToken | ||
admin std.address = "g1zakcnjtwj0rs9ejtr5c0gqlnus50xny8frar5n" | ||
) | ||
|
||
func init() { | ||
hyperborea = grc20.NewAdminToken("Hyperborea","HYPERBOREA", 6) | ||
hyperborea.Mint(admin,8888888) // @administrator | ||
} | ||
|
||
// method proxies as public functions. | ||
// | ||
|
||
// getters. | ||
|
||
func TotalSupply() uint64 { | ||
return hyperborea.TotalSupply/() | ||
} | ||
|
||
func BalanceOf(owner users.AddressOrName) uint64 { | ||
balance, err := hyperborea.BalanceOf(owner.Resolve()) | ||
|
||
func Render(path string) string { | ||
return "Hello World!" | ||
} |
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
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") | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"creator":"g1ghfakgzr6q77etpg8jtas6llg4uvqnfl8skxxq","deposit":"1ugnot"} | ||
{"creator":"g1dnllrdzwfhxv3evyk09y48mgn5phfjvtyrlzm7","deposit":""} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"creator":"g128ucp2mk3ax9urc2hhx0tr8xqm6g4p8j28x4yf","deposit":""} | ||
{"creator":"g15gsy3nlxxjn0knd3xkucg4f6gf79tfwhg426sw","deposit":""} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"creator":"g15gsy3nlxxjn0knd3xkucg4f6gf79tfwhg426sw","deposit":""} | ||
{"creator":"g1kcwsplxyxz5pruc5hy9whwjxwwh35s4v37yqrr","deposit":""} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"creator":"g1m6cdxuuesrgdu2krq9m5xrrvhx74f56a0w2y3t","deposit":""} | ||
{"creator":"g1j8jwsce3vcry6s8qmmkxuwuhzww0j8396n3rgm","deposit":""} |
Oops, something went wrong.