Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add module feeburn #156

Merged
merged 12 commits into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions app/ante/handler_options.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ante

import (
feeBurnKeeper "github.com/AstraProtocol/astra/v2/x/feeburn/keeper"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand All @@ -14,6 +15,8 @@ import (
ethante "github.com/evmos/ethermint/app/ante"
evmtypes "github.com/evmos/ethermint/x/evm/types"

feeburnante "github.com/AstraProtocol/astra/v2/x/feeburn/ante"
feeburntypes "github.com/AstraProtocol/astra/v2/x/feeburn/types"
vestingtypes "github.com/evmos/evmos/v6/x/vesting/types"
)

Expand All @@ -22,11 +25,13 @@ import (
type HandlerOptions struct {
AccountKeeper evmtypes.AccountKeeper
BankKeeper evmtypes.BankKeeper
BankKeeperFork feeburntypes.BankKeeper
IBCKeeper *ibckeeper.Keeper
FeeMarketKeeper evmtypes.FeeMarketKeeper
StakingKeeper vestingtypes.StakingKeeper
EvmKeeper ethante.EVMKeeper
FeegrantKeeper ante.FeegrantKeeper
FeeBurnKeeper feeBurnKeeper.Keeper
SignModeHandler authsigning.SignModeHandler
SigGasConsumer func(meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params) error
Cdc codec.BinaryCodec
Expand Down Expand Up @@ -59,8 +64,9 @@ func (options HandlerOptions) Validate() error {
// newCosmosAnteHandler creates the default ante handler for Ethereum transactions
func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler {
return sdk.ChainAnteDecorators(
ethante.NewEthSetUpContextDecorator(options.EvmKeeper), // outermost AnteDecorator. SetUpContext must be called first
ethante.NewEthMempoolFeeDecorator(options.EvmKeeper), // Check eth effective gas price against minimal-gas-prices
ethante.NewEthSetUpContextDecorator(options.EvmKeeper), // outermost AnteDecorator. SetUpContext must be called first
ethante.NewEthMempoolFeeDecorator(options.EvmKeeper), // Check eth effective gas price against minimal-gas-prices
ethante.NewEthMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper), // Check eth effective gas price against the global MinGasPrice
ethante.NewEthValidateBasicDecorator(options.EvmKeeper),
ethante.NewEthSigVerificationDecorator(options.EvmKeeper),
ethante.NewEthAccountVerificationDecorator(options.AccountKeeper, options.EvmKeeper),
Expand All @@ -80,11 +86,13 @@ func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler {
ante.NewSetUpContextDecorator(),
ante.NewRejectExtensionOptionsDecorator(),
ante.NewMempoolFeeDecorator(),
ethante.NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
feeburnante.NewFeeBurnDecorator(options.BankKeeperFork, options.FeeBurnKeeper),
NewVestingDelegationDecorator(options.AccountKeeper, options.StakingKeeper, options.Cdc),
NewValidatorCommissionDecorator(options.Cdc),
// SetPubKeyDecorator must be called before all signature verification decorators
Expand All @@ -105,10 +113,12 @@ func newCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler {
ante.NewSetUpContextDecorator(),
ante.NewMempoolFeeDecorator(),
ante.NewValidateBasicDecorator(),
ethante.NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
feeburnante.NewFeeBurnDecorator(options.BankKeeperFork, options.FeeBurnKeeper),
NewVestingDelegationDecorator(options.AccountKeeper, options.StakingKeeper, options.Cdc),
NewValidatorCommissionDecorator(options.Cdc),
// SetPubKeyDecorator must be called before all signature verification decorators
Expand Down
Loading