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/p/g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd/gnofly/arena/payout/v0

Package
Open in gnoweb ↗

Overview

Kind
Pure package
Name
v0
Namespace
g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd / gnofly / arena / payout
Files
6 (gnomod.toml)
Exported functions
n/a — not supported for pure packages by the node (vm/qfuncs)
Module
gno.land/p/g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd/gnofly/arena/payout/v0
gno
0.9

Files (6)

  • gnomod.tomltoml
  • battleroyale.gnogno
  • deathmatch.gnogno
  • doc.gnogno
  • parse.gnogno
  • payout.gnogno
doc.gnogno
1// v0 - Unaudited: This is an initial version that has not yet been formally audited.2// Use in production at your own risk.3//4// Package payout defines how the stakes of a gnofly arena round are shared5// out once the round is over: a Rule turns what happened, who died and by6// whose hand, into who gets what.7//8// The package is pure: it holds no state, moves no coin and knows nothing9// about roles. A realm keeps the stakes, asks a rule for a Result and makes10// the payments itself:11//12//	players, err := payout.ParsePlayers("g1aaa...,g1bbb...,g1ccc...")13//	if err != nil {14//		panic(err)15//	}16//	deaths, err := payout.ParseDeaths("g1bbb...:g1aaa...;g1ccc...:")17//	if err != nil {18//		panic(err)19//	}20//	g := payout.Game{Stake: 10000000, Lives: 3, KillTarget: 0, FeeBps: 500}21//	res, err := payout.Lookup(payout.ModeDeathmatch).Settle(g, players, deaths)22//23// Two rules ship with the package, both stateless values with no field:24//25//   - BattleRoyale: the pot goes to the players still in at the end, or to26//     the last one out;27//   - Deathmatch: the pot goes to the top three by kills, 60%, 30% and 10%.28//29// Every rule conserves the pot. For any input a rule accepts,30//31//	sum(res.Payouts) + res.Fee == Stake * len(players)32//33// and nobody but a player of the round is ever paid. What is not paid to a34// player is the house's cut, the fee. Amounts are rounded down, and what35// rounding leaves over goes to the fee. A realm that pays out real coins36// should still check both properties on the Result it gets before it sends37// anything: that check is cheap, and it is what keeps a mistake in a rule38// from becoming a loss.39package payout40

Functions

not supported for pure packages by the node (vm/qfuncs)

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