-
Notifications
You must be signed in to change notification settings - Fork 5
/
begin_redelegate.go
41 lines (34 loc) · 1.17 KB
/
begin_redelegate.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
38
39
40
41
package staking
import (
. "github.com/kaifei-bianjie/msg-parser/modules"
models "github.com/kaifei-bianjie/msg-parser/types"
)
// MsgDelegate - struct for bonding transactions
type DocTxMsgBeginRedelegate struct {
DelegatorAddress string `bson:"delegator_address"`
ValidatorSrcAddress string `bson:"validator_src_address"`
ValidatorDstAddress string `bson:"validator_dst_address"`
Amount models.Coin `bson:"amount"`
}
func (doctx *DocTxMsgBeginRedelegate) GetType() string {
return MsgTypeBeginRedelegate
}
func (doctx *DocTxMsgBeginRedelegate) BuildMsg(txMsg interface{}) {
msg := txMsg.(*MsgBeginRedelegate)
doctx.DelegatorAddress = msg.DelegatorAddress
doctx.ValidatorSrcAddress = msg.ValidatorSrcAddress
doctx.ValidatorDstAddress = msg.ValidatorDstAddress
doctx.Amount = models.BuildDocCoin(msg.Amount)
}
func (m *DocTxMsgBeginRedelegate) HandleTxMsg(v SdkMsg) MsgDocInfo {
var (
addrs []string
msg MsgBeginRedelegate
)
ConvertMsg(v, &msg)
addrs = append(addrs, msg.DelegatorAddress, msg.ValidatorDstAddress, msg.ValidatorSrcAddress)
handler := func() (Msg, []string) {
return m, addrs
}
return CreateMsgDocInfo(v, handler)
}