Search Apps Documentation Source Content File Folder Download Copy Actions Download

home.gno

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