Documentation
¶
Index ¶
- Constants
- Variables
- func PayloadSelector(payloadType uint32) (serializer.Serializable, error)
- type AddressReward
- type AddressRewards
- type Answer
- func (a *Answer) Deserialize(data []byte, deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) (int, error)
- func (a *Answer) MarshalJSON() ([]byte, error)
- func (a *Answer) Serialize(deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) ([]byte, error)
- func (a *Answer) UnmarshalJSON(bytes []byte) error
- type AnswerStatus
- type Answers
- type Ballot
- func (q *Ballot) Deserialize(data []byte, deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) (int, error)
- func (q *Ballot) MarshalJSON() ([]byte, error)
- func (q *Ballot) Serialize(deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) ([]byte, error)
- func (q *Ballot) UnmarshalJSON(bytes []byte) error
- type BallotBuilder
- type BlockForBlockIDProvider
- type Event
- func (e *Event) Ballot() *Ballot
- func (e *Event) BallotCanOverflow(protoParas *iotago.ProtocolParameters) bool
- func (e *Event) BallotQuestions() Questions
- func (e *Event) CommenceMilestoneIndex() iotago.MilestoneIndex
- func (e *Event) Deserialize(data []byte, deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) (int, error)
- func (e *Event) EndMilestoneIndex() iotago.MilestoneIndex
- func (e *Event) ID() (EventID, error)
- func (e *Event) IsAcceptingParticipation(atIndex iotago.MilestoneIndex) bool
- func (e *Event) IsCountingParticipation(atIndex iotago.MilestoneIndex) bool
- func (e *Event) MarshalJSON() ([]byte, error)
- func (e *Event) Serialize(deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) ([]byte, error)
- func (e *Event) ShouldAcceptParticipation(forIndex iotago.MilestoneIndex) bool
- func (e *Event) ShouldCountParticipation(forIndex iotago.MilestoneIndex) bool
- func (e *Event) Staking() *Staking
- func (e *Event) StakingCanOverflow(protoParas *iotago.ProtocolParameters) bool
- func (e *Event) StartMilestoneIndex() iotago.MilestoneIndex
- func (e *Event) Status(atIndex iotago.MilestoneIndex) string
- func (e *Event) UnmarshalJSON(bytes []byte) error
- type EventBuilder
- type EventID
- type EventRewards
- type EventStatus
- type LedgerUpdatesProvider
- type Manager
- func (pm *Manager) AddressRewards(address iotago.Address, msIndex ...iotago.MilestoneIndex) (*AddressRewards, error)
- func (pm *Manager) ApplyNewLedgerUpdate(index iotago.MilestoneIndex, created []*ParticipationOutput, ...) error
- func (pm *Manager) BlockForEventAndBlockID(eventID EventID, blockID iotago.BlockID) (*ParticipationBlock, error)
- func (pm *Manager) CloseDatabase() error
- func (pm *Manager) DeleteEvent(eventID EventID) error
- func (pm *Manager) Event(eventID EventID) *Event
- func (pm *Manager) EventIDs(eventPayloadType ...uint32) []EventID
- func (pm *Manager) EventRewards(eventID EventID, msIndex ...iotago.MilestoneIndex) (*EventRewards, error)
- func (pm *Manager) EventStatus(eventID EventID, milestone ...iotago.MilestoneIndex) (*EventStatus, error)
- func (pm *Manager) EventWithoutLocking(eventID EventID) *Event
- func (pm *Manager) Events() map[EventID]*Event
- func (pm *Manager) EventsAcceptingParticipation(index iotago.MilestoneIndex) map[EventID]*Event
- func (pm *Manager) EventsCountingParticipation(index iotago.MilestoneIndex) map[EventID]*Event
- func (pm *Manager) ForEachActiveParticipation(eventID EventID, consumer TrackedParticipationConsumer) error
- func (pm *Manager) ForEachAddressStakingParticipation(eventID EventID, msIndex iotago.MilestoneIndex, ...) error
- func (pm *Manager) ForEachPastParticipation(eventID EventID, consumer TrackedParticipationConsumer) error
- func (pm *Manager) LedgerIndex() iotago.MilestoneIndex
- func (pm *Manager) ParticipationForOutputIDWithoutLocking(eventID EventID, outputID iotago.OutputID) (*TrackedParticipation, error)
- func (pm *Manager) ParticipationsForAddress(eventID EventID, address iotago.Address) ([]*TrackedParticipation, error)
- func (pm *Manager) ParticipationsForAddressWithoutLocking(eventID EventID, address iotago.Address) ([]*TrackedParticipation, error)
- func (pm *Manager) ParticipationsForOutputID(outputID iotago.OutputID) ([]*TrackedParticipation, error)
- func (pm *Manager) ParticipationsFromBlock(msg *ParticipationBlock, msIndex iotago.MilestoneIndex) (*ParticipationOutput, []*Participation, error)
- func (pm *Manager) RewardsForTrackedParticipationWithoutLocking(trackedParticipation *TrackedParticipation, atIndex iotago.MilestoneIndex) (uint64, error)
- func (pm *Manager) StakingRewardForAddressWithoutLocking(eventID EventID, address iotago.Address, msIndex iotago.MilestoneIndex) (uint64, error)
- func (pm *Manager) StoreEvent(event *Event) (EventID, error)
- type NodeStatusProvider
- type Option
- type Options
- type OutputForOutputIDProvider
- type Participation
- func (p *Participation) Deserialize(data []byte, deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) (int, error)
- func (p *Participation) MarshalJSON() ([]byte, error)
- func (p *Participation) Serialize(deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) ([]byte, error)
- func (p *Participation) UnmarshalJSON(bytes []byte) error
- type ParticipationBlock
- func (msg *ParticipationBlock) Transaction() *iotago.Transaction
- func (msg *ParticipationBlock) TransactionEssence() *iotago.TransactionEssence
- func (msg *ParticipationBlock) TransactionEssenceTaggedData() *iotago.TaggedData
- func (msg *ParticipationBlock) TransactionEssenceUTXOInputs() iotago.OutputIDs
- type ParticipationOutput
- type ParticipationPayload
- func (p *ParticipationPayload) Deserialize(data []byte, deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) (int, error)
- func (p *ParticipationPayload) MarshalJSON() ([]byte, error)
- func (p *ParticipationPayload) Serialize(deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) ([]byte, error)
- func (p *ParticipationPayload) UnmarshalJSON(bytes []byte) error
- type Participations
- type ParticipationsBuilder
- type ProtocolParametersProvider
- type Question
- func (q *Question) Deserialize(data []byte, deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) (int, error)
- func (q *Question) MarshalJSON() ([]byte, error)
- func (q *Question) QuestionAnswers() []*Answer
- func (q *Question) Serialize(deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) ([]byte, error)
- func (q *Question) UnmarshalJSON(bytes []byte) error
- type QuestionBuilder
- type QuestionStatus
- type Questions
- type Staking
- func (s *Staking) Deserialize(data []byte, deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) (int, error)
- func (s *Staking) MarshalJSON() ([]byte, error)
- func (s *Staking) Serialize(deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) ([]byte, error)
- func (s *Staking) UnmarshalJSON(bytes []byte) error
- type StakingRewardsConsumer
- type StakingStatus
- type TrackedParticipation
- type TrackedParticipationConsumer
Constants ¶
const ( AnswerTextMaxLength = 255 AnswerAdditionalInfoMaxLength = 500 AnswerValueSkipped = 0 AnswerValueInvalid = 255 )
const ( // BallotPayloadTypeID defines the ballot payload's type ID. BallotPayloadTypeID uint32 = 0 BallotMinQuestionsCount = 1 BallotMaxQuestionsCount = 10 )
const ( // Holds the database status. ParticipationStoreKeyPrefixStatus byte = 0 // Holds the events. ParticipationStoreKeyPrefixEvents byte = 1 // Holds the blocks containing participations. ParticipationStoreKeyPrefixBlocks byte = 2 // Tracks all active and past participations. ParticipationStoreKeyPrefixTrackedOutputs byte = 3 ParticipationStoreKeyPrefixTrackedSpentOutputs byte = 4 ParticipationStoreKeyPrefixTrackedOutputByAddress byte = 5 // Voting. ParticipationStoreKeyPrefixBallotCurrentVoteBalanceForQuestionAndAnswer byte = 6 ParticipationStoreKeyPrefixBallotAccululatedVoteBalanceForQuestionAndAnswer byte = 7 // Staking. ParticipationStoreKeyPrefixStakingAddress byte = 8 ParticipationStoreKeyPrefixStakingTotalParticipation byte = 9 ParticipationStoreKeyPrefixStakingCurrentRewards byte = 10 )
const ( // EventIDLength defines the length of a participation event ID. EventIDLength = blake2b.Size256 EventNameMaxLength = 255 EventAdditionalInfoMaxLength = 2000 )
const ( ParticipationsMinParticipationCount = 1 ParticipationsMaxParticipationCount = 255 )
const ( QuestionTextMaxLength = 255 QuestionAdditionalInfoMaxLength = 500 QuestionMinAnswersCount = 2 QuestionMaxAnswersCount = 10 )
const ( StakingPayloadTypeID uint32 = 1 StakingTextMaxLength = 255 StakingSymbolMinLength = 3 StakingSymbolMaxLength = 10 StakingAdditionalInfoMaxLength = 500 )
const (
BallotDenominator = 1000
)
const (
DBVersionParticipation byte = 1
)
Variables ¶
var ( NullEventID = EventID{} ErrUnknownPayloadType = errors.New("unknown payload type") ErrInvalidMilestoneSequence = errors.New("milestone are not monotonically increasing") ErrPayloadEmpty = errors.New("payload cannot be empty") ErrSerializationUnknownType = errors.New("invalid type") )
var ( ErrParticipationCorruptedStorage = errors.New("the participation database was not shutdown properly") ErrParticipationEventStartedBeforePruningIndex = errors.New("the given participation event started before the pruning index of this node") ErrParticipationEventBallotCanOverflow = errors.New("the given participation duration in combination with the maximum voting weight can overflow uint64") ErrParticipationEventStakingCanOverflow = errors.New("the given participation staking nominator and denominator in combination with the duration can overflow uint64") ErrParticipationEventAlreadyExists = errors.New("the given participation event already exists") )
var ( ErrUnknownParticipation = errors.New("no participation found") ErrEventNotFound = errors.New("referenced event does not exist") ErrInvalidEvent = errors.New("invalid event") ErrInvalidPreviouslyTrackedParticipation = errors.New("a previously tracked participation changed and is now invalid") ErrInvalidCurrentBallotVoteBalance = errors.New("current ballot vote balance invalid") ErrInvalidCurrentStakedAmount = errors.New("current staked amount invalid") ErrInvalidCurrentRewardsAmount = errors.New("current rewards amount invalid") )
var (
ErrInvalidNumeratorOrDenominator = errors.New("numerator and denominator need to be greater than zero")
)
var (
ErrSerializationReservedValue = errors.New("reserved value used")
)
Functions ¶
func PayloadSelector ¶
PayloadSelector implements SerializableSelectorFunc for payload types.
Types ¶
type AddressReward ¶
type AddressReward struct { // Amount is the staking reward. Amount uint64 `json:"amount"` // Symbol is the symbol of the rewarded tokens. Symbol string `json:"symbol"` // MinimumReached tells whether the minimum rewards required to be included in the staking results are reached. MinimumReached bool `json:"minimumReached"` }
AddressReward holds the amount and token symbol for a certain reward.
type AddressRewards ¶
type AddressRewards struct { // Rewards is a map of rewards per event. Rewards map[string]*AddressReward `json:"rewards"` // MilestoneIndex is the milestone index the rewards were calculated for. MilestoneIndex iotago.MilestoneIndex `json:"milestoneIndex"` }
AddressRewards holds all the staking rewards for a certain address.
type Answer ¶
type Answer struct { // Value is the value that should be used to pick this answer. It must be unique for each answer in a given question. Reserved values are 0 and 255. Value uint8 // Text is the text of the answer. Text string // AdditionalInfo is an additional description text about the answer. AdditionalInfo string }
Answer is a possible answer to a Ballot Question.
func (*Answer) Deserialize ¶
func (*Answer) MarshalJSON ¶
func (*Answer) UnmarshalJSON ¶
type AnswerStatus ¶
type AnswerStatus struct { // Value is the value that identifies this answer. Value uint8 `json:"value"` // Current is the current voting weight of the answer. Current uint64 `json:"current"` // Accumulated is the accumulated voting weight of the answer. Accumulated uint64 `json:"accumulated"` }
AnswerStatus holds the current and accumulated vote for an answer.
type Answers ¶
type Answers []*Answer
func (*Answers) FromSerializables ¶
func (a *Answers) FromSerializables(seris serializer.Serializables)
func (Answers) ToSerializables ¶
func (a Answers) ToSerializables() serializer.Serializables
type Ballot ¶
type Ballot struct { // Questions are the questions of the ballot and their possible answers. Questions Questions }
Ballot can be used to define a voting participation with variable questions.
func (*Ballot) Deserialize ¶
func (*Ballot) MarshalJSON ¶
func (*Ballot) UnmarshalJSON ¶
type BallotBuilder ¶
type BallotBuilder struct {
// contains filtered or unexported fields
}
BallotBuilder is used to easily build up a Ballot.
func NewBallotBuilder ¶
func NewBallotBuilder() *BallotBuilder
NewBallotBuilder creates a new BallotBuilder.
func (*BallotBuilder) AddQuestion ¶
func (qb *BallotBuilder) AddQuestion(entry *Question) *BallotBuilder
AddQuestion adds the given question to the Ballot.
func (*BallotBuilder) Build ¶
func (qb *BallotBuilder) Build() (*Ballot, error)
Build builds the Ballot.
type BlockForBlockIDProvider ¶
type Event ¶
type Event struct { // Name is the name of the event. Name string // MilestoneIndexCommence is the milestone index the commencing period starts. MilestoneIndexCommence iotago.MilestoneIndex // MilestoneIndexStart is the milestone index the holding period starts. MilestoneIndexStart iotago.MilestoneIndex // MilestoneIndexEnd is the milestone index the event ends. MilestoneIndexEnd iotago.MilestoneIndex // Payload is the payload of the event (ballot/staking). Payload serializer.Serializable // AdditionalInfo is an additional description text about the event. AdditionalInfo string }
Event.
func (*Event) Ballot ¶
Ballot returns the Ballot payload if this participation is for a Ballot event.
func (*Event) BallotCanOverflow ¶
func (e *Event) BallotCanOverflow(protoParas *iotago.ProtocolParameters) bool
BallotCanOverflow returns whether a Ballot event can overflow.
func (*Event) BallotQuestions ¶
BallotQuestions returns the questions contained in the Ballot payload if this participation contains a Ballot.
func (*Event) CommenceMilestoneIndex ¶
func (e *Event) CommenceMilestoneIndex() iotago.MilestoneIndex
CommenceMilestoneIndex returns the milestone index the commencing phase of the participation starts.
func (*Event) Deserialize ¶
func (*Event) EndMilestoneIndex ¶
func (e *Event) EndMilestoneIndex() iotago.MilestoneIndex
EndMilestoneIndex returns the milestone index the participation ends.
func (*Event) IsAcceptingParticipation ¶
func (e *Event) IsAcceptingParticipation(atIndex iotago.MilestoneIndex) bool
IsAcceptingParticipation returns true if the event already commenced or started the holding phase for the given milestone index.
func (*Event) IsCountingParticipation ¶
func (e *Event) IsCountingParticipation(atIndex iotago.MilestoneIndex) bool
IsCountingParticipation returns true if the event already started the holding phase for the given milestone index.
func (*Event) MarshalJSON ¶
func (*Event) ShouldAcceptParticipation ¶
func (e *Event) ShouldAcceptParticipation(forIndex iotago.MilestoneIndex) bool
ShouldAcceptParticipation returns true if the event should accept the participation for the given milestone index.
func (*Event) ShouldCountParticipation ¶
func (e *Event) ShouldCountParticipation(forIndex iotago.MilestoneIndex) bool
ShouldCountParticipation returns true if the event should count the participation for the given milestone index.
func (*Event) Staking ¶
Staking returns the staking payload if this participation is for a Staking event.
func (*Event) StakingCanOverflow ¶
func (e *Event) StakingCanOverflow(protoParas *iotago.ProtocolParameters) bool
StakingCanOverflow returns whether a Staking event can overflow.
func (*Event) StartMilestoneIndex ¶
func (e *Event) StartMilestoneIndex() iotago.MilestoneIndex
StartMilestoneIndex returns the milestone index the holding phase of the participation starts.
func (*Event) Status ¶
func (e *Event) Status(atIndex iotago.MilestoneIndex) string
Status returns a human-readable status of the event. Possible values are "upcoming", "commencing", "holding" and "ended".
func (*Event) UnmarshalJSON ¶
type EventBuilder ¶
type EventBuilder struct {
// contains filtered or unexported fields
}
EventBuilder is used to easily build up a Event.
func NewEventBuilder ¶
func NewEventBuilder(name string, milestoneCommence iotago.MilestoneIndex, milestoneBeginHolding iotago.MilestoneIndex, milestoneEnd iotago.MilestoneIndex, additionalInfo string) *EventBuilder
NewEventBuilder creates a new EventBuilder.
func (*EventBuilder) Build ¶
func (rb *EventBuilder) Build() (*Event, error)
Build builds the Event.
func (*EventBuilder) Payload ¶
func (rb *EventBuilder) Payload(seri serializer.Serializable) *EventBuilder
Payload sets the payload to embed within the block.
type EventRewards ¶
type EventRewards struct { // Symbol is the symbol of the rewarded tokens. Symbol string `json:"symbol"` // MilestoneIndex is the milestone index the rewards were calculated for. MilestoneIndex iotago.MilestoneIndex `json:"milestoneIndex"` // TotalRewards is the total reward. TotalRewards uint64 `json:"totalRewards"` // Checksum is the SHA256 checksum of the staking amount and rewards calculated for this MilestoneIndex. Checksum string `json:"checksum"` // Rewards is a map of rewards per address. Rewards map[string]uint64 `json:"rewards"` }
EventRewards holds the total rewards per address for a given event.
type EventStatus ¶
type EventStatus struct { // MilestoneIndex is the milestone index the status was calculated for. MilestoneIndex iotago.MilestoneIndex `json:"milestoneIndex"` // Status is the status of the event. Valid options are: "upcoming", "commencing", "holding" and "ended". Status string `json:"status"` // Questions holds the answer status of the different questions of the event. Questions []*QuestionStatus `json:"questions,omitempty"` // Staking is the staking status of the event. Staking *StakingStatus `json:"staking,omitempty"` // Checksum is the SHA256 checksum of all the question and answer status or the staking amount and rewards calculated for this MilestoneIndex. Checksum string `json:"checksum"` }
EventStatus holds the status of the event.
type LedgerUpdatesProvider ¶
type LedgerUpdatesProvider func(ctx context.Context, startIndex iotago.MilestoneIndex, endIndex iotago.MilestoneIndex, handler func(index iotago.MilestoneIndex, created []*ParticipationOutput, consumed []*ParticipationOutput) error) error
type Manager ¶ added in v1.0.0
type Manager struct { // lock used to secure the state of the Manager. syncutils.RWMutex // contains filtered or unexported fields }
Manager is used to track the outcome of participation in the tangle.
func NewManager ¶
func NewManager( ctx context.Context, participationStore kvstore.KVStore, protocolParametersProvider ProtocolParametersProvider, nodeStatusProvider NodeStatusProvider, blockForBlockIDProvider BlockForBlockIDProvider, outputForOutputIDProvider OutputForOutputIDProvider, ledgerUpdatesProvider LedgerUpdatesProvider, opts ...Option) (*Manager, error)
NewManager creates a new Manager instance.
func (*Manager) AddressRewards ¶ added in v1.0.0
func (pm *Manager) AddressRewards(address iotago.Address, msIndex ...iotago.MilestoneIndex) (*AddressRewards, error)
func (*Manager) ApplyNewLedgerUpdate ¶ added in v1.0.0
func (pm *Manager) ApplyNewLedgerUpdate(index iotago.MilestoneIndex, created []*ParticipationOutput, consumed []*ParticipationOutput) error
func (*Manager) BlockForEventAndBlockID ¶ added in v1.0.0
func (*Manager) CloseDatabase ¶ added in v1.0.0
CloseDatabase flushes the store and closes the underlying database.
func (*Manager) DeleteEvent ¶ added in v1.0.0
DeleteEvent deletes the event for the given eventID if it exists, else returns ErrEventNotFound.
func (*Manager) EventIDs ¶ added in v1.0.0
EventIDs return the IDs of all known events. Can be optionally filtered by event payload type.
func (*Manager) EventRewards ¶ added in v1.0.0
func (pm *Manager) EventRewards(eventID EventID, msIndex ...iotago.MilestoneIndex) (*EventRewards, error)
func (*Manager) EventStatus ¶ added in v1.0.0
func (pm *Manager) EventStatus(eventID EventID, milestone ...iotago.MilestoneIndex) (*EventStatus, error)
EventStatus returns the EventStatus for an event with the given eventID.
func (*Manager) EventWithoutLocking ¶ added in v1.0.0
EventWithoutLocking returns the event for the given eventID if it exists.
func (*Manager) EventsAcceptingParticipation ¶ added in v1.0.0
func (pm *Manager) EventsAcceptingParticipation(index iotago.MilestoneIndex) map[EventID]*Event
EventsAcceptingParticipation returns the events that are currently accepting participation, i.e. commencing or in the holding period.
func (*Manager) EventsCountingParticipation ¶ added in v1.0.0
func (pm *Manager) EventsCountingParticipation(index iotago.MilestoneIndex) map[EventID]*Event
EventsCountingParticipation returns the events that are currently actively counting participation, i.e. in the holding period.
func (*Manager) ForEachActiveParticipation ¶ added in v1.0.0
func (pm *Manager) ForEachActiveParticipation(eventID EventID, consumer TrackedParticipationConsumer) error
func (*Manager) ForEachAddressStakingParticipation ¶ added in v1.0.0
func (pm *Manager) ForEachAddressStakingParticipation(eventID EventID, msIndex iotago.MilestoneIndex, consumer StakingRewardsConsumer) error
func (*Manager) ForEachPastParticipation ¶ added in v1.0.0
func (pm *Manager) ForEachPastParticipation(eventID EventID, consumer TrackedParticipationConsumer) error
func (*Manager) LedgerIndex ¶ added in v1.0.0
func (pm *Manager) LedgerIndex() iotago.MilestoneIndex
func (*Manager) ParticipationForOutputIDWithoutLocking ¶ added in v1.0.0
func (*Manager) ParticipationsForAddress ¶ added in v1.0.0
func (*Manager) ParticipationsForAddressWithoutLocking ¶ added in v1.0.0
func (*Manager) ParticipationsForOutputID ¶ added in v1.0.0
func (pm *Manager) ParticipationsForOutputID(outputID iotago.OutputID) ([]*TrackedParticipation, error)
func (*Manager) ParticipationsFromBlock ¶ added in v1.0.0
func (pm *Manager) ParticipationsFromBlock(msg *ParticipationBlock, msIndex iotago.MilestoneIndex) (*ParticipationOutput, []*Participation, error)
func (*Manager) RewardsForTrackedParticipationWithoutLocking ¶ added in v1.0.0
func (pm *Manager) RewardsForTrackedParticipationWithoutLocking(trackedParticipation *TrackedParticipation, atIndex iotago.MilestoneIndex) (uint64, error)
func (*Manager) StakingRewardForAddressWithoutLocking ¶ added in v1.0.0
type NodeStatusProvider ¶
type NodeStatusProvider func(ctx context.Context) (confirmedIndex iotago.MilestoneIndex, pruningIndex iotago.MilestoneIndex)
type Option ¶
type Option func(opts *Options)
Option is a function setting a Manager option.
func WithTagMessage ¶
WithTagMessage defines the Manager tag payload to track.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options define options for the Manager.
type Participation ¶
type Participation struct { // EventID is the ID of the event the participation is made for. EventID EventID // Answers holds the IDs of the answers to the questions of the ballot. Answers []byte }
Participation holds the participation for an event and the optional answer to a ballot.
func (*Participation) Deserialize ¶
func (p *Participation) Deserialize(data []byte, deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) (int, error)
func (*Participation) MarshalJSON ¶
func (p *Participation) MarshalJSON() ([]byte, error)
func (*Participation) Serialize ¶
func (p *Participation) Serialize(deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) ([]byte, error)
func (*Participation) UnmarshalJSON ¶
func (p *Participation) UnmarshalJSON(bytes []byte) error
type ParticipationBlock ¶
func (*ParticipationBlock) Transaction ¶
func (msg *ParticipationBlock) Transaction() *iotago.Transaction
func (*ParticipationBlock) TransactionEssence ¶
func (msg *ParticipationBlock) TransactionEssence() *iotago.TransactionEssence
func (*ParticipationBlock) TransactionEssenceTaggedData ¶
func (msg *ParticipationBlock) TransactionEssenceTaggedData() *iotago.TaggedData
func (*ParticipationBlock) TransactionEssenceUTXOInputs ¶
func (msg *ParticipationBlock) TransactionEssenceUTXOInputs() iotago.OutputIDs
type ParticipationOutput ¶
type ParticipationPayload ¶
type ParticipationPayload struct { // Participations holds the participation for multiple events. Participations Participations }
ParticipationPayload holds the participation for multiple events.
func (*ParticipationPayload) Deserialize ¶
func (p *ParticipationPayload) Deserialize(data []byte, deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) (int, error)
func (*ParticipationPayload) MarshalJSON ¶
func (p *ParticipationPayload) MarshalJSON() ([]byte, error)
func (*ParticipationPayload) Serialize ¶
func (p *ParticipationPayload) Serialize(deSeriMode serializer.DeSerializationMode, deSeriCtx interface{}) ([]byte, error)
func (*ParticipationPayload) UnmarshalJSON ¶
func (p *ParticipationPayload) UnmarshalJSON(bytes []byte) error
type Participations ¶
type Participations []*Participation
func (*Participations) FromSerializables ¶
func (s *Participations) FromSerializables(seris serializer.Serializables)
func (Participations) ToSerializables ¶
func (s Participations) ToSerializables() serializer.Serializables
type ParticipationsBuilder ¶
type ParticipationsBuilder struct {
// contains filtered or unexported fields
}
ParticipationsBuilder is used to easily build up ParticipationPayload.
func NewParticipationsBuilder ¶
func NewParticipationsBuilder() *ParticipationsBuilder
NewParticipationsBuilder creates a new ParticipationsBuilder.
func (*ParticipationsBuilder) AddParticipation ¶
func (b *ParticipationsBuilder) AddParticipation(entry *Participation) *ParticipationsBuilder
AddParticipation adds the given participation to the participations.
func (*ParticipationsBuilder) Build ¶
func (b *ParticipationsBuilder) Build() (*ParticipationPayload, error)
Build builds the ParticipationPayload.
type ProtocolParametersProvider ¶
type ProtocolParametersProvider func() *iotago.ProtocolParameters
type Question ¶
type Question struct { // Text is the text of the question. Text string // Answers are the possible answers to the question. Answers Answers // AdditionalInfo is an additional description text about the question. AdditionalInfo string }
Question defines a single question inside a Ballot that can have multiple Answers.
func (*Question) Deserialize ¶
func (*Question) MarshalJSON ¶
func (*Question) QuestionAnswers ¶
QuestionAnswers returns the possible answers for a Question.
func (*Question) UnmarshalJSON ¶
type QuestionBuilder ¶
type QuestionBuilder struct {
// contains filtered or unexported fields
}
QuestionBuilder is used to easily build up a Question.
func NewQuestionBuilder ¶
func NewQuestionBuilder(text string, additionalInfo string) *QuestionBuilder
NewQuestionBuilder creates a new QuestionBuilder.
func (*QuestionBuilder) AddAnswer ¶
func (qb *QuestionBuilder) AddAnswer(entry *Answer) *QuestionBuilder
AddAnswer adds the given answer to the question.
func (*QuestionBuilder) Build ¶
func (qb *QuestionBuilder) Build() (*Question, error)
Build builds the Question.
type QuestionStatus ¶
type QuestionStatus struct { // Answers holds the status of the answers. Answers []*AnswerStatus `json:"answers"` }
QuestionStatus holds the answers for a question.
func (*QuestionStatus) StatusForAnswerValue ¶
func (q *QuestionStatus) StatusForAnswerValue(answerValue uint8) *AnswerStatus
type Questions ¶
type Questions []*Question
func (*Questions) FromSerializables ¶
func (q *Questions) FromSerializables(seris serializer.Serializables)
func (Questions) ToSerializables ¶
func (q Questions) ToSerializables() serializer.Serializables
type Staking ¶
type Staking struct { // Text is the description text of the staking event. Text string // Symbol is the symbol of the rewarded tokens. Symbol string // Numerator is used in combination with Denominator to calculate the rewards per milestone per staked tokens. Numerator uint32 // Denominator is used in combination with Numerator to calculate the rewards per milestone per staked tokens. Denominator uint32 // RequiredMinimumRewards are the minimum rewards required to be included in the staking results. RequiredMinimumRewards uint64 // AdditionalInfo is an additional description text about the staking event. AdditionalInfo string }
func (*Staking) Deserialize ¶
func (*Staking) MarshalJSON ¶
func (*Staking) UnmarshalJSON ¶
type StakingRewardsConsumer ¶
type StakingRewardsConsumer func(address iotago.Address, participation *TrackedParticipation, rewards uint64) bool
type StakingStatus ¶
type StakingStatus struct { // Staked is the currently staked amount of tokens. Staked uint64 `json:"staked"` // Rewarded is the total staking reward. Rewarded uint64 `json:"rewarded"` // Symbol is the symbol of the rewarded tokens. Symbol string `json:"symbol"` }
StakingStatus holds the status of a staking.
type TrackedParticipation ¶
type TrackedParticipation struct { // EventID is the ID of the event the participation is made for. EventID EventID // OutputID is the ID of the output the participation was made. OutputID iotago.OutputID // BlockID is the ID of the block that included the transaction that created the output the participation was made. BlockID iotago.BlockID // Amount is the amount of tokens that were included in the output the participation was made. Amount uint64 // StartIndex is the milestone index the participation started. StartIndex iotago.MilestoneIndex // EndIndex is the milestone index the participation ended. 0 if the participation is still active. EndIndex iotago.MilestoneIndex }
TrackedParticipation holds the information the node tracked for the participation.
func TrackedParticipationFromBytes ¶
func TrackedParticipationFromBytes(key []byte, value []byte) (*TrackedParticipation, error)
func (*TrackedParticipation) ValueBytes ¶
func (t *TrackedParticipation) ValueBytes() []byte
type TrackedParticipationConsumer ¶
type TrackedParticipationConsumer func(trackedParticipation *TrackedParticipation) bool