Documentation ¶
Index ¶
- Variables
- type Poll
- type PollKey
- func (*PollKey) Descriptor() ([]byte, []int)
- func (m *PollKey) Marshal() (dAtA []byte, err error)
- func (m *PollKey) MarshalTo(dAtA []byte) (int, error)
- func (m *PollKey) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PollKey) ProtoMessage()
- func (m *PollKey) Reset()
- func (m *PollKey) Size() (n int)
- func (m PollKey) String() string
- func (m *PollKey) Unmarshal(dAtA []byte) error
- func (m PollKey) Validate() error
- func (m *PollKey) XXX_DiscardUnknown()
- func (m *PollKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PollKey) XXX_Merge(src proto.Message)
- func (m *PollKey) XXX_Size() int
- func (m *PollKey) XXX_Unmarshal(b []byte) error
- type PollMetadata
- func (*PollMetadata) Descriptor() ([]byte, []int)
- func (m PollMetadata) Is(state PollState) bool
- func (m *PollMetadata) Marshal() (dAtA []byte, err error)
- func (m *PollMetadata) MarshalTo(dAtA []byte) (int, error)
- func (m *PollMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PollMetadata) ProtoMessage()
- func (m *PollMetadata) Reset()
- func (m *PollMetadata) Size() (n int)
- func (m *PollMetadata) String() string
- func (m *PollMetadata) Unmarshal(dAtA []byte) error
- func (m PollMetadata) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error
- func (m PollMetadata) Validate() error
- func (m PollMetadata) With(properties ...PollProperty) PollMetadata
- func (m *PollMetadata) XXX_DiscardUnknown()
- func (m *PollMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PollMetadata) XXX_Merge(src proto.Message)
- func (m *PollMetadata) XXX_Size() int
- func (m *PollMetadata) XXX_Unmarshal(b []byte) error
- type PollProperty
- type PollState
- type Vote
- func (*Vote) Descriptor() ([]byte, []int)
- func (m *Vote) Marshal() (dAtA []byte, err error)
- func (m *Vote) MarshalTo(dAtA []byte) (int, error)
- func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Vote) ProtoMessage()
- func (m *Vote) Reset()
- func (m *Vote) Size() (n int)
- func (m *Vote) String() string
- func (m *Vote) Unmarshal(dAtA []byte) error
- func (m *Vote) XXX_DiscardUnknown()
- func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Vote) XXX_Merge(src proto.Message)
- func (m *Vote) XXX_Size() int
- func (m *Vote) XXX_Unmarshal(b []byte) error
- type VoteHandler
- type Voter
- func (*Voter) Descriptor() ([]byte, []int)
- func (m *Voter) Marshal() (dAtA []byte, err error)
- func (m *Voter) MarshalTo(dAtA []byte) (int, error)
- func (m *Voter) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Voter) ProtoMessage()
- func (m *Voter) Reset()
- func (m *Voter) Size() (n int)
- func (m *Voter) String() string
- func (m *Voter) Unmarshal(dAtA []byte) error
- func (m *Voter) XXX_DiscardUnknown()
- func (m *Voter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Voter) XXX_Merge(src proto.Message)
- func (m *Voter) XXX_Size() int
- func (m *Voter) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") )
var PollState_name = map[int32]string{
0: "POLL_STATE_UNSPECIFIED",
1: "POLL_STATE_PENDING",
2: "POLL_STATE_COMPLETED",
4: "POLL_STATE_FAILED",
8: "POLL_STATE_EXPIRED",
16: "POLL_STATE_ALLOW_OVERRIDE",
}
var PollState_value = map[string]int32{
"POLL_STATE_UNSPECIFIED": 0,
"POLL_STATE_PENDING": 1,
"POLL_STATE_COMPLETED": 2,
"POLL_STATE_FAILED": 4,
"POLL_STATE_EXPIRED": 8,
"POLL_STATE_ALLOW_OVERRIDE": 16,
}
Functions ¶
This section is empty.
Types ¶
type Poll ¶
type Poll interface { Vote(voter sdk.ValAddress, data codec.ProtoMarshaler) error Is(state PollState) bool AllowOverride() GetResult() codec.ProtoMarshaler GetKey() PollKey GetVoters() []Voter GetTotalVotingPower() sdk.Int Delete() error }
Poll provides an interface for other modules to interact with polls
type PollKey ¶
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
func NewPollKey ¶
NewPollKey constructor for PollKey without nonce
func (*PollKey) Descriptor ¶
func (*PollKey) MarshalToSizedBuffer ¶
func (*PollKey) ProtoMessage ¶
func (*PollKey) ProtoMessage()
func (PollKey) Validate ¶
Validate performs a stateless validity check to ensure PollKey has been properly initialized
func (*PollKey) XXX_DiscardUnknown ¶
func (m *PollKey) XXX_DiscardUnknown()
func (*PollKey) XXX_Marshal ¶
func (*PollKey) XXX_Unmarshal ¶
type PollMetadata ¶
type PollMetadata struct { Key PollKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key"` 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=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"` Voters []Voter `protobuf:"bytes,8,rep,name=voters,proto3" json:"voters"` TotalVotingPower github_com_cosmos_cosmos_sdk_types.Int `` /* 151-byte string literal not displayed */ RewardPoolName string `protobuf:"bytes,10,opt,name=reward_pool_name,json=rewardPoolName,proto3" json:"reward_pool_name,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 checks if the poll is in the given state
func (*PollMetadata) Marshal ¶
func (m *PollMetadata) Marshal() (dAtA []byte, err 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) Validate ¶ added in v0.9.0
func (m PollMetadata) Validate() error
Validate returns an error if the poll metadata is not valid; nil otherwise
func (PollMetadata) With ¶
func (m PollMetadata) With(properties ...PollProperty) PollMetadata
With returns a new metadata object with all the given properties set
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 PollProperty ¶
type PollProperty struct {
// contains filtered or unexported fields
}
PollProperty is a modifier for PollMetadata. It should never be manually initialized
func ExpiryAt ¶
func ExpiryAt(blockHeight int64) PollProperty
ExpiryAt sets the expiry property on PollMetadata
func MinVoterCount ¶
func MinVoterCount(minVoterCount int64) PollProperty
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 RewardPool ¶
func RewardPool(rewardPoolName string) PollProperty
RewardPool sets the name of a reward pool for the poll
func Threshold ¶
func Threshold(threshold utils.Threshold) PollProperty
Threshold sets the threshold property on PollMetadata
type Vote ¶ added in v0.17.0
type Vote struct {
Results []*types.Any `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
}
func (*Vote) Descriptor ¶ added in v0.17.0
func (*Vote) MarshalToSizedBuffer ¶ added in v0.17.0
func (*Vote) ProtoMessage ¶ added in v0.17.0
func (*Vote) ProtoMessage()
func (*Vote) XXX_DiscardUnknown ¶ added in v0.17.0
func (m *Vote) XXX_DiscardUnknown()
func (*Vote) XXX_Marshal ¶ added in v0.17.0
func (*Vote) XXX_Unmarshal ¶ added in v0.17.0
type VoteHandler ¶ added in v0.17.0
VoteHandler defines a function that handler pool result
type Voter ¶
type Voter struct { Validator github_com_cosmos_cosmos_sdk_types.ValAddress `` /* 126-byte string literal not displayed */ VotingPower int64 `protobuf:"varint,2,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"` }
func (*Voter) Descriptor ¶
func (*Voter) ProtoMessage ¶
func (*Voter) ProtoMessage()
func (*Voter) XXX_DiscardUnknown ¶
func (m *Voter) XXX_DiscardUnknown()