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

v0 state

Back to all declarations

pet

type

pet is the persisted record for one owner's tamagotchi.

Value

v0.pet

pets

v0.Tree

// owner address string -> \*pet

Open
OID
0c6c91…7cf4:4
pets details

Inspect ref

clamp

func(v int, lo int, hi int) int
Open
OID
0c6c91…7cf4:5
clamp details

Inspect func

get

func(owner .uverse.address) (*v0.pet, bool)
Open
OID
0c6c91…7cf4:7
get details

Inspect func

project

func(p *v0.pet, height int64) (hunger int, happiness int, energy int, alive bool)

project computes display stats as of height without mutating the pet, so Render can show a live-looking view without writing state on a query.

Open
OID
0c6c91…7cf4:8
project details

Inspect func

ageStageName

func(born int64, height int64) string
Open
OID
0c6c91…7cf4:9
ageStageName details

Inspect func

requireLivingPet

func(owner .uverse.address, height int64) *v0.pet

requireLivingPet ticks and fetches the caller's pet, panicking with a friendly message if there is none or it has died.

Open
OID
0c6c91…7cf4:10
requireLivingPet details

Inspect func

hatch

func(owner .uverse.address, name string, height int64) string

hatch is the non-crossing core of Hatch, kept separate so unit tests can exercise its panics directly without going through a realm-crossing call.

Open
OID
0c6c91…7cf4:11
hatch details

Inspect func

Hatch

func(name string) string

Hatch creates a new pet for the caller. Lifetime feeds/plays/deaths carry over from any previous pet so the leaderboard tracks long-term care.

Open
OID
0c6c91…7cf4:12
Hatch details

Inspect func

feed

func(owner .uverse.address, height int64) string

feed is the non-crossing core of Feed.

Open
OID
0c6c91…7cf4:13
feed details

Inspect func

Feed

func() string

Feed reduces hunger and gives a small energy boost.

Open
OID
0c6c91…7cf4:14
Feed details

Inspect func

play

func(owner .uverse.address, height int64) string

play is the non-crossing core of Play.

Open
OID
0c6c91…7cf4:15
play details

Inspect func

Play

func() string

Play boosts happiness at the cost of energy and a bit of hunger. Refuses to run a tired pet into the ground — rest first.

Open
OID
0c6c91…7cf4:16
Play details

Inspect func

sleep

func(owner .uverse.address, height int64) string

sleep is the non-crossing core of Sleep.

Open
OID
0c6c91…7cf4:17
sleep details

Inspect func

Sleep

func() string

Sleep restores energy at the cost of a little hunger.

Open
OID
0c6c91…7cf4:18
Sleep details

Inspect func

byAliveThenOwner

type

byAliveThenOwner ranks living pets before dead ones, then orders each group by owner address so the leaderboard is fully deterministic.

Value

v0.byAliveThenOwner

shortAddr

func(a .uverse.address) string
Open
OID
0c6c91…7cf4:20
shortAddr details

Inspect func

renderCard

func(p *v0.pet, height int64) string
Open
OID
0c6c91…7cf4:21
renderCard details

Inspect func

Render

func(path string) string

Render shows either every pet ever hatched (path == "") or a single pet's detail card when path is a bech32 owner address.

Open
OID
0c6c91…7cf4:22
Render details

Inspect func
pet : type =v0.pet
pets : v0.Tree Inspect
clamp : func(v int, lo int, hi int) int Inspect
get : func(owner .uverse.address) (*v0.pet, bool) Inspect
project : func(p *v0.pet, height int64) (hunger int, happiness int, energy int, alive bool) Inspect
ageStageName : func(born int64, height int64) string Inspect
requireLivingPet : func(owner .uverse.address, height int64) *v0.pet Inspect
hatch : func(owner .uverse.address, name string, height int64) string Inspect
Hatch : func(name string) string Inspect
feed : func(owner .uverse.address, height int64) string Inspect
Feed : func() string Inspect
play : func(owner .uverse.address, height int64) string Inspect
Play : func() string Inspect
sleep : func(owner .uverse.address, height int64) string Inspect
Sleep : func() string Inspect
byAliveThenOwner : type =v0.byAliveThenOwner
bar : func(v int) string Inspect
shortAddr : func(a .uverse.address) string Inspect
renderCard : func(p *v0.pet, height int64) string Inspect
Render : func(path string) string Inspect