Skip to content

Commit

Permalink
add ak
Browse files Browse the repository at this point in the history
  • Loading branch information
aljo242 committed Nov 15, 2023
1 parent cb00ab4 commit 36ebe05
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
3 changes: 1 addition & 2 deletions x/feemarket/ante/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func (dfd FeeMarketDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo
}

minGasPricesDec := sdk.NewDecCoinsFromCoins(minGasPrices...)
ctx = ctx.WithMinGasPrices(minGasPricesDec)

fee := feeTx.GetFee()
if !simulate {
Expand All @@ -69,7 +68,7 @@ func (dfd FeeMarketDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo
return ctx, err
}

newCtx := ctx.WithPriority(priority)
newCtx := ctx.WithPriority(priority).WithMinGasPrices(minGasPricesDec)
return next(newCtx, tx, simulate)
}

Expand Down
14 changes: 14 additions & 0 deletions x/feemarket/keeper/keeper.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package keeper

import (
"fmt"

"github.com/cometbft/cometbft/libs/log"
"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
Expand All @@ -12,6 +14,7 @@ import (
type Keeper struct {
cdc codec.BinaryCodec
storeKey storetypes.StoreKey
ak types.AccountKeeper

// The address that is capable of executing a MsgParams message.
// Typically, this will be the governance module's address.
Expand All @@ -22,11 +25,22 @@ type Keeper struct {
func NewKeeper(
cdc codec.BinaryCodec,
storeKey storetypes.StoreKey,
authKeeper types.AccountKeeper,
authority string,
) *Keeper {
// ensure governance module account is set
if addr := authKeeper.GetModuleAddress(types.FeeCollectorName); addr == nil {
panic(fmt.Sprintf("%s module account has not been set", types.ModuleName))
}

if _, err := sdk.AccAddressFromBech32(authority); err != nil {
panic(fmt.Sprintf("invalid authority address: %s", authority))
}

k := &Keeper{
cdc,
storeKey,
authKeeper,
authority,
}

Expand Down
14 changes: 14 additions & 0 deletions x/feemarket/types/expected_keepers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package types

import (
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)

// AccountKeeper defines the expected account keeper (noalias)
type AccountKeeper interface {
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI

GetModuleAddress(name string) sdk.AccAddress
GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI
}
3 changes: 3 additions & 0 deletions x/feemarket/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ const (
ModuleName = "feemarket"
// StoreKey is the store key string for the feemarket module.
StoreKey = ModuleName

// FeeCollectorName the root string for the fee market fee collector account address.
FeeCollectorName = "feemarket-fee-collector"
)

const (
Expand Down

0 comments on commit 36ebe05

Please sign in to comment.