home.gno

5.45 Kb · 202 lines
  1package home
  2
  3import (
  4	"std"
  5	"strconv"
  6
  7	"gno.land/p/demo/ownable"
  8	"gno.land/p/demo/ui"
  9	"gno.land/p/moul/dynreplacer"
 10	blog "gno.land/r/gnoland/blog"
 11	"gno.land/r/gnoland/events"
 12	"gno.land/r/leon/hof"
 13)
 14
 15var (
 16	override string
 17	Admin    = ownable.NewWithAddress("g1manfred47kzduec920z88wfr64ylksmdcedlf5") // @moul
 18)
 19
 20func Render(_ string) string {
 21	r := dynreplacer.New()
 22	r.RegisterCallback(":latest-blogposts:", func() string {
 23		return blog.RenderLastPostsWidget(4)
 24	})
 25	r.RegisterCallback(":upcoming-events:", func() string {
 26		out, _ := events.RenderEventWidget(events.MaxWidgetSize)
 27		return out
 28	})
 29	r.RegisterCallback(":latest-hof:", func() string {
 30		return hof.RenderExhibWidget(5)
 31	})
 32	r.RegisterCallback(":qotb:", quoteOfTheBlock)
 33	r.RegisterCallback(":chain-height:", func() string {
 34		return strconv.Itoa(int(std.ChainHeight()))
 35	})
 36
 37	template := `# Welcome to gno.land
 38
 39We’re building gno.land, set to become the leading open-source smart contract
 40platform, using Gno, an interpreted and fully deterministic variation of the
 41Go programming language for succinct and composable smart contracts.
 42
 43With transparent and timeless code, gno.land is the next generation of smart
 44contract platforms, serving as the “GitHub” of the ecosystem, with realms built
 45using fully transparent, auditable code that anyone can inspect and reuse.
 46
 47Intuitive and easy to use, gno.land lowers the barrier to web3 and makes
 48censorship-resistant platforms accessible to everyone. If you want to help lay
 49the foundations of a fairer and freer world, join us today. 
 50
 51## Learn about gno.land
 52
 53- [About](/about)
 54- [GitHub](https://github.com/gnolang)
 55- [Blog](/blog)
 56- [Events](/events)
 57- Tokenomics (soon)
 58- [Partners, Fund, Grants](/partners)
 59- [Explore the Ecosystem](/ecosystem)
 60- [Careers](https://jobs.ashbyhq.com/allinbits)
 61
 62## Build with Gno
 63
 64- [Write Gno in the browser](https://play.gno.land)
 65- [Read about the Gno Language](/gnolang)
 66- [Visit the official documentation](https://docs.gno.land)
 67- [Gno by Example](https://gno-by-example.com/)
 68- [Efficient local development for Gno](https://docs.gno.land/gno-tooling/cli/gno-tooling-gnodev)
 69- [Get testnet GNOTs](https://faucet.gno.land)
 70
 71## Explore the universe
 72
 73- [Discover demo packages](https://github.com/gnolang/gno/tree/master/examples)
 74- [Gnoscan](https://gnoscan.io)
 75- [Portal Loop](https://docs.gno.land/concepts/portal-loop)
 76- Testnet 6 (upcoming)
 77- [Testnet 5](https://test5.gno.land/)
 78- [Faucet Hub](https://faucet.gno.land)
 79
 80## [Latest Blogposts](/r/gnoland/blog)
 81
 82:latest-blogposts:
 83
 84## [Latest Events](/r/gnoland/events)
 85
 86:upcoming-events:
 87
 88## [Hall of Fame](/r/leon/hof)
 89
 90:latest-hof:
 91
 92---
 93
 94## [Gno Playground](https://play.gno.land)
 95
 96
 97Gno Playground is a web application designed for building, running, testing, and
 98interacting with your Gno code, enhancing your understanding of the Gno
 99language. With Gno Playground, you can share your code, execute tests, deploy
100your realms and packages to gno.land, and explore a multitude of other features.
101
102Experience the convenience of code sharing and rapid experimentation with
103[Gno Playground](https://play.gno.land).
104
105## Explore New Packages and Realms
106
107### [r/gnoland](https://github.com/gnolang/gno/tree/master/examples/gno.land/r/gnoland)
108
109- [r/gnoland/blog](/r/gnoland/blog)
110- [r/gnoland/users](/r/gnoland/users)
111- [r/gnoland/home](/r/gnoland/home)
112- [r/gnoland/pages](/r/gnoland/pages)
113
114### [r/sys](https://github.com/gnolang/gno/tree/master/examples/gno.land/r/sys)
115
116- [r/sys/names](/r/sys/names)
117- [r/sys/users](/r/sys/users)
118- [r/sys/rewards](/r/sys/rewards)
119- [/r/sys/validators/v2](/r/sys/validators/v2)
120
121### [r/demo](https://github.com/gnolang/gno/tree/master/examples/gno.land/r/demo)
122
123- [r/demo/boards](/r/demo/boards)
124- [r/demo/banktest](/r/demo/banktest)
125- [r/demo/foo20](/r/demo/foo20)
126- [r/demo/foo721](/r/demo/foo721)
127- [r/demo/microblog](/r/demo/microblog)
128- [r/demo/nft](/r/demo/nft)
129- [r/demo/types](/r/demo/types)
130- [r/demo/art/gnoface](/r/demo/art/gnoface)
131- [r/demo/art/millipede](/r/demo/art/millipede)
132- [r/demo/groups](/r/demo/groups)
133- ...
134
135### [p/demo](https://github.com/gnolang/gno/tree/master/examples/gno.land/p/demo)
136
137- [p/demo/avl](/p/demo/avl)
138- [p/demo/blog](/p/demo/blog)
139- [p/demo/ui](/p/demo/ui)
140- [p/demo/ufmt](/p/demo/ufmt)
141- [p/demo/merkle](/p/demo/merkle)
142- [p/demo/bf](/p/demo/bf)
143- [p/demo/flow](/p/demo/flow)
144- [p/demo/gnode](/p/demo/gnode)
145- [p/demo/grc/grc20](/p/demo/grc/grc20)
146- [p/demo/grc/grc721](/p/demo/grc/grc721)
147- ...
148
149---
150
151## Socials
152
153- Check out our [community projects](https://github.com/gnolang/awesome-gno)
154- [Discord](https://discord.gg/S8nKUqwkPn)
155- [Twitter](https://twitter.com/_gnoland)
156- [Youtube](https://www.youtube.com/@_gnoland)
157- [Telegram](https://t.me/gnoland)
158
159## Quote of the ~Day~ Block#:chain-height:
160
161> :qotb:
162
163---
164
165**This is a testnet.**
166Package names are not guaranteed to be available for production.
167`
168
169	if override != "" {
170		template = override
171	}
172	result := r.Replace(template)
173	return result
174}
175
176func latestHOFItems(num int) ui.Element {
177	submissions := hof.RenderExhibWidget(num)
178
179	return ui.Element{
180		ui.H2("[Hall of Fame](/r/leon/hof)"),
181		ui.Text(submissions),
182	}
183}
184
185func quoteOfTheBlock() string {
186	quotes := []string{
187		"Gno is for Truth.",
188		"Gno is for Social Coordination.",
189		"Gno is _not only_ for DeFi.",
190		"Now, you Gno.",
191		"Come for the Go, Stay for the Gno.",
192	}
193	height := std.ChainHeight()
194	idx := int(height) % len(quotes)
195	qotb := quotes[idx]
196	return qotb
197}
198
199func AdminSetOverride(content string) {
200	Admin.AssertCallerIsOwner()
201	override = content
202}