diff --git a/app/app.go b/app/app.go index 17cb6e3c..d16b2eb0 100644 --- a/app/app.go +++ b/app/app.go @@ -611,6 +611,8 @@ func New( keys[logicmoduletypes.StoreKey], keys[logicmoduletypes.MemStoreKey], app.GetSubspace(logicmoduletypes.ModuleName), + app.AccountKeeper, + app.BankKeeper, ) logicModule := logicmodule.NewAppModule(appCodec, app.LogicKeeper, app.AccountKeeper, app.BankKeeper) diff --git a/testutil/keeper/logic.go b/testutil/keeper/logic.go index 0f30b7c7..4536efb7 100644 --- a/testutil/keeper/logic.go +++ b/testutil/keeper/logic.go @@ -41,6 +41,8 @@ func LogicKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { storeKey, memStoreKey, paramsSubspace, + nil, + nil, ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) diff --git a/x/logic/keeper/interpreter.go b/x/logic/keeper/interpreter.go index e52ad071..6a83187e 100644 --- a/x/logic/keeper/interpreter.go +++ b/x/logic/keeper/interpreter.go @@ -98,6 +98,9 @@ func (k Keeper) newInterpreter(ctx goctx.Context) (*prolog.Interpreter, goctx.Co interpreterParams := params.GetInterpreter() limitContext, inc := k.withLimitContext(ctx) + limitContext = goctx.WithValue(limitContext, types.AuthKeeperContextKey, k.authKeeper) + limitContext = goctx.WithValue(limitContext, types.BankKeeperContextKey, k.bankKeeper) + interpreted, err := interpreter.New( limitContext, util.NonZeroOrDefault(interpreterParams.GetRegisteredPredicates(), interpreter.RegistryNames), diff --git a/x/logic/keeper/keeper.go b/x/logic/keeper/keeper.go index 5e54cd90..dfc90e6c 100644 --- a/x/logic/keeper/keeper.go +++ b/x/logic/keeper/keeper.go @@ -17,6 +17,9 @@ type ( storeKey storetypes.StoreKey memKey storetypes.StoreKey paramstore paramtypes.Subspace + + authKeeper types.AccountKeeper + bankKeeper types.BankKeeper } ) @@ -25,6 +28,8 @@ func NewKeeper( storeKey, memKey storetypes.StoreKey, ps paramtypes.Subspace, + authKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -36,6 +41,8 @@ func NewKeeper( storeKey: storeKey, memKey: memKey, paramstore: ps, + authKeeper: authKeeper, + bankKeeper: bankKeeper, } } diff --git a/x/logic/types/context.go b/x/logic/types/context.go new file mode 100644 index 00000000..780ae714 --- /dev/null +++ b/x/logic/types/context.go @@ -0,0 +1,11 @@ +package types + +// ContextKey is a type for context keys. +type ContextKey string + +const ( + // AuthKeeperContextKey is the context key for the auth keeper. + AuthKeeperContextKey = ContextKey("authKeeper") + // BankKeeperContextKey is the context key for the bank keeper. + BankKeeperContextKey = ContextKey("bankKeeper") +)