home.gno

5.41 Kb · 201 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 4](https://test4.gno.land/)
 77- [Faucet Hub](https://faucet.gno.land)
 78
 79## [Latest Blogposts](/r/gnoland/blog)
 80
 81:latest-blogposts:
 82
 83## [Latest Events](/r/gnoland/events)
 84
 85:upcoming-events:
 86
 87## [Hall of Fame](/r/leon/hof)
 88
 89:latest-hof:
 90
 91---
 92
 93## [Gno Playground](https://play.gno.land)
 94
 95
 96Gno Playground is a web application designed for building, running, testing, and
 97interacting with your Gno code, enhancing your understanding of the Gno
 98language. With Gno Playground, you can share your code, execute tests, deploy
 99your realms and packages to gno.land, and explore a multitude of other features.
100
101Experience the convenience of code sharing and rapid experimentation with
102[Gno Playground](https://play.gno.land).
103
104## Explore New Packages and Realms
105
106### [r/gnoland](https://github.com/gnolang/gno/tree/master/examples/gno.land/r/gnoland)
107
108- [r/gnoland/blog](/r/gnoland/blog)
109- [r/gnoland/blog](/r/gnoland/users)
110- [r/gnoland/home](/r/gnoland/home)
111- [r/gnoland/pages](/r/gnoland/pages)
112
113### [r/sys](https://github.com/gnolang/gno/tree/master/examples/gno.land/r/sys)
114
115- [r/sys/names](/r/sys/names)
116- [r/sys/users](/r/sys/users)
117- [r/sys/rewards](/r/sys/rewards)
118- [/r/sys/validators/v2](/r/sys/validators/v2)
119
120### [r/demo](https://github.com/gnolang/gno/tree/master/examples/gno.land/r/demo)
121
122- [r/demo/boards](r/demo/boards)
123- [r/demo/banktest](r/demo/banktest)
124- [r/demo/foo20](r/demo/foo20)
125- [r/demo/foo721](r/demo/foo721)
126- [r/demo/microblog](r/demo/microblog)
127- [r/demo/nft](r/demo/nft)
128- [r/demo/types](r/demo/types)
129- [r/demo/art/gnoface](r/demo/art/gnoface)
130- [r/demo/art/millipede](r/demo/art/millipede)
131- [r/demo/groups](r/demo/groups)
132- ...
133
134### [p/demo](https://github.com/gnolang/gno/tree/master/examples/gno.land/p/demo)
135
136- [p/demo/avl](p/demo/avl)
137- [p/demo/blog](p/demo/blog)
138- [p/demo/ui](p/demo/ui)
139- [p/demo/ufmt](p/demo/ufmt)
140- [p/demo/merkle](p/demo/merkle)
141- [p/demo/bf](p/demo/bf)
142- [p/demo/flow](p/demo/flow)
143- [p/demo/gnode](p/demo/gnode)
144- [p/demo/grc/grc20](p/demo/grc/grc20)
145- [p/demo/grc/grc721](p/demo/grc/grc721)
146- ...
147
148---
149
150## Socials
151
152- Check out our [community projects](https://github.com/gnolang/awesome-gno)
153- [Discord](https://discord.gg/S8nKUqwkPn)
154- [Twitter](https://twitter.com/_gnoland)
155- [Youtube](https://www.youtube.com/@_gnoland)
156- [Telegram](https://t.me/gnoland)
157
158## Quote of the ~Day~ Block#:chain-height:
159
160> :qotb:
161
162---
163
164**This is a testnet.**
165Package names are not guaranteed to be available for production.
166`
167
168	if override != "" {
169		template = override
170	}
171	result := r.Replace(template)
172	return result
173}
174
175func latestHOFItems(num int) ui.Element {
176	submissions := hof.RenderExhibWidget(num)
177
178	return ui.Element{
179		ui.H2("[Hall of Fame](/r/leon/hof)"),
180		ui.Text(submissions),
181	}
182}
183
184func quoteOfTheBlock() string {
185	quotes := []string{
186		"Gno is for Truth.",
187		"Gno is for Social Coordination.",
188		"Gno is _not only_ for DeFi.",
189		"Now, you Gno.",
190		"Come for the Go, Stay for the Gno.",
191	}
192	height := std.ChainHeight()
193	idx := int(height) % len(quotes)
194	qotb := quotes[idx]
195	return qotb
196}
197
198func AdminSetOverride(content string) {
199	Admin.AssertCallerIsOwner()
200	override = content
201}