/
ante.go
27 lines (25 loc) · 1.31 KB
/
ante.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package ante
import (
sdk "github.com/cosmos/cosmos-sdk/types"
cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/types"
)
// NewAnteHandler returns an AnteHandler that checks and increments sequence
// numbers, checks signatures & account numbers, and deducts fees from the first
// signer.
func NewAnteHandler(ak keeper.AccountKeeper, supplyKeeper types.SupplyKeeper, treasuryKeeper TreasuryKeeper, sigGasConsumer cosmosante.SignatureVerificationGasConsumer) sdk.AnteHandler {
return sdk.ChainAnteDecorators(
cosmosante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
NewTaxFeeDecorator(treasuryKeeper), // mempool gas fee validation & record tax proceeds
cosmosante.NewValidateBasicDecorator(),
cosmosante.NewValidateMemoDecorator(ak),
cosmosante.NewConsumeGasForTxSizeDecorator(ak),
cosmosante.NewSetPubKeyDecorator(ak), // SetPubKeyDecorator must be called before all signature verification decorators
cosmosante.NewValidateSigCountDecorator(ak),
cosmosante.NewDeductFeeDecorator(ak, supplyKeeper),
cosmosante.NewSigGasConsumeDecorator(ak, sigGasConsumer),
cosmosante.NewSigVerificationDecorator(ak),
cosmosante.NewIncrementSequenceDecorator(ak), // innermost AnteDecorator
)
}