Skip to content

Commit

Permalink
fix: transfer sender coins when liquidity is sufficient (#578)
Browse files Browse the repository at this point in the history
Co-authored-by: fx0x55 <80245546+fx0x55@users.noreply.github.com>
  • Loading branch information
zakir-code and fx0x55 committed Jun 25, 2024
1 parent 5f63d2f commit 7b5e453
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions x/crosschain/keeper/pending_bridge_call_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ func (k Keeper) HandlePendingOutgoingBridgeCall(ctx sdk.Context, liquidityProvid
return true
}

for _, coin := range notLiquidCoins {
if err = k.TransferBridgeCoinToExternal(iterCtx, sender, coin); err != nil {
k.Logger(iterCtx).Info("failed to transfer bridge coin to external", "error", err)
return true
}
}

// 4. remove pending outgoing tx
k.DeletePendingOutgoingBridgeCall(iterCtx, bridgeCall.Nonce)

Expand Down Expand Up @@ -167,6 +174,9 @@ func (k Keeper) transferLiquidityProviderRewards(ctx sdk.Context, liquidityProvi
}

for _, reward := range rewards {
if reward.Denom == fxtypes.DefaultDenom {
continue
}
if _, err := k.erc20Keeper.ConvertDenomToTarget(ctx, liquidityProvider, reward, fxtypes.ParseFxTarget(fxtypes.ERC20Target)); err != nil {
k.Logger(ctx).Info("failed to convert reward to target coin", "error", err)
return err
Expand Down

0 comments on commit 7b5e453

Please sign in to comment.