exported

package
v0.36.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NoVote means the voter is not allowed to vote for the poll anymore
	NoVote = iota
	// VoteInTime means the voter successfully voted for the poll before it completes
	VoteInTime
	// VotedLate means the voter successfully voted for the poll after it completes but within the grace period
	VotedLate
)

Variables

View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)
View Source
var PollState_name = map[int32]string{
	0: "POLL_STATE_UNSPECIFIED",
	1: "POLL_STATE_PENDING",
	2: "POLL_STATE_COMPLETED",
	3: "POLL_STATE_FAILED",
}
View Source
var PollState_value = map[string]int32{
	"POLL_STATE_UNSPECIFIED": 0,
	"POLL_STATE_PENDING":     1,
	"POLL_STATE_COMPLETED":   2,
	"POLL_STATE_FAILED":      3,
}

Functions

This section is empty.

Types

type Poll

type Poll interface {
	GetID() PollID
	GetState() PollState
	HasVotedCorrectly(voter sdk.ValAddress) bool
	HasVoted(voter sdk.ValAddress) bool
	GetResult() codec.ProtoMarshaler
	GetRewardPoolName() (string, bool)
	GetVoters() []sdk.ValAddress
	Vote(voter sdk.ValAddress, blockHeight int64, data codec.ProtoMarshaler) (VoteResult, error)
	GetModule() string
	GetMetaData() (codec.ProtoMarshaler, bool)
}

Poll provides an interface for other modules to interact with polls

type PollBuilder added in v0.21.0

type PollBuilder struct {
	// contains filtered or unexported fields
}

PollBuilder is a builder that is used to build up the poll metadata

func NewPollBuilder added in v0.21.0

func NewPollBuilder(module string, threshold utils.Threshold, snapshot snapshot.Snapshot, expiresAt int64) PollBuilder

NewPollBuilder is the constructor for the poll builder

func (PollBuilder) Build added in v0.21.0

func (builder PollBuilder) Build(blockHeight int64) (PollMetadata, error)

Build returns the wrapped poll metadata, or an error if the poll metadata is not valid

func (PollBuilder) GracePeriod added in v0.21.0

func (builder PollBuilder) GracePeriod(gracePeriod int64) PollBuilder

GracePeriod sets the grace period after poll completion during which votes are still recorded

func (PollBuilder) ID added in v0.21.0

func (builder PollBuilder) ID(pollID PollID) PollBuilder

ID sets the poll ID

func (PollBuilder) MinVoterCount added in v0.21.0

func (builder PollBuilder) MinVoterCount(minVoterCount int64) PollBuilder

MinVoterCount sets the minimum number of voters that have to vote on PollMeta If not enough voters exist, then all of them have to vote

func (PollBuilder) ModuleMetadata added in v0.21.0

func (builder PollBuilder) ModuleMetadata(moduleMetadata codec.ProtoMarshaler) PollBuilder

ModuleMetadata sets the module metadata on the poll

func (PollBuilder) RewardPoolName added in v0.21.0

func (builder PollBuilder) RewardPoolName(rewardPoolName string) PollBuilder

RewardPoolName sets the name of a reward pool for the poll

type PollID added in v0.21.0

type PollID uint64

PollID represents ID of polls

func (PollID) String added in v0.21.0

func (id PollID) String() string

String converts the given poll ID to string

type PollKey deprecated

type PollKey struct {
	Module string `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"`
	ID     string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
}

PollKey represents the key data for a poll

Deprecated: Do not use.

func (*PollKey) Descriptor

func (*PollKey) Descriptor() ([]byte, []int)

func (*PollKey) Marshal

func (m *PollKey) Marshal() (dAtA []byte, err error)

func (*PollKey) MarshalTo

func (m *PollKey) MarshalTo(dAtA []byte) (int, error)

func (*PollKey) MarshalToSizedBuffer

func (m *PollKey) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PollKey) ProtoMessage

func (*PollKey) ProtoMessage()

func (*PollKey) Reset

func (m *PollKey) Reset()

func (*PollKey) Size

func (m *PollKey) Size() (n int)

func (PollKey) String deprecated

func (m PollKey) String() string

Deprecated: String converts the given poll key to string

func (*PollKey) Unmarshal

func (m *PollKey) Unmarshal(dAtA []byte) error

func (*PollKey) XXX_DiscardUnknown

func (m *PollKey) XXX_DiscardUnknown()

func (*PollKey) XXX_Marshal

func (m *PollKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PollKey) XXX_Merge

func (m *PollKey) XXX_Merge(src proto.Message)

func (*PollKey) XXX_Size

func (m *PollKey) XXX_Size() int

func (*PollKey) XXX_Unmarshal

func (m *PollKey) XXX_Unmarshal(b []byte) error

type PollMetadata

type PollMetadata struct {
	ExpiresAt       int64             `protobuf:"varint,3,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"`
	Result          *types.Any        `protobuf:"bytes,4,opt,name=result,proto3" json:"result,omitempty"`
	VotingThreshold utils.Threshold   `protobuf:"bytes,5,opt,name=voting_threshold,json=votingThreshold,proto3" json:"voting_threshold"`
	State           PollState         `protobuf:"varint,6,opt,name=state,proto3,enum=axelar.vote.exported.v1beta1.PollState" json:"state,omitempty"`
	MinVoterCount   int64             `protobuf:"varint,7,opt,name=min_voter_count,json=minVoterCount,proto3" json:"min_voter_count,omitempty"`
	RewardPoolName  string            `protobuf:"bytes,10,opt,name=reward_pool_name,json=rewardPoolName,proto3" json:"reward_pool_name,omitempty"`
	GracePeriod     int64             `protobuf:"varint,11,opt,name=grace_period,json=gracePeriod,proto3" json:"grace_period,omitempty"`
	CompletedAt     int64             `protobuf:"varint,12,opt,name=completed_at,json=completedAt,proto3" json:"completed_at,omitempty"`
	ID              PollID            `protobuf:"varint,13,opt,name=id,proto3,customtype=PollID" json:"id"`
	Snapshot        exported.Snapshot `protobuf:"bytes,15,opt,name=snapshot,proto3" json:"snapshot"`
	Module          string            `protobuf:"bytes,16,opt,name=module,proto3" json:"module,omitempty"`
	ModuleMetadata  *types.Any        `protobuf:"bytes,17,opt,name=module_metadata,json=moduleMetadata,proto3" json:"module_metadata,omitempty"`
}

PollMetadata represents a poll with write-in voting, i.e. the result of the vote can have any data type

func (*PollMetadata) Descriptor

func (*PollMetadata) Descriptor() ([]byte, []int)

func (PollMetadata) Is added in v0.9.0

func (m PollMetadata) Is(state PollState) bool

Is returns true if the poll metadata is in the given state, false otherwise

func (*PollMetadata) Marshal

func (m *PollMetadata) Marshal() (dAtA []byte, err error)

func (*PollMetadata) MarshalTo

func (m *PollMetadata) MarshalTo(dAtA []byte) (int, error)

func (*PollMetadata) MarshalToSizedBuffer

func (m *PollMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PollMetadata) ProtoMessage

func (*PollMetadata) ProtoMessage()

func (*PollMetadata) Reset

func (m *PollMetadata) Reset()

func (*PollMetadata) Size

func (m *PollMetadata) Size() (n int)

func (*PollMetadata) String

func (m *PollMetadata) String() string

func (*PollMetadata) Unmarshal

func (m *PollMetadata) Unmarshal(dAtA []byte) error

func (PollMetadata) UnpackInterfaces

func (m PollMetadata) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

UnpackInterfaces implements UnpackInterfacesMessage

func (PollMetadata) ValidateBasic added in v0.21.0

func (m PollMetadata) ValidateBasic() error

ValidateBasic returns an error if the poll metadata is not valid; nil otherwise

func (*PollMetadata) XXX_DiscardUnknown

func (m *PollMetadata) XXX_DiscardUnknown()

func (*PollMetadata) XXX_Marshal

func (m *PollMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PollMetadata) XXX_Merge

func (m *PollMetadata) XXX_Merge(src proto.Message)

func (*PollMetadata) XXX_Size

func (m *PollMetadata) XXX_Size() int

func (*PollMetadata) XXX_Unmarshal

func (m *PollMetadata) XXX_Unmarshal(b []byte) error

type PollParticipants added in v0.21.0

type PollParticipants struct {
	PollID       PollID                                          `protobuf:"varint,1,opt,name=poll_id,json=pollId,proto3,customtype=PollID" json:"poll_id"`
	Participants []github_com_cosmos_cosmos_sdk_types.ValAddress `` /* 132-byte string literal not displayed */
}

PollParticipants should be embedded in poll events in other modules

func (*PollParticipants) Descriptor added in v0.21.0

func (*PollParticipants) Descriptor() ([]byte, []int)

func (*PollParticipants) Marshal added in v0.21.0

func (m *PollParticipants) Marshal() (dAtA []byte, err error)

func (*PollParticipants) MarshalTo added in v0.21.0

func (m *PollParticipants) MarshalTo(dAtA []byte) (int, error)

func (*PollParticipants) MarshalToSizedBuffer added in v0.21.0

func (m *PollParticipants) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PollParticipants) ProtoMessage added in v0.21.0

func (*PollParticipants) ProtoMessage()

func (*PollParticipants) Reset added in v0.21.0

func (m *PollParticipants) Reset()

func (*PollParticipants) Size added in v0.21.0

func (m *PollParticipants) Size() (n int)

func (*PollParticipants) String added in v0.21.0

func (m *PollParticipants) String() string

func (*PollParticipants) Unmarshal added in v0.21.0

func (m *PollParticipants) Unmarshal(dAtA []byte) error

func (*PollParticipants) XXX_DiscardUnknown added in v0.21.0

func (m *PollParticipants) XXX_DiscardUnknown()

func (*PollParticipants) XXX_Marshal added in v0.21.0

func (m *PollParticipants) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PollParticipants) XXX_Merge added in v0.21.0

func (m *PollParticipants) XXX_Merge(src proto.Message)

func (*PollParticipants) XXX_Size added in v0.21.0

func (m *PollParticipants) XXX_Size() int

func (*PollParticipants) XXX_Unmarshal added in v0.21.0

func (m *PollParticipants) XXX_Unmarshal(b []byte) error

type PollState

type PollState int32
const (
	NonExistent PollState = 0
	Pending     PollState = 1
	Completed   PollState = 2
	Failed      PollState = 3
)

func (PollState) EnumDescriptor

func (PollState) EnumDescriptor() ([]byte, []int)

func (PollState) String

func (x PollState) String() string

type VoteHandler added in v0.17.0

type VoteHandler interface {
	IsFalsyResult(result codec.ProtoMarshaler) bool
	HandleExpiredPoll(ctx sdk.Context, poll Poll) error
	HandleFailedPoll(ctx sdk.Context, poll Poll) error
	HandleCompletedPoll(ctx sdk.Context, poll Poll) error
	HandleResult(ctx sdk.Context, result codec.ProtoMarshaler) error
}

VoteHandler defines a struct that can handle the poll result

type VoteResult added in v0.21.0

type VoteResult int

VoteResult represents all possible results of vote

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL