const ViewSchemaVersion
ViewSchemaVersion is the version of the view/action shapes defined here. Bump it whenever an exported view struct changes shape.
Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.
Package core holds the shared Remix Lab contracts: error categories, roles, inert view records and the small read int...
Package core holds the shared Remix Lab contracts: error categories, roles, inert view records and the small read interfaces that blocks and adapters implement.
Nothing in this package holds state. View records are plain values that never alias a block's internal storage, so returning them from a realm does not hand out mutation capability.
ViewSchemaVersion is the version of the view/action shapes defined here. Bump it whenever an exported view struct changes shape.
1var (
2 ErrUnauthorized = errors.New("remix: unauthorized")
3 ErrNotFound = errors.New("remix: not found")
4 ErrInvalidInput = errors.New("remix: invalid input")
5 ErrLimitExceeded = errors.New("remix: limit exceeded")
6 ErrInvalidState = errors.New("remix: invalid state")
7 ErrConflict = errors.New("remix: conflict")
8)Error categories. Blocks wrap these so that clients can classify failures by prefix without parsing free-form text.
CheckText validates user-supplied text: valid UTF-8, between minBytes and maxBytes long, not blank when minBytes > 0, and free of control characters (other than newline when multiline is set) and of invisible or direction-changing format characters (see IsHiddenFormat). It does not escape; rendering is the render block's job.
Errorf returns an error whose message starts with the category's message, e.g. "remix: invalid input: title is empty".
Is reports whether err belongs to category.
IsHiddenFormat reports whether r is an invisible or direction-changing format character that could make text display differently from its content: soft hyphen, Arabic letter mark, Mongolian vowel separator, zero-width space, LRM/RLM, bidi embeddings, overrides and isolates, invisible operators, the byte order mark and interlinear annotations. ZWNJ and ZWJ (U+200C, U+200D) are allowed because several scripts and emoji sequences need them.
ParseRole converts the canonical role name to a Role.
AppDescriptor identifies how a realm was composed. Generated realms expose one so the Lab can show an app's ingredients from the chain itself.
AuthorizationPolicy decides whether an authenticated actor may perform a named operation. The actor must come from the realm's authenticated context, never from a caller-supplied argument.
BallotOutcome is the committed result of a finalized ballot.
BallotReader is the read side of a ballot box.
BallotStatus is the lifecycle stage of a ballot.
1type BallotView struct {
2 ID uint64
3 Title string
4 Options []string
5 Status BallotStatus
6 Public bool // anyone may vote; no electorate snapshot
7 ElectorateSize int // 0 for public ballots
8 QuorumPercent int // of the captured electorate
9 OpenedAt int64 // unix seconds, 0 while draft
10 Deadline int64 // unix seconds, 0 while draft
11 Counts []int // per option, same order as Options
12 Abstentions int
13 Turnout int // ballots cast, including abstentions
14 Outcome BallotOutcome
15 Winner int // option index when Outcome == OutcomeWinner, else -1
16}BallotView is an inert summary of a ballot and its current tally.
MemberView is an inert membership record.
1type MembershipReader interface {
2 // RoleOf returns addr's role, RoleNone for non-members.
3 RoleOf(addr address) Role
4 // Size returns the number of members.
5 Size() int
6 // Snapshot returns every member whose role is at least minRole, in a
7 // stable order. ok is false (and the slice nil) when more than max
8 // members qualify, so callers never act on a truncated electorate.
9 // A negative max or an invalid minRole also yields (nil, false).
10 Snapshot(minRole Role, max int) (addrs []address, ok bool)
11}MembershipReader is the read side of a membership set, implemented by the membership block and by adapters to shared membership realms.
Role is an address's standing inside a membership set. Roles are ordered: a higher role satisfies any requirement for a lower one.
SubmissionReader is the read side of a form.
SubmissionStatus is the review state of a form submission.
SubmissionView is an inert copy of a submission.