diff --git a/CHANGELOG.md b/CHANGELOG.md index fd4c10f8..f4650001 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,9 +59,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - (ante) [#1717](https://github.com/evmos/ethermint/pull/1717) Reuse sender recovery result. - (cli) [#246](https://github.com/crypto-org-chain/ethermint/pull/246) Call app.Close to cleanup resource on graceful shutdown. - (precompile) [#380](https://github.com/crypto-org-chain/ethermint/pull/380) Allow init precompiled contract with rules when new evm. -- (statedb) [#359](https://github.com/crypto-org-chain/ethermint/pull/359) Add `CacheContext` method to StateDB, to support efficient read-only native actions. -- (evm) [#343](https://github.com/crypto-org-chain/ethermint/pull/343) Add native event converter APIs. - +- (precompile) [#383](https://github.com/crypto-org-chain/ethermint/pull/383) Allow init precompiled contract with ctx. ## [v0.21.0] - 2023-01-26 diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index 8ab8a6be..eee37b79 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -38,8 +38,8 @@ import ( "github.com/evmos/ethermint/x/evm/types" ) -// CustomContractFn defines a custom precompiled contract generator with rules and returns a precompiled contract. -type CustomContractFn func(params.Rules) vm.PrecompiledContract +// CustomContractFn defines a custom precompiled contract generator with ctx, rules and returns a precompiled contract. +type CustomContractFn func(sdk.Context, params.Rules) vm.PrecompiledContract type EventConverter = func([]abci.EventAttribute) []*ethtypes.Log diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index 31aa0a3e..7eea0295 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -79,7 +79,7 @@ func (k *Keeper) NewEVM( active = append(active, addr) } for _, fn := range k.customContractFns { - c := fn(rules) + c := fn(ctx, rules) addr := c.Address() contracts[addr] = c active = append(active, addr)