Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

fisharr.gno

0.41 Kb · 29 lines
 1package fisharr
 2
 3const capFish = 128
 4
 5type fish struct {
 6	owner address
 7	name  string
 8	bite  int
 9	on    bool
10}
11
12var (
13	minted int
14	roster [capFish + 1]fish
15)
16
17func Version() string { return "arr-1" }
18
19func Plant(caller address) int {
20	if minted >= capFish {
21		panic("full")
22	}
23	minted++
24	roster[minted].owner = caller
25	roster[minted].name = "Bubble"
26	roster[minted].bite = 24
27	roster[minted].on = true
28	return minted
29}