From 17f1239b374522b0b50c58b2c68b058715592c57 Mon Sep 17 00:00:00 2001 From: vuong177 Date: Thu, 26 Oct 2023 16:50:58 +0700 Subject: [PATCH] add fee ante handler --- app/ante/ante.go | 9 +++++++-- app/app.go | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/ante/ante.go b/app/ante/ante.go index 706db39..360fa00 100644 --- a/app/ante/ante.go +++ b/app/ante/ante.go @@ -9,7 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ante "github.com/cosmos/cosmos-sdk/x/auth/ante" "github.com/cosmos/cosmos-sdk/x/auth/signing" - + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" tfmwKeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper" txBoundaryAnte "github.com/notional-labs/composable/v6/x/tx-boundary/ante" txBoundaryKeeper "github.com/notional-labs/composable/v6/x/tx-boundary/keeper" @@ -18,8 +18,11 @@ import ( // Link to default ante handler used by cosmos sdk: // https://github.com/cosmos/cosmos-sdk/blob/v0.43.0/x/auth/ante/ante.go#L41 func NewAnteHandler( - _ servertypes.AppOptions, + options servertypes.AppOptions, ak ante.AccountKeeper, + bk authtypes.BankKeeper, + feegrantKeeper ante.FeegrantKeeper, + txFeeChecker ante.TxFeeChecker, sigGasConsumer ante.SignatureVerificationGasConsumer, signModeHandler signing.SignModeHandler, channelKeeper *ibckeeper.Keeper, @@ -30,6 +33,8 @@ func NewAnteHandler( return sdk.ChainAnteDecorators( ante.NewSetUpContextDecorator(), // // outermost AnteDecorator. SetUpContext must be called first ante.NewValidateBasicDecorator(), + ante.NewConsumeGasForTxSizeDecorator(ak), + ante.NewDeductFeeDecorator(ak, bk, feegrantKeeper, txFeeChecker), ante.NewTxTimeoutHeightDecorator(), ante.NewValidateMemoDecorator(ak), ante.NewConsumeGasForTxSizeDecorator(ak), diff --git a/app/app.go b/app/app.go index 10186ec..45b7ccd 100644 --- a/app/app.go +++ b/app/app.go @@ -538,6 +538,9 @@ func NewComposableApp( app.SetAnteHandler(ante.NewAnteHandler( appOpts, app.AccountKeeper, + app.BankKeeper, + app.FeeGrantKeeper, + nil, authante.DefaultSigVerificationGasConsumer, encodingConfig.TxConfig.SignModeHandler(), app.IBCKeeper,