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

protorev: Remove unneeded AllBalances call #7605

Merged
merged 1 commit into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions x/concentrated-liquidity/swaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -881,8 +881,8 @@ func (k Keeper) ComputeMaxInAmtGivenMaxTicksCrossed(
// Initialize swap state
// Utilize the total amount of tokenOutDenom in the pool as the specified amountOut, since we want
// the limitation to be the tick crossing, not the amountOut.
balances := k.bankKeeper.GetAllBalances(ctx, p.GetAddress())
swapState := newSwapState(balances.AmountOf(tokenOutDenom), p, swapStrategy)
balance := k.bankKeeper.GetBalance(ctx, p.GetAddress(), tokenOutDenom)
swapState := newSwapState(balance.Amount, p, swapStrategy)

nextInitTickIter := swapStrategy.InitializeNextTickIterator(cacheCtx, poolId, swapState.tick)
defer nextInitTickIter.Close()
Expand Down
1 change: 1 addition & 0 deletions x/concentrated-liquidity/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type AccountKeeper interface {
// BankKeeper defines the banking contract that must be fulfilled when
// creating a x/concentrated-liquidity keeper.
type BankKeeper interface {
GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
Comment on lines +22 to 23
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is GetAllBalances still needed or can be removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, let me check

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need it for a query

GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool)
SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
Expand Down