-
Notifications
You must be signed in to change notification settings - Fork 5
/
begin_unbonding.go
39 lines (32 loc) · 1.02 KB
/
begin_unbonding.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
package staking
import (
. "github.com/kaifei-bianjie/msg-parser/modules"
models "github.com/kaifei-bianjie/msg-parser/types"
)
// MsgBeginUnbonding - struct for unbonding transactions
type DocTxMsgBeginUnbonding struct {
DelegatorAddress string `bson:"delegator_address"`
ValidatorAddress string `bson:"validator_address"`
Amount models.Coin `bson:"amount"`
}
func (doctx *DocTxMsgBeginUnbonding) GetType() string {
return MsgTypeStakeBeginUnbonding
}
func (doctx *DocTxMsgBeginUnbonding) BuildMsg(txMsg interface{}) {
msg := txMsg.(*MsgStakeBeginUnbonding)
doctx.ValidatorAddress = msg.ValidatorAddress
doctx.DelegatorAddress = msg.DelegatorAddress
doctx.Amount = models.BuildDocCoin(msg.Amount)
}
func (m *DocTxMsgBeginUnbonding) HandleTxMsg(v SdkMsg) MsgDocInfo {
var (
addrs []string
msg MsgStakeBeginUnbonding
)
ConvertMsg(v, &msg)
addrs = append(addrs, msg.DelegatorAddress, msg.ValidatorAddress)
handler := func() (Msg, []string) {
return m, addrs
}
return CreateMsgDocInfo(v, handler)
}