diff --git a/crates/uplc/src/builder.rs b/crates/uplc/src/builder.rs index aedcd665..edd99643 100644 --- a/crates/uplc/src/builder.rs +++ b/crates/uplc/src/builder.rs @@ -599,11 +599,17 @@ impl Term { .apply(Term::fst_pair().apply(pair.clone())) .if_then_else( otherwise.clone(), - callback( - Term::equals_integer() - .apply(Term::fst_pair().apply(pair)) - .apply(Term::integer(1.into())), - ), + Term::less_than_integer() + .apply(Term::fst_pair().apply(pair.clone())) + .apply(Term::integer(0.into())) + .if_then_else( + otherwise.clone(), + callback( + Term::equals_integer() + .apply(Term::integer(1.into())) + .apply(Term::fst_pair().apply(pair)), + ), + ), ), otherwise.clone(), )