Skip to content

Commit

Permalink
ibc-go/v7 v7.3.1 & regen mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Oct 25, 2023
1 parent c6cd8ef commit 96cf752
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion middleware/packet-forward-middleware/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/cometbft/cometbft-db v0.8.0
github.com/cosmos/cosmos-sdk v0.47.5
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/ibc-go/v7 v7.3.0
github.com/cosmos/ibc-go/v7 v7.3.1
github.com/golang/protobuf v1.5.3
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
Expand Down
4 changes: 2 additions & 2 deletions middleware/packet-forward-middleware/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoK
github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek=
github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg=
github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A=
github.com/cosmos/ibc-go/v7 v7.3.0 h1:QtGeVMi/3JeLWuvEuC60sBHpAF40Oenx/y+bP8+wRRw=
github.com/cosmos/ibc-go/v7 v7.3.0/go.mod h1:mUmaHFXpXrEdcxfdXyau+utZf14pGKVUiXwYftRZZfQ=
github.com/cosmos/ibc-go/v7 v7.3.1 h1:bil1IjnHdyWDASFYKfwdRiNtFP6WK3osW7QFEAgU4I8=
github.com/cosmos/ibc-go/v7 v7.3.1/go.mod h1:wvx4pPBofe5ZdMNV3OFRxSI4auEP5Qfqf8JXLLNV04g=
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=
github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0=
github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ func (k *Keeper) WriteAcknowledgementForForwardedPacket(
panic(fmt.Sprintf("cannot burn coins after a successful send from escrow account to module account: %v", err))
}
}

// We move funds from the escrowAddress in both cases,
// update the total escrow amount for the denom.
k.unescrowToken(ctx, token)
}
}

Expand All @@ -197,6 +201,14 @@ func (k *Keeper) WriteAcknowledgementForForwardedPacket(
}, ack)
}

// unescrowToken will update the total escrow by deducting the unescrowed token
// from the current total escrow.
func (k *Keeper) unescrowToken(ctx sdk.Context, token sdk.Coin) {
currentTotalEscrow := k.transferKeeper.GetTotalEscrowForDenom(ctx, token.GetDenom())
newTotalEscrow := currentTotalEscrow.Sub(token)
k.transferKeeper.SetTotalEscrowForDenom(ctx, newTotalEscrow)
}

func (k *Keeper) ForwardTransferPacket(
ctx sdk.Context,
inFlightPacket *types.InFlightPacket,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
type TransferKeeper interface {
Transfer(ctx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error)
DenomPathFromHash(ctx sdk.Context, denom string) (string, error)
GetTotalEscrowForDenom(ctx sdk.Context, denom string) sdk.Coin
SetTotalEscrowForDenom(ctx sdk.Context, coin sdk.Coin)
}

// ChannelKeeper defines the expected IBC channel keeper
Expand Down
26 changes: 26 additions & 0 deletions middleware/packet-forward-middleware/test/mock/transfer_keeper.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 96cf752

Please sign in to comment.