Search Apps Documentation Source Content File Folder Download Copy Actions Download

home.gno

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