From 2b7e7bcefee08315f82b82a365fbca8245ba6254 Mon Sep 17 00:00:00 2001 From: ccamel Date: Mon, 9 Jan 2023 18:42:27 +0100 Subject: [PATCH] fix: fix wrong types (was problematic for type assertions) --- x/logic/predicate/block.go | 9 +++++---- x/logic/predicate/chain.go | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/x/logic/predicate/block.go b/x/logic/predicate/block.go index 38ed9d96..55bcde15 100644 --- a/x/logic/predicate/block.go +++ b/x/logic/predicate/block.go @@ -4,6 +4,7 @@ import ( "context" "github.com/ichiban/prolog/engine" + "github.com/okp4/okp4d/x/logic/util" ) // BlockHeight is higher order function that given a context returns the following predicate: @@ -12,9 +13,9 @@ import ( // // where Height represents the current chain height at the time of the query. // The predicate is non-deterministic, producing a different height each time it is called. -func BlockHeight(ctx context.Context) engine.Predicate1 { +func BlockHeight(ctx context.Context) func(*engine.VM, engine.Term, engine.Cont, *engine.Env) *engine.Promise { return func(vm *engine.VM, height engine.Term, cont engine.Cont, env *engine.Env) *engine.Promise { - sdkContext, err := UnwrapSDKContext(ctx) + sdkContext, err := util.UnwrapSDKContext(ctx) if err != nil { return engine.Error(err) } @@ -29,9 +30,9 @@ func BlockHeight(ctx context.Context) engine.Predicate1 { // // where Time represents the current chain time at the time of the query. // The predicate is non-deterministic, producing a different time each time it is called. -func BlockTime(ctx context.Context) engine.Predicate1 { +func BlockTime(ctx context.Context) func(*engine.VM, engine.Term, engine.Cont, *engine.Env) *engine.Promise { return func(vm *engine.VM, time engine.Term, cont engine.Cont, env *engine.Env) *engine.Promise { - sdkContext, err := UnwrapSDKContext(ctx) + sdkContext, err := util.UnwrapSDKContext(ctx) if err != nil { return engine.Error(err) } diff --git a/x/logic/predicate/chain.go b/x/logic/predicate/chain.go index 3bff7f78..f8895ec5 100644 --- a/x/logic/predicate/chain.go +++ b/x/logic/predicate/chain.go @@ -4,6 +4,7 @@ import ( "context" "github.com/ichiban/prolog/engine" + "github.com/okp4/okp4d/x/logic/util" ) // ChainID is higher order function that given a context returns the following predicate: @@ -12,9 +13,9 @@ import ( // // where ChainID represents the current chain ID at the time of the query. // The predicate is deterministic, producing the same chain ID each time it is called. -func ChainID(ctx context.Context) engine.Predicate1 { +func ChainID(ctx context.Context) func(*engine.VM, engine.Term, engine.Cont, *engine.Env) *engine.Promise { return func(vm *engine.VM, chainID engine.Term, cont engine.Cont, env *engine.Env) *engine.Promise { - sdkContext, err := UnwrapSDKContext(ctx) + sdkContext, err := util.UnwrapSDKContext(ctx) if err != nil { return engine.Error(err) }