PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/r/moul/x/daily/lottery/v0

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
v0
Namespace
moul / x / daily / lottery
Files
3 (README)(gnomod.toml)
Exported functions
6
Module
gno.land/r/moul/x/daily/lottery/v0
gno
0.9

Files (3)

  • README.mdmarkdown
  • gnomod.tomltoml
  • lottery.gnogno
README.mdPreviewRaw
# Lottery

> ⚠️ **Experimental — generated with no human supervision** by the daily MCP pipeline (Solidity→Gno port). Not audited. See [r/moul/x/daily](https://github.com/moul/gno-contracts/blob/main/r/moul/x/daily/README.md).

---


An idiomatic gno.land port of the classic Solidity **Lottery** contract.

Players `Enter` the current round (one entry per address per round — a second
entry panics). Once a round has at least two entrants, anyone may `DrawWinner`,
which picks a winner deterministically from the block height
(`ChainHeight() % len(entrants)` over the deterministically-sorted entrant set),
records it in the winners history, and opens a fresh round. Solidity's
`block.number`-based pseudo-randomness maps to `runtime.ChainHeight()`, and
`msg.sender` maps to `unsafe.PreviousRealm().Address()`. `Render` shows the open
round, its entrants, and the table of past winners.

## Example calls

```
# Two different accounts join round 1
gnokey maketx call -pkgpath gno.land/r/moul/x/daily/lottery/v0 -func Enter ...   # from alice
gnokey maketx call -pkgpath gno.land/r/moul/x/daily/lottery/v0 -func Enter ...   # from bob

# Anyone draws the winner and opens round 2
gnokey maketx call -pkgpath gno.land/r/moul/x/daily/lottery/v0 -func DrawWinner ...
```

Read-only helpers: `CurrentRound()`, `NumEntrants()`, `HasEntered(addr)`.

<!-- BEGIN GNOCONTRACTS FOOTER (generated by `make readmes`; do not edit below) -->

---

Part of **[moul/gno-contracts](https://github.com/moul/gno-contracts)** — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

**Dependency graph:**

![gno.land/r/moul/x/daily/lottery/v0 dependency graph](https://raw.githubusercontent.com/moul/gno-contracts/main/_assets/gno.land/r/moul/x/daily/lottery/v0/deps.png)

> 🧪 **Highly experimental — potentially vibe-coded.** Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: [DISCLAIMER](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md).

<!-- END GNOCONTRACTS FOOTER -->

Functions

  • CurrentRound() int

  • DrawWinner(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) string

  • Enter(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string})

  • HasEntered(addr string) bool

  • NumEntrants() int

  • Render(path string) string

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

Rendered

RenderedRawgnoweb ↗

vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.