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