Skip to content

Commit

Permalink
chore(migration) add interfaces to ante pkg (evmos#1337)
Browse files Browse the repository at this point in the history
* chore(migration) start import migration

* chore(migration) fix lint issues
  • Loading branch information
GAtom22 authored Feb 3, 2023
1 parent 10dcd8a commit d959e92
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/ante/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ type HandlerOptions struct {
BankKeeper evmtypes.BankKeeper
IBCKeeper *ibckeeper.Keeper
StakingKeeper vestingtypes.StakingKeeper
FeeMarketKeeper ethante.FeeMarketKeeper
EvmKeeper ethante.EVMKeeper
FeeMarketKeeper FeeMarketKeeper
EvmKeeper EVMKeeper
FeegrantKeeper ante.FeegrantKeeper
ExtensionOptionChecker ante.ExtensionOptionChecker
SignModeHandler authsigning.SignModeHandler
Expand Down
31 changes: 28 additions & 3 deletions app/ante/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,38 @@ import (
"math/big"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/params"
"github.com/evmos/ethermint/x/evm/statedb"
evmtypes "github.com/evmos/ethermint/x/evm/types"
evm "github.com/evmos/ethermint/x/evm/vm"
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"
)

// EvmKeeper defines the expected keeper interface used on the AnteHandler
type EvmKeeper interface {
GetParams(ctx sdk.Context) (params evmtypes.Params)
// EVMKeeper defines the expected keeper interface used on the AnteHandler
type EVMKeeper interface {
statedb.Keeper
DynamicFeeEVMKeeper

NewEVM(ctx sdk.Context, msg core.Message, cfg *statedb.EVMConfig, tracer vm.EVMLogger, stateDB vm.StateDB) evm.EVM
DeductTxCostsFromUserBalance(ctx sdk.Context, fees sdk.Coins, from common.Address) error
GetBalance(ctx sdk.Context, addr common.Address) *big.Int
ResetTransientGasUsed(ctx sdk.Context)
GetTxIndexTransient(ctx sdk.Context) uint64
GetParams(ctx sdk.Context) evmtypes.Params
}

type FeeMarketKeeper interface {
GetParams(ctx sdk.Context) (params feemarkettypes.Params)
AddTransientGasWanted(ctx sdk.Context, gasWanted uint64) (uint64, error)
GetBaseFeeEnabled(ctx sdk.Context) bool
}

// 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
}
2 changes: 1 addition & 1 deletion app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
tmtypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"

"github.com/evmos/ethermint/encoding"
"github.com/evmos/evmos/v11/encoding"
"github.com/evmos/evmos/v11/types"
claimstypes "github.com/evmos/evmos/v11/x/claims/types"
)
Expand Down
38 changes: 32 additions & 6 deletions client/docs/statik/init.go → version/version.go
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,38 @@
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Evmos packages. If not, see https://github.com/evmos/evmos/blob/main/LICENSE
package version

package statik
import (
"fmt"
"runtime"
)

// unnamed import of statik for swagger UI support
// override ethermint statik by importing it
//nolint
import _ "github.com/evmos/ethermint/client/docs/statik"
var (
AppVersion = ""
GitCommit = ""
BuildDate = ""

// This just for fixing the error in importing empty github.com/evmos/ethermint/client/docs/statik
GoVersion = ""
GoArch = ""
)

func init() {
if len(AppVersion) == 0 {
AppVersion = "dev"
}

GoVersion = runtime.Version()
GoArch = runtime.GOARCH
}

func Version() string {
return fmt.Sprintf(
"Version %s (%s)\nCompiled at %s using Go %s (%s)",
AppVersion,
GitCommit,
BuildDate,
GoVersion,
GoArch,
)
}

0 comments on commit d959e92

Please sign in to comment.