Skip to content

Commit 5e01461

Browse files
committed
Improve denom handling comments
1 parent 9342804 commit 5e01461

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

x/wasm/ibc.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,12 +435,15 @@ func (i IBCHandler) IBCReceivePacketCallback(
435435

436436
// For a more in-depth explanation of the logic here, see the transfer module implementation:
437437
// https://github.com/cosmos/ibc-go/blob/a6217ab02a4d57c52a938eeaff8aeb383e523d12/modules/apps/transfer/keeper/relay.go#L147-L175
438+
// and the sequence diagram in the ICS20 spec:
439+
// https://github.com/cosmos/ibc/blob/9be3630/spec/app/ics-020-fungible-token-transfer/README.md#data-structures
438440
if transferData.Token.Denom.HasPrefix(packet.GetSourcePort(), packet.GetSourceChannel()) {
439-
// this is a denom coming from this chain, being sent back again
440-
// remove prefix
441+
// This is a denom coming from this chain, being sent back again, so we remove the prefix.
442+
// See for example the "A -> C" step in the sequence diagram.
441443
transferData.Token.Denom.Trace = transferData.Token.Denom.Trace[1:]
442444
} else {
443445
// prefixing happens on the receiving end, so we need to do that here
446+
// See for example the "C -> A" step in the sequence diagram.
444447
trace := []transfertypes.Hop{transfertypes.NewHop(packet.GetDestPort(), packet.GetDestChannel())}
445448
transferData.Token.Denom.Trace = append(trace, transferData.Token.Denom.Trace...)
446449
}

0 commit comments

Comments
 (0)