exported

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

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",
	4:  "POLL_STATE_FAILED",
	8:  "POLL_STATE_EXPIRED",
	16: "POLL_STATE_ALLOW_OVERRIDE",
}
View Source
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

func NewPollKey(module string, id string) PollKey

NewPollKey constructor for PollKey without nonce

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

func (m PollKey) String() string

func (*PollKey) Unmarshal

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

func (PollKey) Validate

func (m PollKey) Validate() error

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 (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 {
	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) 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) 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 PollState

type PollState int32
const (
	// these enum values are used for bitwise operations, therefore they need to
	// be powers of 2
	NonExistent   PollState = 0
	Pending       PollState = 1
	Completed     PollState = 2
	Failed        PollState = 4
	Expired       PollState = 8
	AllowOverride PollState = 16
)

func (PollState) EnumDescriptor

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

func (PollState) String

func (x PollState) String() string

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) Descriptor() ([]byte, []int)

func (*Voter) Marshal

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

func (*Voter) MarshalTo

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

func (*Voter) MarshalToSizedBuffer

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

func (*Voter) ProtoMessage

func (*Voter) ProtoMessage()

func (*Voter) Reset

func (m *Voter) Reset()

func (*Voter) Size

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

func (*Voter) String

func (m *Voter) String() string

func (*Voter) Unmarshal

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

func (*Voter) XXX_DiscardUnknown

func (m *Voter) XXX_DiscardUnknown()

func (*Voter) XXX_Marshal

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

func (*Voter) XXX_Merge

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

func (*Voter) XXX_Size

func (m *Voter) XXX_Size() int

func (*Voter) XXX_Unmarshal

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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