realmPath
untyped stringrealmPath is this realm's own path, the one its gnomod.toml module line declares. It is written out rather than read from the runtime, because every plain read this realm exports reports its CALLER and would build every link against the wrong realm.
Value
"gno.land/r/moul/x/social/crews/v0"
denom
untyped stringdenom is the only coin a crew holds. ugnot and nothing else: a treasury that can hold several denominations needs a per-denomination share price, which is a different product.
Value
"ugnot"
IndexCrews
untyped bigintIndexCrews is how many crews the index page lists.
Value
(20 <untyped> bigint)
crews
*v0.Crewscrews holds every crew, every proposal and the credit ledger. A redeploy wipes it, which is the trade gnomod.toml's private = true makes: see the comment there.
- OID
- 025928…11a9:4
crews details
Create
func(name string) int64Create opens a crew and makes the caller its first member. Send ugnot with the call: the founder's shares are bought out of it at crew.InitialPricePerShare, and the whole amount, remainder included, becomes the treasury. Returns the new crew's id.
- OID
- 025928…11a9:13
Create details
Join
func(crewID int64) int64Join mints the caller shares at what a share is worth right now and adds what they sent to the treasury. Returns the shares minted. The price is amount \* totalShares / treasury, rounded down, so somebody joining a crew that has tripled its money pays three times what the founders did. Send at least ValuePerShare ugnot, or there is no whole share to mint.
- OID
- 025928…11a9:15
Join details
Fund
func(crewID int64) int64Fund adds what the caller sent to a crew's treasury and mints nothing, so every existing share is worth more afterwards. It is how revenue, a grant or a member topping the pot up arrives. Anyone may fund any crew, member or not: there is no way to refuse a transfer on this chain anyway, and pretending otherwise would only move the donation to a bank send the realm cannot account for.
- OID
- 025928…11a9:16
Fund details
Propose
func(crewID int64, text string) int64Propose opens an advisory question on a crew. Any member may propose, and it stays open for crew.VoteBlocks blocks. Returns the proposal's id. A proposal EXECUTES NOTHING. Passing one records that the crew agreed by share weight, and moves no coins, changes no membership and binds no code. Executing a payout is the next step and it is not in v0.
- OID
- 025928…11a9:17
Propose details
Vote
func(proposalID int64, yes bool)Vote records the caller's ballot, weighted by the shares they hold at this moment. One ballot per member, changeable while the proposal is open.
- OID
- 025928…11a9:18
Vote details
Close
func(proposalID int64) boolClose records a proposal as passed or failed once its deadline has gone by, and returns which. Anyone may call it: closing is bookkeeping, not authority.
- OID
- 025928…11a9:19
Close details
Ragequit
func(crewID int64) int64Ragequit burns every share the caller holds, credits them their pro-rata slice of the treasury and removes them from the crew. Returns the amount credited, which [Withdraw](#Withdraw) collects. Nobody has to agree. That is what makes a share mean something: the exit is priced by the same number that votes, and a member outvoted on everything can still leave with what they put in plus their part of what the crew built.
- OID
- 025928…11a9:20
Ragequit details
Withdraw
func() int64Withdraw sends the caller everything they have been credited, and returns it. The credit is zeroed before the coins move, so a reentrant call finds nothing left to take. Nothing in this realm ever pushes value: one address that cannot be paid must not be able to wedge everybody else.
- OID
- 025928…11a9:21
Withdraw details
Get
func(crewID int64) (string, int64, int, int64, int64)Get returns a crew's name, the height it was created at, how many members it has, its total shares and its treasury in ugnot. Flat values rather than the crew itself: handing out a pointer to live state is a mutation handle nothing checks, and a struct is not something a wallet can decode anyway.
- OID
- 025928…11a9:22
Get details
Count
func() intCount is how many crews exist.
- OID
- 025928…11a9:23
Count details
SharesOf
func(crewID int64, who .uverse.address) int64SharesOf is how many shares who holds in a crew.
- OID
- 025928…11a9:24
SharesOf details
MemberCount
func(crewID int64) intMemberCount is how many people are in a crew.
- OID
- 025928…11a9:25
MemberCount details
Treasury
func(crewID int64) int64Treasury is what a crew holds, in ugnot. The coins themselves sit at this realm's single address: see the package doc on custody.
- OID
- 025928…11a9:26
Treasury details
ValuePerShare
func(crewID int64) int64ValuePerShare is what one of a crew's shares is worth in ugnot, rounded down.
- OID
- 025928…11a9:27
ValuePerShare details
ProposalOf
func(proposalID int64) (int64, .uverse.address, string, int64, bool, bool)- OID
- 025928…11a9:28
ProposalOf details
Tally
func(proposalID int64) (int64, int64)Tally is a proposal's share-weighted yes and no.
- OID
- 025928…11a9:29
Tally details
CreditOf
func(who .uverse.address) int64CreditOf is what an address can withdraw right now, in ugnot.
- OID
- 025928…11a9:30
CreditOf details
TotalOwed
func() int64TotalOwed is every outstanding credit, which is the part of this realm's balance that belongs to people who have already left.
- OID
- 025928…11a9:31
TotalOwed details
caller
func() .uverse.address- OID
- 025928…11a9:32
caller details
Render
func(path string) stringRender routes three views: the index, one crew, and one proposal.
- OID
- 025928…11a9:33
Render details
renderIndex
func() string- OID
- 025928…11a9:35
renderIndex details
renderCrew
func(raw string) string- OID
- 025928…11a9:36
renderCrew details
renderProposal
func(raw string) string- OID
- 025928…11a9:37
renderProposal details
crewTable
func(items []v0.Listing) stringcrewTable lists crews, newest first.
- OID
- 025928…11a9:38
crewTable details
proposalTable
func(ids []v0.ID) stringproposalTable lists a crew's proposals, newest first. The link title is the id and not the text, which is the opposite of crewTable and deliberate: a proposal's text is free prose and may contain a pipe, md.Link's escaper leaves pipes alone, and a pipe in a link title inside a table cell opens a column. So the chrome carries the link and the prose goes through ui.Cell, which is the escaper that knows it is in a table.
- OID
- 025928…11a9:39
proposalTable details
state
func(p *v0.Proposal, now int64) stringstate is the one word a proposal is in at height now.
- OID
- 025928…11a9:40
state details
crewURL
func(id v0.ID) stringcrewURL is the gnoweb path of one crew.
- OID
- 025928…11a9:41
crewURL details
proposalURL
func(id v0.ID) stringproposalURL is the gnoweb path of one proposal.
- OID
- 025928…11a9:42
proposalURL details
realmURL
func() stringrealmURL is this realm's gnoweb path. The chain domain is the first element of a package path and a gnoweb path is the rest of it, so this is a prefix strip and not a hostname the realm has to know.
- OID
- 025928…11a9:43