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

crews/v0 package

Overview

Package crews is small-group coordination you can create in one transaction: three to fifteen people with a shared pot, a way to decide, and a way to leave with their share.

It is the chain wiring for gno.land/p/moul/x/social/crew, which holds the share math and the proposal state. This realm reads the caller, reads the coins attached to the call, asks the engine, and renders the result.

Example
1Create    pay in, and you are the crew's first member
2Join      pay in at what a share is worth NOW, not at what it cost them
3Fund      pay in and mint nothing, so every existing share is worth more
4Propose   any member opens an advisory question
5Vote      weighted by the shares you hold, changeable while it is open
6Close     anyone, once the deadline has gone by
7Ragequit  burn your shares, be credited your slice, leave
8Withdraw  collect what you were credited

The shares are the token

There is no second asset to issue. A share is the vote weight and the claim on the treasury at the same moment, minted by paying in and burned by leaving, so nothing about it is decorative and nobody has to be persuaded it is worth something. v0 keeps the shares as an internal ledger rather than one GRC20 per crew, because a GRC20 per crew means a realm per crew. A transferable share belongs in gno.land/p/moul/x/social/coin, the sibling that refuses to exist until its mint rule, sink and buyer are declared; this realm does not import it.

The custody caveat, which is real

ONE realm address holds EVERY crew's treasury, with per-crew accounting inside it. The chain sees one balance; which crew owns which part of it is a number in this realm's state. So a bug in the accounting is a bug across crews, not inside one: an arithmetic error that over-credits one crew's ragequit pays it out of another crew's money, and nothing at the bank layer would refuse that transfer.

The fix is the instance-per-realm pattern (EFFECTIVE_GNO.md section 1.4): one realm per crew, each holding its own coins at its own address, with this package as the shared engine. That is v1. It is not v0 because deploying a realm per crew is a publish per crew, which is the opposite of "create it in one transaction", and the whole product claim here is the one transaction.

Payouts are pulled

Nothing is ever pushed. A ragequit credits an internal ledger and the leaver calls Withdraw themselves, so one address that cannot be paid cannot wedge anybody else, and the credit is zeroed before the coins move.

Function

SharesOf

func SharesOf(crewID int64, who address) int64

SharesOf is how many shares who holds in a crew.

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/social/crews/v0.SharesOf(,)"

Result