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.

shots state

Back to all declarations

Impl

type

Impl is the rules engine. Declared here so every version agrees on one type identity. The methods are non-crossing: this realm threads its own cur in, so an implementation reaching Store is seen as this realm. The caller's address and the coins received are established by the entry points below and passed in; an implementation cannot be invoked with forged ones from elsewhere, because without this realm's live cur it cannot reach the state at all.

Value

shots.Impl

Denom

untyped string

Denom is the coin pots are held in.

Value

"ugnot"

Admin

.uverse.address

Admin may accept, roll back or freeze an implementation. The value is the standard test1 account so the tests run unedited; set your own address before deploying (TransferAuthority moves it afterwards).

Value

<gnolang.StringValue>

selfPath

string

Value

"gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/shots"

CreateGame

func(entryFee int64, timeoutBlocks int64, config string) uint64

CreateGame opens a game. Send the initial pot with the call (ugnot). config overrides the default constants as "key=value,..." ("" for the defaults; see penalty.ParseConfig). timeoutBlocks 0 picks the default. Returns the game id.

Open
OID
01d009…d184:7
CreateGame details

Inspect func

JoinGame

func(gameID uint64)

JoinGame starts a shootout in an open game. Send exactly its entry fee.

Open
OID
01d009…d184:8
JoinGame details

Inspect func

TopUp

func(gameID uint64)

TopUp adds the coins sent to a game's pot.

Open
OID
01d009…d184:9
TopUp details

Inspect func

TakeShot

func(gameID uint64, aimX int64, aimY int64, contactX int64, contactY int64, power int64) string

TakeShot plays the player's kick for the current round against the chain's keeper: aim point on the goal plane (mm), contact offset on the ball (milli-radii) and power (per-mille). Returns the kick as JSON.

Open
OID
01d009…d184:10
TakeShot details

Inspect func

SubmitKeeperPlan

func(gameID uint64, direction uint16, speed uint16, jump uint16, reaction uint16) string

SubmitKeeperPlan plays the player's keeper plan against the chain's kick for the current round: four uint16 (see penalty.DecodePlan). Returns the kick as JSON.

Open
OID
01d009…d184:11
SubmitKeeperPlan details

Inspect func

Forfeit

func(gameID uint64)

Forfeit ends the current shootout as a loss: the player may resign at any time, anyone else once the player has been idle for the game's timeout.

Open
OID
01d009…d184:12
Forfeit details

Inspect func

CancelGame

func(gameID uint64)

CancelGame refunds the pot to the creator of a game nobody has played yet.

Open
OID
01d009…d184:13
CancelGame details

Inspect func

SimulateShot

func(aimX int64, aimY int64, contactX int64, contactY int64, power int64, mishitHex string, direction uint16, speed uint16, jump uint16, reaction uint16, config string) string

SimulateShot runs the live outcome function on ten inputs, without touching any state: the taker's aim, contact, power and 48-hex-char mishit seed, and the keeper's four uint16, under config ("" for the defaults). Returns JSON.

Open
OID
01d009…d184:14
SimulateShot details

Inspect func

GameJSON

func(gameID uint64) string

GameJSON returns game id as JSON ("" if it does not exist).

Open
OID
01d009…d184:15
GameJSON details

Inspect func

SessionJSON

func(gameID uint64, no int) string

SessionJSON returns session no of a game, kicks included, as JSON.

Open
OID
01d009…d184:16
SessionJSON details

Inspect func

ListGames

func(status string, offset int, limit int) string

ListGames returns up to limit games as a JSON array, newest first, optionally filtered by status ("open", "playing", "won", "cancelled"; "" for all).

Open
OID
01d009…d184:17
ListGames details

Inspect func

VerifySession

func(gameID uint64, no int) bool

VerifySession re-runs every recorded kick of a shootout through the live outcome function and reports whether all of them reproduce, so anyone can check a result from the ten recorded inputs alone.

Open
OID
01d009…d184:18
VerifySession details

Inspect func

GameCount

func() uint64

GameCount returns how many games have been created.

Open
OID
01d009…d184:19
GameCount details

Inspect func

receivePayment

func(int, rlm .uverse.realm) int64

receivePayment returns the ugnot sent with a direct user call. The coin envelope is credited to this realm only when this realm is the message's target, so a payment from any other call shape is refused rather than trusted.

Open
OID
01d009…d184:20
receivePayment details

Inspect func

assertFreeDirectCall

func(int, rlm .uverse.realm)

assertFreeDirectCall requires a direct user call that sends no coins.

Open
OID
01d009…d184:21
assertFreeDirectCall details

Inspect func

assertDirect

func(int, rlm .uverse.realm)
Open
OID
01d009…d184:22
assertDirect details

Inspect func

Register

func(impl shots.Impl)

Register records the calling realm as a candidate implementation; an implementation calls it from its own init. Nothing serves until Accept.

Open
OID
01d009…d184:23
Register details

Inspect func

Accept

func(pkgPath string)

Accept makes the candidate at pkgPath live. Authority only.

Open
OID
01d009…d184:24
Accept details

Inspect func

Withdraw

func(pkgPath string)

Withdraw drops a candidate. Authority only, or the candidate itself.

Open
OID
01d009…d184:25
Withdraw details

Inspect func

Rollback

func()

Rollback restores the previous implementation. Authority only.

Open
OID
01d009…d184:26
Rollback details

Inspect func

Forget

func()

Forget drops the rollback history. Authority only.

Open
OID
01d009…d184:27
Forget details

Inspect func

Freeze

func()

Freeze ends upgradeability permanently. Authority only.

Open
OID
01d009…d184:28
Freeze details

Inspect func

AddExtension

func(pkgPath string)

AddExtension lets another realm act as this one. Authority only.

Open
OID
01d009…d184:29
AddExtension details

Inspect func

DropExtension

func(pkgPath string)

DropExtension revokes one. Authority only.

Open
OID
01d009…d184:30
DropExtension details

Inspect func

TransferAuthority

func(newOwner .uverse.address)

TransferAuthority hands the power to upgrade to another address.

Open
OID
01d009…d184:31
TransferAuthority details

Inspect func

TransferAuthorityToRealms

func(csvPaths string)

TransferAuthorityToRealms hands it to governance realms (comma-separated).

Open
OID
01d009…d184:32
TransferAuthorityToRealms details

Inspect func

PendingPaths

func() []string
Open
OID
01d009…d184:37
PendingPaths details

Inspect func

HistoryPaths

func() []string
Open
OID
01d009…d184:38
HistoryPaths details

Inspect func

games

*v0.Tree

// gameKey(id) -> \*shootout.Game

Open
OID
01d009…d184:42
games details

Inspect pointer

sessions

*v0.Tree

// sessionKey(id, no) -> \*shootout.Session

Open
OID
01d009…d184:45
sessions details

Inspect pointer

lastID

uint64

Value

9

sessionKey

func(id uint64, no int) string
Open
OID
01d009…d184:50
sessionKey details

Inspect func

getGame

func(id uint64) (v0.Game, bool)
Open
OID
01d009…d184:51
getGame details

Inspect func

getSession

func(id uint64, no int) (v0.Session, bool)
Open
OID
01d009…d184:52
getSession details

Inspect func

StateRef

type

StateRef is a permission to read and write the game state, handed to code running on this realm's cur. It carries the caller's realm value and re-checks it on every operation, so it cannot be stashed (the VM refuses to persist a realm value) or replayed after its frame returns.

Value

shots.StateRef

Store

func(int, rlm .uverse.realm) *shots.StateRef

Store hands a StateRef to the live implementation, or to a registered extension. Any other realm presents its own cur and is refused.

Open
OID
01d009…d184:53
Store details

Inspect func

assertStateAccess

func(int, rlm .uverse.realm)

assertStateAccess panics unless rlm is a live cur belonging to this realm or to a registered extension.

Open
OID
01d009…d184:54
assertStateAccess details

Inspect func

resultJSON

func(r v0.Result) string
Open
OID
01d009…d184:60
resultJSON details

Inspect func

shotJSON

func(s v0.ShotInput) string
Open
OID
01d009…d184:61
shotJSON details

Inspect func

planJSON

func(p v0.KeeperPlan) string
Open
OID
01d009…d184:62
planJSON details

Inspect func

sessionJSON

func(s v0.Session) string
Open
OID
01d009…d184:64
sessionJSON details

Inspect func

Render

func(path string) string

Render shows the games list, one game ("game/\<id>") or one shootout ("game/\<id>/\<session>").

Open
OID
01d009…d184:65
Render details

Inspect func

renderGame

func(id uint64) string
Open
OID
01d009…d184:68
renderGame details

Inspect func

renderSession

func(id uint64, no int) string
Open
OID
01d009…d184:70
renderSession details

Inspect func
Impl : type =shots.Impl
Denom : untyped string ="ugnot"
Admin : .uverse.address =<gnolang.StringValue>
proxy : *v0.Proxy Inspect
selfPath : string ="gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/shots"
init.5 : func() Inspect
CreateGame : func(entryFee int64, timeoutBlocks int64, config string) uint64 Inspect
JoinGame : func(gameID uint64) Inspect
TopUp : func(gameID uint64) Inspect
TakeShot : func(gameID uint64, aimX int64, aimY int64, contactX int64, contactY int64, power int64) string Inspect
SubmitKeeperPlan : func(gameID uint64, direction uint16, speed uint16, jump uint16, reaction uint16) string Inspect
Forfeit : func(gameID uint64) Inspect
CancelGame : func(gameID uint64) Inspect
SimulateShot : func(aimX int64, aimY int64, contactX int64, contactY int64, power int64, mishitHex string, direction uint16, speed uint16, jump uint16, reaction uint16, config string) string Inspect
GameJSON : func(gameID uint64) string Inspect
SessionJSON : func(gameID uint64, no int) string Inspect
ListGames : func(status string, offset int, limit int) string Inspect
VerifySession : func(gameID uint64, no int) bool Inspect
GameCount : func() uint64 Inspect
receivePayment : func(int, rlm .uverse.realm) int64 Inspect
assertFreeDirectCall : func(int, rlm .uverse.realm) Inspect
assertDirect : func(int, rlm .uverse.realm) Inspect
Register : func(impl shots.Impl) Inspect
Accept : func(pkgPath string) Inspect
Withdraw : func(pkgPath string) Inspect
Rollback : func() Inspect
Forget : func() Inspect
Freeze : func() Inspect
AddExtension : func(pkgPath string) Inspect
DropExtension : func(pkgPath string) Inspect
TransferAuthority : func(newOwner .uverse.address) Inspect
TransferAuthorityToRealms : func(csvPaths string) Inspect
LivePath : func() string Inspect
Frozen : func() bool Inspect
Authority : func() string Inspect
Extensions : func() []string Inspect
PendingPaths : func() []string Inspect
HistoryPaths : func() []string Inspect
live : func() shots.Impl Inspect
itoa : func(n int64) string Inspect
games : *v0.Tree Inspect
sessions : *v0.Tree Inspect
lastID : uint64 =9
gameKey : func(id uint64) string Inspect
sessionKey : func(id uint64, no int) string Inspect
getGame : func(id uint64) (v0.Game, bool) Inspect
getSession : func(id uint64, no int) (v0.Session, bool) Inspect
StateRef : type =shots.StateRef
Store : func(int, rlm .uverse.realm) *shots.StateRef Inspect
assertStateAccess : func(int, rlm .uverse.realm) Inspect
q : func(s string) string Inspect
kv : func(k string, v string) string Inspect
obj : func(fields []string) string Inspect
gameJSON : func(g v0.Game) string Inspect
resultJSON : func(r v0.Result) string Inspect
shotJSON : func(s v0.ShotInput) string Inspect
planJSON : func(p v0.KeeperPlan) string Inspect
kickJSON : func(k v0.Kick) string Inspect
sessionJSON : func(s v0.Session) string Inspect
Render : func(path string) string Inspect
ugnot : func(n int64) string Inspect
renderHome : func() string Inspect
renderGame : func(id uint64) string Inspect
score : func(s v0.Shootout) string Inspect
renderSession : func(id uint64, no int) string Inspect