home.gno

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