@@ -60,17 +60,44 @@ func (k Keeper) SendTransfer(
60
60
timeoutHeight clienttypes.Height ,
61
61
timeoutTimestamp uint64 ,
62
62
) error {
63
+ << << << < HEAD
64
+ == == == =
65
+ _, err := k .sendTransfer (
66
+ ctx ,
67
+ sourcePort ,
68
+ sourceChannel ,
69
+ token ,
70
+ sender ,
71
+ receiver ,
72
+ timeoutHeight ,
73
+ timeoutTimestamp ,
74
+ )
75
+ return err
76
+ }
77
+
78
+ // sendTransfer handles transfer sending logic.
79
+ func (k Keeper ) sendTransfer (
80
+ ctx sdk.Context ,
81
+ sourcePort ,
82
+ sourceChannel string ,
83
+ token sdk.Coin ,
84
+ sender sdk.AccAddress ,
85
+ receiver string ,
86
+ timeoutHeight clienttypes.Height ,
87
+ timeoutTimestamp uint64 ,
88
+ ) (uint64 , error ) {
89
+ >> >> >> > 3363917 (MsgTransferResponse add sequence (#2377 ))
63
90
if ! k .GetSendEnabled (ctx ) {
64
- return types .ErrSendDisabled
91
+ return 0 , types .ErrSendDisabled
65
92
}
66
93
67
94
if k .bankKeeper .BlockedAddr (sender ) {
68
- return sdkerrors .Wrapf (sdkerrors .ErrUnauthorized , "%s is not allowed to send funds" , sender )
95
+ return 0 , sdkerrors .Wrapf (sdkerrors .ErrUnauthorized , "%s is not allowed to send funds" , sender )
69
96
}
70
97
71
98
sourceChannelEnd , found := k .channelKeeper .GetChannel (ctx , sourcePort , sourceChannel )
72
99
if ! found {
73
- return sdkerrors .Wrapf (channeltypes .ErrChannelNotFound , "port ID (%s) channel ID (%s)" , sourcePort , sourceChannel )
100
+ return 0 , sdkerrors .Wrapf (channeltypes .ErrChannelNotFound , "port ID (%s) channel ID (%s)" , sourcePort , sourceChannel )
74
101
}
75
102
76
103
destinationPort := sourceChannelEnd .GetCounterparty ().GetPortID ()
@@ -79,7 +106,7 @@ func (k Keeper) SendTransfer(
79
106
// get the next sequence
80
107
sequence , found := k .channelKeeper .GetNextSequenceSend (ctx , sourcePort , sourceChannel )
81
108
if ! found {
82
- return sdkerrors .Wrapf (
109
+ return 0 , sdkerrors .Wrapf (
83
110
channeltypes .ErrSequenceSendNotFound ,
84
111
"source port: %s, source channel: %s" , sourcePort , sourceChannel ,
85
112
)
@@ -89,7 +116,7 @@ func (k Keeper) SendTransfer(
89
116
// See spec for this logic: https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#packet-relay
90
117
channelCap , ok := k .scopedKeeper .GetCapability (ctx , host .ChannelCapabilityPath (sourcePort , sourceChannel ))
91
118
if ! ok {
92
- return sdkerrors .Wrap (channeltypes .ErrChannelCapabilityNotFound , "module does not own channel capability" )
119
+ return 0 , sdkerrors .Wrap (channeltypes .ErrChannelCapabilityNotFound , "module does not own channel capability" )
93
120
}
94
121
95
122
// NOTE: denomination and hex hash correctness checked during msg.ValidateBasic
@@ -102,7 +129,7 @@ func (k Keeper) SendTransfer(
102
129
if strings .HasPrefix (token .Denom , "ibc/" ) {
103
130
fullDenomPath , err = k .DenomPathFromHash (ctx , token .Denom )
104
131
if err != nil {
105
- return err
132
+ return 0 , err
106
133
}
107
134
}
108
135
@@ -125,7 +152,7 @@ func (k Keeper) SendTransfer(
125
152
if err := k .bankKeeper .SendCoins (
126
153
ctx , sender , escrowAddress , sdk .NewCoins (token ),
127
154
); err != nil {
128
- return err
155
+ return 0 , err
129
156
}
130
157
131
158
} else {
@@ -135,7 +162,7 @@ func (k Keeper) SendTransfer(
135
162
if err := k .bankKeeper .SendCoinsFromAccountToModule (
136
163
ctx , sender , types .ModuleName , sdk .NewCoins (token ),
137
164
); err != nil {
138
- return err
165
+ return 0 , err
139
166
}
140
167
141
168
if err := k .bankKeeper .BurnCoins (
@@ -164,7 +191,7 @@ func (k Keeper) SendTransfer(
164
191
)
165
192
166
193
if err := k .ics4Wrapper .SendPacket (ctx , channelCap , packet ); err != nil {
167
- return err
194
+ return 0 , err
168
195
}
169
196
170
197
defer func () {
@@ -183,7 +210,7 @@ func (k Keeper) SendTransfer(
183
210
)
184
211
}()
185
212
186
- return nil
213
+ return sequence , nil
187
214
}
188
215
189
216
// OnRecvPacket processes a cross chain fungible token transfer. If the
0 commit comments