Skip to content

Commit

Permalink
fix: protorev throws a nil pointer (#8663) (#8664)
Browse files Browse the repository at this point in the history
* fix: protorev throws a nil pointer

* chore: add changelog entry

* fix: pre allocate the zero int

(cherry picked from commit 362a01b)

Co-authored-by: PaddyMc <[email protected]>
  • Loading branch information
mergify[bot] and PaddyMc authored Sep 2, 2024
1 parent 45f3b8a commit eff19c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#8616](https://github.com/osmosis-labs/osmosis/pull/8616) chore: upgrade wasmd to v0.53.0 and wasmvm to v2.1.2
* [#8628](https://github.com/osmosis-labs/osmosis/pull/8628) chore: add tagged cometbft version: v0.38.11-v26-osmo-1
* [#8649](https://github.com/osmosis-labs/osmosis/pull/8649) chore: update to tagged submodules
* [#8663](https://github.com/osmosis-labs/osmosis/pull/8663) fix: protorev throws a nil pointer

### Config

Expand Down
4 changes: 3 additions & 1 deletion x/poolmanager/taker_fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
txfeestypes "github.com/osmosis-labs/osmosis/v26/x/txfees/types"
)

var zero = osmomath.ZeroInt()

func (k *Keeper) GetDefaultTakerFee(ctx sdk.Context) osmomath.Dec {
defaultTakerFeeBz := k.paramSpace.GetRaw(ctx, types.KeyDefaultTakerFee)
if !bytes.Equal(defaultTakerFeeBz, k.defaultTakerFeeBz) {
Expand Down Expand Up @@ -134,7 +136,7 @@ func (k Keeper) chargeTakerFee(ctx sdk.Context, tokenIn sdk.Coin, tokenOutDenom

// Determine if eligible to bypass taker fee.
if osmoutils.Contains(reducedFeeWhitelist, sender.String()) {
return tokenIn, sdk.Coin{}, nil
return tokenIn, sdk.Coin{Denom: tokenIn.Denom, Amount: zero}, nil
}

takerFee, err := k.GetTradingPairTakerFee(ctx, tokenIn.Denom, tokenOutDenom)
Expand Down

0 comments on commit eff19c2

Please sign in to comment.