diff --git a/.benchmarks/README.md b/.benchmarks/README.md index eb062141cc7..75cf1018025 100644 --- a/.benchmarks/README.md +++ b/.benchmarks/README.md @@ -19,7 +19,7 @@ Things to take into account: - All benchmarks on a package will be shown on the same graph. - The value on `package` and `benchmarks` are regular expressions. - You have to explicitly add your new package here to make it appears on generated graphs. -- If you have benchmarks on the same package that takes much more time pero op than the rest, you should divide it into a separate graph for visibility. In this example we can see how we separated tests from the gnolang package into the ones finishing with `Equality` and `LoopyMain`, because `LoopyMain` is taking an order of magnitude more time per operation than the other tests: +- If you have benchmarks on the same package that takes much more time per op than the rest, you should divide it into a separate graph for visibility. In this example we can see how we separated tests from the gnolang package into the ones finishing with `Equality` and `LoopyMain`, because `LoopyMain` is taking an order of magnitude more time per operation than the other tests: ```yaml - name: Equality benchmarks (gnovm) benchmarks: [ '.Equality' ] @@ -31,4 +31,4 @@ Things to take into account: ## Add new checks for PRs -If we want to add a new package to check all the fast benchmarks on it on every PR, we should have a look into [gobenchdata-checks.yml](./gobenchdata-checks.yml). \ No newline at end of file +If we want to add a new package to check all the fast benchmarks on it on every PR, we should have a look into [gobenchdata-checks.yml](./gobenchdata-checks.yml). diff --git a/docs/assets/how-to-guides/creating-grc721/mynonfungibletoken-1.gno b/docs/assets/how-to-guides/creating-grc721/mynonfungibletoken-1.gno deleted file mode 100644 index ff567f47a9c..00000000000 --- a/docs/assets/how-to-guides/creating-grc721/mynonfungibletoken-1.gno +++ /dev/null @@ -1,104 +0,0 @@ -package mynft - -import ( - "github.com/gnolang/gno/examples/gno.land/p/demo/grc/grc721" - "std" - //"gno.land/p/demo/grc/grc721" -) - -var ( - mynft *grc721.IGRC721 - admin std.Address -) - -// init is called once at time of deployment -func init() { - // Set deployer of Realm to admin - admin = std.PrevRealm().Addr() - - // Set token name, symbol and number of decimals - mynft = grc721.NewBasicNFT("My NFT", "MNFT") -} - -func BalanceOf(owner std.Address) uint64 { - balance, err := mynft.BalanceOf(owner) - if err != nil { - panic(err) - } - - return balance -} - -func OwnerOf(tid grc721.TokenID) std.Address { - owner, err := mynft.OwnerOf(tid) - if err != nil { - panic(err) - } - - return owner -} - -func IsApprovedForAll(owner, operator std.Address) bool { - return mynft.IsApprovedForAll(owner, operator) -} - -func GetApproved(tid grc721.TokenID) std.Address { - addr, err := mynft.GetApproved(tid) - if err != nil { - panic(err) - } - - return addr -} - -func Approve(to std.Address, tid grc721.TokenID) { - err := mynft.Approve(to, tid) - if err != nil { - panic(err) - } -} - -func SetApprovalForAll(operator std.Address, approved bool) { - err := mynft.SetApprovalForAll(operator, approved) - if err != nil { - panic(err) - } -} - -func TransferFrom(from, to std.Address, tid grc721.TokenID) { - err := mynft.TransferFrom(from, to, tid) - if err != nil { - panic(err) - } -} - -func Mint(to std.Address, tid grc721.TokenID) { - assertIsAdmin(std.PrevRealm().Addr()) - err := mynft.Mint(to, tid) - if err != nil { - panic(err) - } -} - -func Burn(tid grc721.TokenID) { - assertIsAdmin(std.PrevRealm().Addr()) - err := mynft.Burn(tid) - if err != nil { - panic(err) - } -} - -func Render(path string) string { - switch { - case path == "": - return mynft.RenderHome() - default: - return "404\n" - } -} - -func assertIsAdmin(address std.Address) { - if address != admin { - panic("restricted access") - } -} diff --git a/docs/assets/how-to-guides/creating-grc721/mynonfungibletoken-2.gno b/docs/assets/how-to-guides/creating-grc721/mynonfungibletoken-2.gno deleted file mode 100644 index 8092596ae0a..00000000000 --- a/docs/assets/how-to-guides/creating-grc721/mynonfungibletoken-2.gno +++ /dev/null @@ -1,102 +0,0 @@ -func mintNNFT(owner std.Address, n uint64) { - count := my.TokenCount() - for i := count; i < count+n; i++ { - tid := grc721.TokenID(ufmt.Sprintf("%d", i)) - mynonfungibletoken.Mint(owner, tid) - } -} - -// 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") - } -} diff --git a/docs/concepts/effective-gno.md b/docs/concepts/effective-gno.md index 1152146ce51..d08a9089487 100644 --- a/docs/concepts/effective-gno.md +++ b/docs/concepts/effective-gno.md @@ -723,7 +723,7 @@ See also: https://github.com/gnolang/gno/tree/master/examples/gno.land/r/demo/wu