diff --git a/precompiles/precompiles.go b/precompiles/precompiles.go index 1e76a7c69e..ad5eb55c50 100644 --- a/precompiles/precompiles.go +++ b/precompiles/precompiles.go @@ -31,8 +31,8 @@ func StatefulContracts( // Define the regular contract function. if EnabledStatefulContracts[prototype.ContractAddress] { - prototype := func(ctx sdktypes.Context, _ ethparams.Rules) vm.PrecompiledContract { - return prototype.NewIPrototypeContract(ctx, fungibleKeeper, cdc, gasConfig) + prototype := func(_ sdktypes.Context, _ ethparams.Rules) vm.PrecompiledContract { + return prototype.NewIPrototypeContract(fungibleKeeper, cdc, gasConfig) } // Append the regular contract to the precompiledContracts slice. diff --git a/precompiles/prototype/prototype.go b/precompiles/prototype/prototype.go index 6152601c3f..db3d920422 100644 --- a/precompiles/prototype/prototype.go +++ b/precompiles/prototype/prototype.go @@ -65,22 +65,19 @@ func init() { type Contract struct { ptypes.BaseContract - Ctx sdk.Context - FungibleKeeper fungiblekeeper.Keeper + fungibleKeeper fungiblekeeper.Keeper cdc codec.Codec kvGasConfig storetypes.GasConfig } func NewIPrototypeContract( - context sdk.Context, fungibleKeeper *fungiblekeeper.Keeper, cdc codec.Codec, kvGasConfig storetypes.GasConfig, ) *Contract { return &Contract{ - Ctx: context, BaseContract: ptypes.NewBaseContract(ContractAddress), - FungibleKeeper: *fungibleKeeper, + fungibleKeeper: *fungibleKeeper, cdc: cdc, kvGasConfig: kvGasConfig, } @@ -213,7 +210,7 @@ func (c *Contract) GetGasStabilityPoolBalance( } } - balance, err := c.FungibleKeeper.GetGasStabilityPoolBalance(ctx, chainID) + balance, err := c.fungibleKeeper.GetGasStabilityPoolBalance(ctx, chainID) if err != nil { return nil, fmt.Errorf("error calling fungible keeper: %s", err.Error()) } diff --git a/precompiles/prototype/prototype_test.go b/precompiles/prototype/prototype_test.go index c809c33789..f42de48234 100644 --- a/precompiles/prototype/prototype_test.go +++ b/precompiles/prototype/prototype_test.go @@ -14,6 +14,7 @@ func Test_IPrototypeContract(t *testing.T) { /* Configuration */ + var encoding ethermint.EncodingConfig appCodec := encoding.Codec k, ctx, _, _ := keeper.FungibleKeeper(t) @@ -24,7 +25,7 @@ func Test_IPrototypeContract(t *testing.T) { */ // Create a new IPrototypeContract instance and get Address and Abi. - contract := NewIPrototypeContract(ctx, k, appCodec, gasConfig) + contract := NewIPrototypeContract(k, appCodec, gasConfig) require.NotNil(t, contract, "NewIPrototypeContract() should not return a nil contract") address := contract.Address()