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/akkadia/beta/game_vault

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
game_vault
Namespace
akkadia / beta
Files
13 (gnomod.toml)
Exported functions
73
Module
gno.land/r/akkadia/beta/game_vault
gno
0.9

Files (13)

  • gnomod.tomltoml
  • distribution.gnogno
  • entry.gnogno
  • funding.gnogno
  • participation.gnogno
  • refund_query.gnogno
  • store.gnogno
  • validation.gnogno
  • vault.gnogno
  • refund_query_test.gnogno
  • security_test.gnogno
  • setup_test.gnogno
  • vault_test.gnogno
  • security_test.gnogno
    1package game_vault23import (4	"chain"5	"testing"67	"gno.land/p/nt/uassert/v0"8

    Functions

    • CancelEntryProcess(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}, processID uint64)

    • CancelParticipationProcess(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}, processID uint64)

    • CancelRewardPool(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}, poolKey string)

    • CloseEntryProcess(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}, processID uint64)

    • CloseParticipationProcess(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}, processID uint64)

    • CommitParticipationProcess(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}, processID uint64, operationKey string)

    • CreateEntryProcess(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}, processKey string, gameWorldID uint64, entryFeeUgnot int64) uint64

    • CreateParticipationProcess(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}, processKey string, gameWorldID uint64, rewardPoolKey string, participationFeeUgnot int64) uint64

    • CreateRewardPool(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}, poolKey string, gameWorldID uint64) uint64

    • DepositEntry(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}, processID uint64, participationKey string, entryKey string) uint64

    • DepositParticipation(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}, processID uint64, participationKey string, paymentKey string) uint64

    • DepositSystemFunding(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}, poolID uint64, fundingKey string) uint64

    • DistributeReward(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}, poolKey string, operationKey string, recipientCSV string, ugnotAmountCSV string) uint64

    • GetAccountedUgnotTotal() int64

    • GetDistributionBatchMax() int

    • GetEntryFund(fundID uint64) struct{ID uint64; ProcessID uint64; ParticipationKey string; EntryKey string; Owner .uverse.address; Amount int64; Refunded bool}

    • GetEntryFundCount(processID uint64, owner string, participationKey string) int

    • GetEntryFundCountByOwner(processID uint64, owner string) int

    • GetEntryFundID(processID uint64, owner string, entryKey string) uint64

    • GetEntryFundStatus(fundID uint64) int

    • GetEntryProcess(processID uint64) struct{ID uint64; ProcessKey string; GameWorldID uint64; EntryFee int64; Status gno.land/r/akkadia/beta/game_vault.EntryProcessStatus; HeldBalance int64; RefundedTotal int64; FundCount uint64}

    • GetEntryProcessID(processKey string) uint64

    • GetLatestEntryFundID() uint64

    • GetLatestEntryProcessID() uint64

    • GetLatestParticipationFundID() uint64

    • GetLatestParticipationProcessID() uint64

    • GetLatestRewardDistributionID() uint64

    • GetLatestRewardPoolID() uint64

    • GetLatestSystemFundingID() uint64

    • GetLatestVaultRefundID() uint64

    • GetParticipationFund(fundID uint64) struct{ID uint64; ProcessID uint64; ParticipationKey string; PaymentKey string; Owner .uverse.address; Amount int64; Refunded bool}

    • GetParticipationFundCount(processID uint64, owner string, participationKey string) int

    • GetParticipationFundCountByOwner(processID uint64, owner string) int

    • GetParticipationFundEffectiveStatus(fundID uint64) int

    • GetParticipationFundID(processID uint64, owner string, paymentKey string) uint64

    • GetParticipationProcess(processID uint64) struct{ID uint64; ProcessKey string; GameWorldID uint64; RewardPoolID uint64; ParticipationFee int64; Status gno.land/r/akkadia/beta/game_vault.ParticipationProcessStatus; HeldBalance int64; CommittedTotal int64; RefundedTotal int64; FundCount uint64}

    • GetParticipationProcessByKey(processKey string) struct{ID uint64; ProcessKey string; GameWorldID uint64; RewardPoolKey string; ParticipationFee int64; Status gno.land/r/akkadia/beta/game_vault.ParticipationProcessStatus; HeldBalance int64; CommittedTotal int64; RefundedTotal int64; FundCount uint64}

    • GetParticipationProcessID(processKey string) uint64

    • GetRewardDistribution(distributionID uint64) struct{ID uint64; PoolID uint64; GameWorldID uint64; OperationKey string; RecipientCount uint32; TotalAmount int64; Executor .uverse.address}

    • GetRewardDistributionByOperationKey(operationKey string) struct{ID uint64; PoolKey string; GameWorldID uint64; OperationKey string; RecipientCount uint32; TotalAmount int64; Executor .uverse.address}

    • GetRewardDistributionCountByPool(poolID uint64) int

    • GetRewardPool(poolID uint64) struct{ID uint64; PoolKey string; GameWorldID uint64; Status gno.land/r/akkadia/beta/game_vault.RewardPoolStatus; ParticipationCommittedTotal int64; SystemFundedTotal int64; SystemRefundedTotal int64; DistributedTotal int64; Balance int64; DistributionCount uint64}

    • GetRewardPoolByKey(poolKey string) struct{PoolKey string; GameWorldID uint64; Status gno.land/r/akkadia/beta/game_vault.RewardPoolStatus; ParticipationCommittedTotal int64; DistributedTotal int64; Balance int64; DistributionCount uint64}

    • GetRewardPoolCountByGameWorld(gameWorldID uint64) int

    • GetRewardPoolID(poolKey string) uint64

    • GetSystemFunding(fundingID uint64) struct{ID uint64; PoolID uint64; FundingKey string; Depositor .uverse.address; Amount int64; Refunded bool}

    • GetSystemFundingByKey(fundingKey string) struct{ID uint64; PoolID uint64; FundingKey string; Depositor .uverse.address; Amount int64; Refunded bool}

    • GetSystemFundingCountByPool(poolID uint64) int

    • GetUnaccountedUgnotTotal() int64

    • GetVaultRefund(refundID uint64) struct{ID uint64; PoolID uint64; OperationKey string; SourceKey string; Recipient .uverse.address; Amount int64; Kind string; Executor .uverse.address}

    • GetVaultRefundByOperationKey(operationKey string) struct{ID uint64; PoolID uint64; OperationKey string; SourceKey string; Recipient .uverse.address; Amount int64; Kind string; Executor .uverse.address}

    • GetVaultRefundCountByPool(poolID uint64) int

    • HasProcessedOperationKey(operationKey string) bool

    • ListEntryFundIDs(processID uint64, owner string, participationKey string, page int, count int) []uint64

    • ListEntryFundIDsByOwner(processID uint64, owner string, page int, count int) []uint64

    • ListEntryRefundStates(processKeysCSV string, ownersCSV string, entryKeysCSV string) []map[string]string

    • ListParticipationFundIDs(processID uint64, owner string, participationKey string, page int, count int) []uint64

    • ListParticipationFundIDsByOwner(processID uint64, owner string, page int, count int) []uint64

    • ListParticipationFundStates(values ...string) []map[string]string

    • ListParticipationPaymentStates(processKeysCSV string, ownersCSV string, paymentKeysCSV string) []map[string]string

    • ListParticipationProcessStates(processKeys ...string) []map[string]string

    • ListParticipationRefundStates(values ...string) []map[string]string

    • ListRefundScopeStates(scopeKeys ...string) []map[string]string

    • ListRewardDistributionIDsByPool(poolID uint64, page int, count int) []uint64

    • ListRewardPoolIDsByGameWorld(gameWorldID uint64, page int, count int) []uint64

    • ListSystemFundingIDsByPool(poolID uint64, page int, count int) []uint64

    • ListVaultRefundIDsByPool(poolID uint64, page int, count int) []uint64

    • LockRewardPool(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}, poolKey string)

    • RefundEntryFund(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}, fundID uint64, operationKey string) uint64

    • RefundParticipationFund(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}, fundID uint64, operationKey string) uint64

    • RefundSystemFunding(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}, poolID uint64, fundingKey string, operationKey string) uint64

    • SetDistributionBatchMax(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}, value int)

    • SettleRewardPool(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}, poolKey string)

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

    Rendered

    RenderedRawgnoweb ↗

    Render unavailable

    rate limit exceeded — the render query is served by the Gnoland archive RPC.

    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.

    )
    9
    10func TestGameVaultCallerSecurity(cur realm, t *testing.T) {
    11 vaultTest.Setup(cross(cur), t)
    12 testing.SetOriginCaller(vaultTest.Player1)
    13 testing.SetRealm(testing.NewUserRealm(vaultTest.Player1))
    14 testing.SetOriginSend(chain.Coins{})
    15 uassert.AbortsWithMessage(t, cur, "admin or operator access required", func() {
    16 CreateRewardPool(cross(cur), "pool:unauthorized", vaultTest.GameWorldID)
    17 })
    18
    19 processID := vaultTest.CreateEntryProcess(cross(cur), "entry:security", 10)
    20 testing.SetOriginCaller(vaultTest.Player1)
    21 testing.SetRealm(testing.NewCodeRealm("gno.land/r/example/vault_relay"))
    22 testing.SetOriginSend(chain.Coins{{"ugnot", 10}})
    23 uassert.AbortsWithMessage(t, cur, "contract calls not allowed: function must be called directly by user", func() {
    24 DepositEntry(cross(cur), processID, "participant:1", "entry:relay")
    25 })
    26}
    27
    28func TestParticipationRefundExcludesCommittedAmount(cur realm, t *testing.T) {
    29 vaultTest.Setup(cross(cur), t)
    30 poolID := vaultTest.CreatePool(cross(cur), "pool:refund")
    31 processID := vaultTest.CreateParticipationProcess(cross(cur), "participation:refund", "pool:refund", 10)
    32 refundedFundID := vaultTest.DepositParticipation(cross(cur), vaultTest.Player1, processID, "participant:1", "payment:refund", 10)
    33 committedFundID := vaultTest.DepositParticipation(cross(cur), vaultTest.Player1, processID, "participant:1", "payment:commit", 10)
    34
    35 testing.SetOriginCaller(vaultTest.Operator)
    36 testing.SetRealm(testing.NewUserRealm(vaultTest.Operator))
    37 testing.SetOriginSend(chain.Coins{})
    38 RefundParticipationFund(cross(cur), refundedFundID, "refund:participation")
    39 CloseParticipationProcess(cross(cur), processID)
    40 CommitParticipationProcess(cross(cur), processID, "commit:participation")
    41
    42 uassert.Equal(t, int64(10), GetRewardPool(poolID).Balance)
    43 uassert.Equal(t, int(ParticipationFundStatusRefunded), int(GetParticipationFundEffectiveStatus(refundedFundID)))
    44 uassert.Equal(t, int(ParticipationFundStatusCommitted), int(GetParticipationFundEffectiveStatus(committedFundID)))
    45 uassert.Equal(t, 1, GetVaultRefundCountByPool(poolID))
    46 uassert.AbortsWithMessage(t, cur, "participation fund cannot be refunded", func() {
    47 RefundParticipationFund(cross(cur), committedFundID, "refund:committed")
    48 })
    49}
    50
    51func TestSystemFundingCancellationRefundAndReplay(cur realm, t *testing.T) {
    52 vaultTest.Setup(cross(cur), t)
    53 poolID := vaultTest.CreatePool(cross(cur), "pool:system-refund")
    54 fundingID := vaultTest.DepositSystemFunding(cross(cur), poolID, "system:refund", 20)
    55
    56 testing.SetOriginCaller(vaultTest.Operator)
    57 testing.SetRealm(testing.NewUserRealm(vaultTest.Operator))
    58 testing.SetOriginSend(chain.Coins{})
    59 CancelRewardPool(cross(cur), "pool:system-refund")
    60 refundID := RefundSystemFunding(cross(cur), poolID, "system:refund", "refund:system")
    61
    62 uassert.True(t, GetSystemFunding(fundingID).Refunded)
    63 uassert.Equal(t, int64(0), GetRewardPool(poolID).Balance)
    64 uassert.Equal(t, refundID, GetVaultRefundByOperationKey("refund:system").ID)
    65 uassert.AbortsWithMessage(t, cur, "operation key already processed", func() {
    66 RefundSystemFunding(cross(cur), poolID, "system:refund", "refund:system")
    67 })
    68}
    69