-
Notifications
You must be signed in to change notification settings - Fork 4
/
transfer.go
44 lines (38 loc) · 1.26 KB
/
transfer.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
42
43
44
package ibc
import (
. "github.com/kaifei-bianjie/common-parser/modules"
models "github.com/kaifei-bianjie/common-parser/types"
. "github.com/kaifei-bianjie/cosmosmod-parser/modules"
)
type DocMsgTransfer struct {
PacketId string `bson:"packet_id"`
SourcePort string `bson:"source_port"`
SourceChannel string `bson:"source_channel"`
Token models.Coin `bson:"token"`
Sender string `bson:"sender"`
Receiver string `bson:"receiver"`
TimeoutHeight Height `bson:"timeout_height"`
TimeoutTimestamp int64 `bson:"timeout_timestamp"`
}
func (m *DocMsgTransfer) GetType() string {
return MsgTypeIBCTransfer
}
func (m *DocMsgTransfer) BuildMsg(v interface{}) {
msg := v.(*MsgTransfer)
m.SourcePort = msg.SourcePort
m.SourceChannel = msg.SourceChannel
m.Sender = msg.Sender
m.Receiver = msg.Receiver
m.TimeoutTimestamp = int64(msg.TimeoutTimestamp)
m.TimeoutHeight = loadHeight(msg.TimeoutHeight)
m.Token = models.BuildDocCoin(msg.Token)
}
func (m *DocMsgTransfer) HandleTxMsg(v SdkMsg) MsgDocInfo {
var addrs []string
msg := v.(*MsgTransfer)
addrs = append(addrs, msg.Sender, msg.Receiver)
handler := func() (Msg, []string) {
return m, addrs
}
return CreateMsgDocInfo(v, handler)
}