Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: subtract bonded token error #858

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions projection/ibc_channel/ibc_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ func (projection *IBCChannel) HandleEvents(height int64, events []event_entity.E
sourceChannelID := msgIBCTransferTransfer.Params.SourceChannel
sourcePortID := msgIBCTransferTransfer.Params.SourcePort

if err := updateBondedTokensWhenMsgIBCTransfer(
if err := projection.updateBondedTokensWhenMsgIBCTransfer(
ibcChannelsView,
channelID,
amount,
Expand Down Expand Up @@ -506,7 +506,7 @@ func (projection *IBCChannel) HandleEvents(height int64, events []event_entity.E
sourceChannelID := msgIBCRecvPacket.Params.Packet.SourceChannel
sourcePortID := msgIBCRecvPacket.Params.Packet.SourcePort

if err := updateBondedTokensWhenMsgIBCRecvPacket(
if err := projection.updateBondedTokensWhenMsgIBCRecvPacket(
ibcChannelsView,
ibcDenomHashMappingView,
channelID,
Expand Down Expand Up @@ -826,7 +826,7 @@ func (projection *IBCChannel) HandleEvents(height int64, events []event_entity.E
return nil
}

func updateBondedTokensWhenMsgIBCRecvPacket(
func (projection *IBCChannel) updateBondedTokensWhenMsgIBCRecvPacket(
ibcChannelsView ibc_channel_view.IBCChannels,
ibcDenomHashMappingView ibc_channel_view.IBCDenomHashMapping,
channelID string,
Expand All @@ -853,7 +853,7 @@ func updateBondedTokensWhenMsgIBCRecvPacket(
// Subtract it from the bondedTokens.OnCounterpartyChain
token := ibc_channel_view.NewBondedToken(denom, amountInCoinInt)
if subtractErr := subtractTokenOnCounterpartyChain(bondedTokens, token); subtractErr != nil {
return fmt.Errorf("error subtractTokenOnCounterpartyChain: %v", subtractErr)
projection.logger.Warnf("error subtractTokenOnCounterpartyChain: %v", subtractErr)
}
} else {
// Counterparty chain is token source, it is bonded to this chain now.
Expand All @@ -875,7 +875,7 @@ func updateBondedTokensWhenMsgIBCRecvPacket(
return nil
}

func updateBondedTokensWhenMsgIBCTransfer(
func (projection *IBCChannel) updateBondedTokensWhenMsgIBCTransfer(
ibcChannelsView ibc_channel_view.IBCChannels,
channelID string,
amount string,
Expand All @@ -901,7 +901,7 @@ func updateBondedTokensWhenMsgIBCTransfer(
// Subtract it from the bondedTokens.OnThisChain
token := ibc_channel_view.NewBondedToken(denom, amountInCoinInt)
if subtractErr := subtractTokenOnThisChain(bondedTokens, token); subtractErr != nil {
return fmt.Errorf("error subtractTokenOnThisChain: %v", subtractErr)
projection.logger.Warnf("error subtractTokenOnThisChain: %v", subtractErr)
}
} else {
// This chain is token source, it is bonded to counterparty chain now.
Expand Down
Loading