Skip to content

Commit

Permalink
fix: fix wrong types (was problematic for type assertions)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Jan 9, 2023
1 parent cab9522 commit 2b7e7bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions x/logic/predicate/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down
5 changes: 3 additions & 2 deletions x/logic/predicate/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
}
Expand Down

0 comments on commit 2b7e7bc

Please sign in to comment.