-
Notifications
You must be signed in to change notification settings - Fork 4
/
vote.go
37 lines (29 loc) · 860 Bytes
/
vote.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package v1beta1
import (
. "github.com/kaifei-bianjie/common-parser/modules"
. "github.com/kaifei-bianjie/cosmosmod-parser/modules"
)
// MsgVote
type DocTxMsgVote struct {
ProposalID int64 `bson:"proposal_id"` // ID of the proposal
Voter string `bson:"voter"` // address of the voter
Option int32 `bson:"option"` // option from OptionSet chosen by the voter
}
func (m *DocTxMsgVote) GetType() string {
return MsgTypeVote
}
func (m *DocTxMsgVote) BuildMsg(txMsg interface{}) {
msg := txMsg.(*MsgVote)
m.Voter = msg.Voter
m.Option = int32(msg.Option)
m.ProposalID = int64(msg.ProposalId)
}
func (m *DocTxMsgVote) HandleTxMsg(v SdkMsg) MsgDocInfo {
var addrs []string
msg := v.(*MsgVote)
addrs = append(addrs, msg.Voter)
handler := func() (Msg, []string) {
return m, addrs
}
return CreateMsgDocInfo(v, handler)
}