Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Merge PR #19: quick writeup of send-back logic
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaSripal authored Apr 27, 2022
1 parent eba1875 commit 8834cbe
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion router/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,19 @@ func (am AppModule) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, re
// recalculate denom, skip checks that were already done in app.OnRecvPacket
var denom string
if transfertypes.ReceiverChainIsSource(packet.GetSourcePort(), packet.GetSourceChannel(), newData.Denom) {
denom = transfertypes.ParseDenomTrace(newData.Denom).IBCDenom()
// remove prefix added by sender chain
voucherPrefix := transfertypes.GetDenomPrefix(packet.GetSourcePort(), packet.GetSourceChannel())
unprefixedDenom := newData.Denom[len(voucherPrefix):]

// coin denomination used in sending from the escrow address
denom = unprefixedDenom

// The denomination used to send the coins is either the native denom or the hash of the path
// if the denomination is not native.
denomTrace := transfertypes.ParseDenomTrace(unprefixedDenom)
if denomTrace.Path != "" {
denom = denomTrace.IBCDenom()
}
} else {
prefixedDenom := transfertypes.GetDenomPrefix(packet.GetDestPort(), packet.GetDestChannel()) + newData.Denom
denom = transfertypes.ParseDenomTrace(prefixedDenom).IBCDenom()
Expand Down

0 comments on commit 8834cbe

Please sign in to comment.