2022-01-02 22:44:46 +00:00
|
|
|
package ante
|
|
|
|
|
|
|
|
import (
|
|
|
|
"math/big"
|
|
|
|
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
tx "github.com/cosmos/cosmos-sdk/types/tx"
|
2022-01-05 18:18:02 +00:00
|
|
|
"github.com/ethereum/go-ethereum/common"
|
2022-01-02 22:44:46 +00:00
|
|
|
"github.com/ethereum/go-ethereum/core"
|
|
|
|
"github.com/ethereum/go-ethereum/core/vm"
|
|
|
|
"github.com/ethereum/go-ethereum/params"
|
2022-06-19 09:43:41 +00:00
|
|
|
"github.com/evmos/ethermint/x/evm/statedb"
|
|
|
|
evmtypes "github.com/evmos/ethermint/x/evm/types"
|
2022-09-15 11:54:02 +00:00
|
|
|
evm "github.com/evmos/ethermint/x/evm/vm"
|
2022-06-19 09:43:41 +00:00
|
|
|
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"
|
2022-01-02 22:44:46 +00:00
|
|
|
)
|
|
|
|
|
2022-08-10 22:33:38 +00:00
|
|
|
// DynamicFeeEVMKeeper is a subset of EVMKeeper interface that supports dynamic fee checker
|
|
|
|
type DynamicFeeEVMKeeper interface {
|
|
|
|
ChainID() *big.Int
|
|
|
|
GetParams(ctx sdk.Context) evmtypes.Params
|
|
|
|
GetBaseFee(ctx sdk.Context, ethCfg *params.ChainConfig) *big.Int
|
|
|
|
}
|
|
|
|
|
2022-01-02 22:44:46 +00:00
|
|
|
// EVMKeeper defines the expected keeper interface used on the Eth AnteHandler
|
|
|
|
type EVMKeeper interface {
|
2022-01-05 07:28:27 +00:00
|
|
|
statedb.Keeper
|
2022-08-10 22:33:38 +00:00
|
|
|
DynamicFeeEVMKeeper
|
2022-01-02 22:44:46 +00:00
|
|
|
|
2022-09-15 11:54:02 +00:00
|
|
|
NewEVM(ctx sdk.Context, msg core.Message, cfg *evmtypes.EVMConfig, tracer vm.EVMLogger, stateDB vm.StateDB) evm.EVM
|
2022-01-02 22:44:46 +00:00
|
|
|
DeductTxCostsFromUserBalance(
|
|
|
|
ctx sdk.Context, msgEthTx evmtypes.MsgEthereumTx, txData evmtypes.TxData, denom string, homestead, istanbul, london bool,
|
2022-08-05 13:00:31 +00:00
|
|
|
) (fees sdk.Coins, priority int64, err error)
|
2022-01-05 18:18:02 +00:00
|
|
|
GetBalance(ctx sdk.Context, addr common.Address) *big.Int
|
2022-01-14 09:37:33 +00:00
|
|
|
ResetTransientGasUsed(ctx sdk.Context)
|
2022-05-31 10:26:40 +00:00
|
|
|
GetTxIndexTransient(ctx sdk.Context) uint64
|
2022-10-19 16:21:59 +00:00
|
|
|
GetChainConfig(ctx sdk.Context) evmtypes.ChainConfig
|
|
|
|
GetEVMDenom(ctx sdk.Context) string
|
|
|
|
GetEnableCreate(ctx sdk.Context) bool
|
|
|
|
GetEnableCall(ctx sdk.Context) bool
|
|
|
|
GetAllowUnprotectedTxs(ctx sdk.Context) bool
|
2022-01-02 22:44:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type protoTxProvider interface {
|
|
|
|
GetProtoTx() *tx.Tx
|
|
|
|
}
|
2022-05-31 16:28:46 +00:00
|
|
|
|
|
|
|
// FeeMarketKeeper defines the expected keeper interface used on the AnteHandler
|
|
|
|
type FeeMarketKeeper interface {
|
|
|
|
GetParams(ctx sdk.Context) (params feemarkettypes.Params)
|
2022-06-05 09:22:33 +00:00
|
|
|
AddTransientGasWanted(ctx sdk.Context, gasWanted uint64) (uint64, error)
|
2022-10-19 16:21:59 +00:00
|
|
|
GetBaseFeeEnabled(ctx sdk.Context) bool
|
2022-05-31 16:28:46 +00:00
|
|
|
}
|