diff --git a/examples/basecoin/app/app.go b/examples/basecoin/app/app.go index 5e3e63746..8a4f4810d 100644 --- a/examples/basecoin/app/app.go +++ b/examples/basecoin/app/app.go @@ -63,9 +63,6 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB) *BasecoinApp { &types.AppAccount{}, // prototype ).Seal() - // Define the feeHandler. - app.feeHandler = func(ctx sdk.Context, fees sdk.Coins) {} - // Add handlers. coinKeeper := bank.NewCoinKeeper(app.accountMapper) ibcMapper := ibc.NewIBCMapper(app.cdc, app.capKeyIBCStore) @@ -75,6 +72,9 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB) *BasecoinApp { AddRoute("ibc", ibc.NewHandler(ibcMapper, coinKeeper)). AddRoute("simplestake", simplestake.NewHandler(stakeKeeper)) + // Define the feeHandler. + app.feeHandler = func(ctx sdk.Context, tx sdk.Tx, fees sdk.Coins) {} + // Initialize BaseApp. app.SetTxDecoder(app.txDecoder) app.SetInitChainer(app.initChainer) diff --git a/examples/democoin/app/app.go b/examples/democoin/app/app.go index 8954411f6..85ed50b30 100644 --- a/examples/democoin/app/app.go +++ b/examples/democoin/app/app.go @@ -68,9 +68,6 @@ func NewDemocoinApp(logger log.Logger, db dbm.DB) *DemocoinApp { &types.AppAccount{}, // prototype ).Seal() - // Define the feeHandler. - app.feeHandler = func(ctx sdk.Context, fee sdk.Coins) {} - // Add handlers. coinKeeper := bank.NewCoinKeeper(app.accountMapper) coolKeeper := cool.NewKeeper(app.capKeyMainStore, coinKeeper) @@ -85,6 +82,9 @@ func NewDemocoinApp(logger log.Logger, db dbm.DB) *DemocoinApp { AddRoute("ibc", ibc.NewHandler(ibcMapper, coinKeeper)). AddRoute("simplestake", simplestake.NewHandler(stakeKeeper)) + // Define the feeHandler. + app.feeHandler = func(ctx sdk.Context, tx sdk.Tx, fee sdk.Coins) {} + // Initialize BaseApp. app.SetTxDecoder(app.txDecoder) app.SetInitChainer(app.initChainerFn(coolKeeper, powKeeper)) diff --git a/types/handler.go b/types/handler.go index 6127c52d7..679a3b1a7 100644 --- a/types/handler.go +++ b/types/handler.go @@ -4,7 +4,7 @@ package types type Handler func(ctx Context, msg Msg) Result // core function variable which application runs to handle fees -type FeeHandler func(ctx Context, fee Coins) +type FeeHandler func(ctx Context, tx Tx, fee Coins) // If newCtx.IsZero(), ctx is used instead. type AnteHandler func(ctx Context, tx Tx) (newCtx Context, result Result, abort bool) diff --git a/x/auth/ante.go b/x/auth/ante.go index 9db714196..dc756e360 100644 --- a/x/auth/ante.go +++ b/x/auth/ante.go @@ -74,7 +74,7 @@ func NewAnteHandler(accountMapper sdk.AccountMapper, feeHandler sdk.FeeHandler) // TODO: min fee if !fee.Amount.IsZero() { signerAcc, res = deductFees(signerAcc, fee) - feeHandler(ctx, fee.Amount) + feeHandler(ctx, tx, fee.Amount) if !res.IsOK() { return ctx, res, true } diff --git a/x/auth/ante_test.go b/x/auth/ante_test.go index ae12cd6cd..8445c1448 100644 --- a/x/auth/ante_test.go +++ b/x/auth/ante_test.go @@ -12,7 +12,7 @@ import ( wire "github.com/cosmos/cosmos-sdk/wire" ) -func nopFeeHandler(ctx sdk.Context, fee sdk.Coins) { +func nopFeeHandler(ctx sdk.Context, tx sdk.Tx, fee sdk.Coins) { } func newTestMsg(addrs ...sdk.Address) *sdk.TestMsg {