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.

contest source realm

Package contest is a Remix Lab "demo-contest" app generated from a project configuration. Entrants submit through a f...

Overview

Package contest is a Remix Lab "demo-contest" app generated from a project configuration. Entrants submit through a fixed form, reviewers admit up to 10 entries, and members vote for a winner.

The contest runs once: opening the vote closes submissions and review, freezes the admitted entries as the ballot's options and captures the current members as the electorate. Every submission is public chain data, including entries that are later rejected.

Authority model: every write derives the actor from cur.Previous(), the immediate caller. An intermediary realm calling on a user's behalf acts as itself and gains none of that user's roles. Block state lives in unexported variables and only inert views leave the realm.

Functions 27

func Accept

crossing Action
1func Accept(cur realm, id uint64)
source

Accept admits a submitted entry to the ballot. Decisions are final.

func Ballot

Action
1func Ballot() (core.BallotView, bool)
source

Ballot returns the contest ballot once voting has opened.

func BallotEntries

Action
1func BallotEntries() []uint64
source

BallotEntries returns the entry ID of each ballot option, in option order.

func Descriptor

Action
1func Descriptor() core.AppDescriptor
source

Descriptor identifies this app's recipe and components.

func Entries

Action
1func Entries() []core.SubmissionView
source

Entries lists the admitted entries in submission order.

func Entry

Action
1func Entry(id uint64) (core.SubmissionView, bool)
source

Entry returns an inert copy of entry id in any status.

func Finalize

crossing Action
1func Finalize(cur realm)
source

Finalize commits the result once the deadline has passed. Anyone may call it; the result depends only on rules frozen when voting opened.

func Invite

crossing Action
1func Invite(cur realm, addr address, role string)
source

Invite lets addr join with role. Inviting a reviewer or owner also requires the members.set_role permission.

func Invites

Action
1func Invites(offset, limit int) []core.MemberView
source

Invites returns up to limit pending invitations (at most 25) starting at offset, with the role each one grants.

func Join

crossing Action
1func Join(cur realm)
source

Join accepts the caller's pending invitation.

func Leave

crossing Action
1func Leave(cur realm)
source

Leave removes the caller from the membership. An open vote keeps its frozen electorate.

func Members

Action
1func Members(offset, limit int) []core.MemberView
source

Members pages through members ordered by address.

func OpenVoting

crossing Action
1func OpenVoting(cur realm, durationSeconds int64)
source

OpenVoting closes submissions and review, turns the admitted entries into the ballot's options, captures the current members as the electorate and opens voting for durationSeconds.

func Queue

Action
1func Queue(offset, limit int) []core.SubmissionView
source

Queue pages through entries awaiting review in submission order.

func Reject

crossing Action
1func Reject(cur realm, id uint64)
source

Reject declines a submitted entry. Decisions are final.

func Render

1func Render(path string) string
source

Render serves the native pages: overview (entries, ballot and result), a single entry, the review queue, members and rules.

func RevokeInvite

crossing Action
1func RevokeInvite(cur realm, addr address)
source

RevokeInvite cancels a pending invitation. Revoking an invitation for a reviewer or owner also requires the members.set_role permission.

func Rules

Action
1func Rules() []policies.RuleView
source

Rules lists every operation's current rule.

func SetRole

crossing Action
1func SetRole(cur realm, addr address, role string)
source

SetRole changes addr's role.

func SetRule

crossing Action
1func SetRule(cur realm, op string, rule string)
source

SetRule changes the rule for an operation, within that operation's floor.

func Submit

crossing Action
1func Submit(cur realm, title string, link string, team string) uint64
source

Submit stores a contest entry for review and returns its ID. Every answer is public. Leave optional fields empty.

  • title: required text, at most 80 bytes
  • link: required text, at most 200 bytes
  • team: optional text, at most 120 bytes

func Vote

crossing Action
1func Vote(cur realm, entryID uint64)
source

Vote casts the caller's vote for an admitted entry.

func Winner

Action
1func Winner() (uint64, bool)
source

Winner returns the winning entry once the result is final and has a single winner.

Dependencies

Source Files 4