@@ -81,7 +81,7 @@ def __parse_conditions(
8181
8282 # Check:
8383 # - if current condition is for *ABI METHOD*
84- # (method selector && numAppArg == max(METHOD_APP_ARG_NUM_LIMIT, 1 + subroutineSyntaxArgNum))
84+ # (method selector && numAppArg == 1 + min(METHOD_APP_ARG_NUM_LIMIT, subroutineSyntaxArgNum))
8585 # - or *BARE APP CALL* (numAppArg == 0)
8686 method_or_bare_condition = (
8787 And (
@@ -101,9 +101,13 @@ def __parse_conditions(
101101 approval_conds .append (method_or_bare_condition )
102102
103103 # Check the existence of OC.CloseOut
104- close_out_exist = any (map (lambda x : x == OnComplete .CloseOut , on_completes ))
104+ close_out_exist = any (
105+ map (lambda x : str (x ) == str (OnComplete .CloseOut ), on_completes )
106+ )
105107 # Check the existence of OC.ClearState (needed later)
106- clear_state_exist = any (map (lambda x : x == OnComplete .ClearState , on_completes ))
108+ clear_state_exist = any (
109+ map (lambda x : str (x ) == str (OnComplete .ClearState ), on_completes )
110+ )
107111 # Ill formed report if app create with existence of OC.CloseOut or OC.ClearState
108112 if creation and (close_out_exist or clear_state_exist ):
109113 raise TealInputError (
@@ -117,7 +121,7 @@ def __parse_conditions(
117121 approval_oc_conds : list [Expr ] = [
118122 Txn .on_completion () == oc
119123 for oc in on_completes
120- if oc != OnComplete .ClearState
124+ if str ( oc ) != str ( OnComplete .ClearState )
121125 ]
122126
123127 # if approval OC condition is not empty, append Or to approval_conds
@@ -328,7 +332,9 @@ def build_program(self) -> tuple[Expr, Expr, dict[str, Any]]:
328332 """
329333 return (
330334 Router .__ast_construct (self .approval_if_then ),
331- Router .__ast_construct (self .clear_state_if_then ),
335+ Router .__ast_construct (self .clear_state_if_then )
336+ if self .clear_state_if_then
337+ else Approve (),
332338 self .__contract_construct (),
333339 )
334340
0 commit comments