@@ -137,6 +137,22 @@ def recursive_subroutine_example(pt):
137137 return fib (pt .Int (10 ))
138138
139139
140+ def big_opups_example (pt ):
141+ from examples .application .opup import (
142+ approval_program_explicit_ensure ,
143+ approval_program_oncall_ensure ,
144+ approval_program_explicit_maximize ,
145+ approval_program_oncall_maximize ,
146+ )
147+
148+ return pt .Seq (
149+ approval_program_explicit_ensure (),
150+ approval_program_oncall_ensure (),
151+ approval_program_explicit_maximize (),
152+ approval_program_oncall_maximize (),
153+ )
154+
155+
140156CONSTRUCTS_LATEST_VERSION = 8
141157
142158
@@ -1982,6 +1998,184 @@ def test_constructs_handles_latest_pyteal():
19821998 "Application" ,
19831999 dict (frame_pointers = True ),
19842000 ),
2001+ ( # 43: OpUps
2002+ big_opups_example ,
2003+ [
2004+ [P , C ],
2005+ ("txn ApplicationID" , "Txn.application_id()" ),
2006+ ("int 0" , "Int(0)" ),
2007+ ("!=" , "Txn.application_id() != Int(0)" ),
2008+ ("bnz main_l16" , "If(Txn.application_id() != Int(0))" ),
2009+ ("main_l1:" , "If(Txn.application_id() != Int(0))" ),
2010+ ("int 1" , "Approve()" ),
2011+ ("return" , "Approve()" ),
2012+ ("txn ApplicationID" , "Txn.application_id()" ),
2013+ ("int 0" , "Int(0)" ),
2014+ ("!=" , "Txn.application_id() != Int(0)" ),
2015+ ("main_l2:" , "If(Txn.application_id() != Int(0))" ),
2016+ ("int 1" , "Approve()" ),
2017+ ("return" , "Approve()" ),
2018+ ("txn ApplicationID" , "Txn.application_id()" ),
2019+ ("int 0" , "Int(0)" ),
2020+ ("!=" , "Txn.application_id() != Int(0)" ),
2021+ ("main_l3:" , "If(Txn.application_id() != Int(0))" ),
2022+ ("int 1" , "Approve()" ),
2023+ ("return" , "Approve()" ),
2024+ ("txn ApplicationID" , "Txn.application_id()" ),
2025+ ("int 0" , "Int(0)" ),
2026+ ("!=" , "Txn.application_id() != Int(0)" ),
2027+ ("int 0" , "opup.maximize_budget(Int(3000))" ),
2028+ ("store 3" , "opup.maximize_budget(Int(3000))" ),
2029+ ("main_l5:" , "opup.maximize_budget(Int(3000))" ),
2030+ ("load 3" , "opup.maximize_budget(Int(3000))" ),
2031+ ("int 3000" , "Int(3000)" ),
2032+ ("global MinTxnFee" , "opup.maximize_budget(Int(3000))" ),
2033+ ("/" , "opup.maximize_budget(Int(3000))" ),
2034+ ("<" , "opup.maximize_budget(Int(3000))" ),
2035+ ("bnz main_l7" , "opup.maximize_budget(Int(3000))" ),
2036+ (
2037+ "byte base64(iZWMx72KvU6Bw6sPAWQFL96YH+VMrBA0XKWD9XbZOZI=)" ,
2038+ "Bytes('base64', 'iZWMx72KvU6Bw6sPAWQFL96YH+VMrBA0XKWD9XbZOZI=')" ,
2039+ ),
2040+ (
2041+ "byte base64(if8ooA+32YZc4SQBvIDDY8tgTatPoq4IZ8Kr+We1t38LR2RuURmaVu9D4shbi4VvND87PUqq5/0vsNFEGIIEDA==)" ,
2042+ "Bytes('base64', 'if8ooA+32YZc4SQBvIDDY8tgTatPoq4IZ8Kr+We1t38LR2RuURmaVu9D4shbi4VvND87PUqq5/0vsNFEGIIEDA==')" ,
2043+ ),
2044+ (
2045+ "addr 7JOPVEP3ABJUW5YZ5WFIONLPWTZ5MYX5HFK4K7JLGSIAG7RRB42MNLQ224" ,
2046+ "Addr('7JOPVEP3ABJUW5YZ5WFIONLPWTZ5MYX5HFK4K7JLGSIAG7RRB42MNLQ224')" ,
2047+ ),
2048+ ("ed25519verify" , "Ed25519Verify(args[0], args[1], args[2])" ),
2049+ ("pop" , "Pop(Ed25519Verify(args[0], args[1], args[2]))" ),
2050+ ("b main_l20" , C ),
2051+ ("main_l7:" , "opup.maximize_budget(Int(3000))" ),
2052+ ("itxn_begin" , "opup.maximize_budget(Int(3000))" ),
2053+ ("int appl" , "opup.maximize_budget(Int(3000))" ),
2054+ ("itxn_field TypeEnum" , "opup.maximize_budget(Int(3000))" ),
2055+ ("int DeleteApplication" , "opup.maximize_budget(Int(3000))" ),
2056+ ("itxn_field OnCompletion" , "opup.maximize_budget(Int(3000))" ),
2057+ ("byte 0x068101" , "opup.maximize_budget(Int(3000))" ),
2058+ ("itxn_field ApprovalProgram" , "opup.maximize_budget(Int(3000))" ),
2059+ ("byte 0x068101" , "opup.maximize_budget(Int(3000))" ),
2060+ ("itxn_field ClearStateProgram" , "opup.maximize_budget(Int(3000))" ),
2061+ ("itxn_submit" , "opup.maximize_budget(Int(3000))" ),
2062+ ("load 3" , "opup.maximize_budget(Int(3000))" ),
2063+ ("int 1" , "opup.maximize_budget(Int(3000))" ),
2064+ ("+" , "opup.maximize_budget(Int(3000))" ),
2065+ ("store 3" , "opup.maximize_budget(Int(3000))" ),
2066+ ("b main_l5" , "opup.maximize_budget(Int(3000))" ),
2067+ ("int 0" , "opup.maximize_budget(Int(3000))" ),
2068+ ("store 2" , "opup.maximize_budget(Int(3000))" ),
2069+ ("main_l9:" , "opup.maximize_budget(Int(3000))" ),
2070+ ("load 2" , "opup.maximize_budget(Int(3000))" ),
2071+ ("int 3000" , "Int(3000)" ),
2072+ ("global MinTxnFee" , "opup.maximize_budget(Int(3000))" ),
2073+ ("/" , "opup.maximize_budget(Int(3000))" ),
2074+ ("<" , "opup.maximize_budget(Int(3000))" ),
2075+ ("bnz main_l11" , "opup.maximize_budget(Int(3000))" ),
2076+ (
2077+ "byte base64(iZWMx72KvU6Bw6sPAWQFL96YH+VMrBA0XKWD9XbZOZI=)" ,
2078+ "Bytes('base64', 'iZWMx72KvU6Bw6sPAWQFL96YH+VMrBA0XKWD9XbZOZI=')" ,
2079+ ),
2080+ (
2081+ "byte base64(if8ooA+32YZc4SQBvIDDY8tgTatPoq4IZ8Kr+We1t38LR2RuURmaVu9D4shbi4VvND87PUqq5/0vsNFEGIIEDA==)" ,
2082+ "Bytes('base64', 'if8ooA+32YZc4SQBvIDDY8tgTatPoq4IZ8Kr+We1t38LR2RuURmaVu9D4shbi4VvND87PUqq5/0vsNFEGIIEDA==')" ,
2083+ ),
2084+ (
2085+ "addr 7JOPVEP3ABJUW5YZ5WFIONLPWTZ5MYX5HFK4K7JLGSIAG7RRB42MNLQ224" ,
2086+ "Addr('7JOPVEP3ABJUW5YZ5WFIONLPWTZ5MYX5HFK4K7JLGSIAG7RRB42MNLQ224')" ,
2087+ ),
2088+ ("ed25519verify" , "Ed25519Verify(args[0], args[1], args[2])" ),
2089+ ("pop" , "Pop(Ed25519Verify(args[0], args[1], args[2]))" ),
2090+ ("b main_l3" , C ),
2091+ ("main_l11:" , "opup.maximize_budget(Int(3000))" ),
2092+ ("itxn_begin" , "opup.maximize_budget(Int(3000))" ),
2093+ ("int appl" , "opup.maximize_budget(Int(3000))" ),
2094+ ("itxn_field TypeEnum" , "opup.maximize_budget(Int(3000))" ),
2095+ ("int 1" , "Int(1)" ),
2096+ ("itxn_field ApplicationID" , "opup.maximize_budget(Int(3000))" ),
2097+ ("itxn_submit" , "opup.maximize_budget(Int(3000))" ),
2098+ ("load 2" , "opup.maximize_budget(Int(3000))" ),
2099+ ("int 1" , "opup.maximize_budget(Int(3000))" ),
2100+ ("+" , "opup.maximize_budget(Int(3000))" ),
2101+ ("store 2" , "opup.maximize_budget(Int(3000))" ),
2102+ ("b main_l9" , "opup.maximize_budget(Int(3000))" ),
2103+ ("int 2000" , "Int(2000)" ),
2104+ ("int 10" , "opup.ensure_budget(Int(2000))" ),
2105+ ("+" , "opup.ensure_budget(Int(2000))" ),
2106+ ("store 1" , "opup.ensure_budget(Int(2000))" ),
2107+ ("main_l13:" , "opup.ensure_budget(Int(2000))" ),
2108+ ("load 1" , "opup.ensure_budget(Int(2000))" ),
2109+ ("global OpcodeBudget" , "opup.ensure_budget(Int(2000))" ),
2110+ (">" , "opup.ensure_budget(Int(2000))" ),
2111+ ("bnz main_l15" , "opup.ensure_budget(Int(2000))" ),
2112+ (
2113+ "byte base64(iZWMx72KvU6Bw6sPAWQFL96YH+VMrBA0XKWD9XbZOZI=)" ,
2114+ "Bytes('base64', 'iZWMx72KvU6Bw6sPAWQFL96YH+VMrBA0XKWD9XbZOZI=')" ,
2115+ ),
2116+ (
2117+ "byte base64(if8ooA+32YZc4SQBvIDDY8tgTatPoq4IZ8Kr+We1t38LR2RuURmaVu9D4shbi4VvND87PUqq5/0vsNFEGIIEDA==)" ,
2118+ "Bytes('base64', 'if8ooA+32YZc4SQBvIDDY8tgTatPoq4IZ8Kr+We1t38LR2RuURmaVu9D4shbi4VvND87PUqq5/0vsNFEGIIEDA==')" ,
2119+ ),
2120+ (
2121+ "addr 7JOPVEP3ABJUW5YZ5WFIONLPWTZ5MYX5HFK4K7JLGSIAG7RRB42MNLQ224" ,
2122+ "Addr('7JOPVEP3ABJUW5YZ5WFIONLPWTZ5MYX5HFK4K7JLGSIAG7RRB42MNLQ224')" ,
2123+ ),
2124+ ("ed25519verify" , "Ed25519Verify(args[0], args[1], args[2])" ),
2125+ ("pop" , "Pop(Ed25519Verify(args[0], args[1], args[2]))" ),
2126+ ("b main_l2" , C ),
2127+ ("main_l15:" , "opup.ensure_budget(Int(2000))" ),
2128+ ("itxn_begin" , "opup.ensure_budget(Int(2000))" ),
2129+ ("int appl" , "opup.ensure_budget(Int(2000))" ),
2130+ ("itxn_field TypeEnum" , "opup.ensure_budget(Int(2000))" ),
2131+ ("int DeleteApplication" , "opup.ensure_budget(Int(2000))" ),
2132+ ("itxn_field OnCompletion" , "opup.ensure_budget(Int(2000))" ),
2133+ ("byte 0x068101" , "opup.ensure_budget(Int(2000))" ),
2134+ ("itxn_field ApprovalProgram" , "opup.ensure_budget(Int(2000))" ),
2135+ ("byte 0x068101" , "opup.ensure_budget(Int(2000))" ),
2136+ ("itxn_field ClearStateProgram" , "opup.ensure_budget(Int(2000))" ),
2137+ ("itxn_submit" , "opup.ensure_budget(Int(2000))" ),
2138+ ("b main_l13" , "opup.ensure_budget(Int(2000))" ),
2139+ ("main_l16:" , "If(Txn.application_id() != Int(0))" ),
2140+ ("int 2000" , "Int(2000)" ),
2141+ ("int 10" , "opup.ensure_budget(Int(2000))" ),
2142+ ("+" , "opup.ensure_budget(Int(2000))" ),
2143+ ("store 0" , "opup.ensure_budget(Int(2000))" ),
2144+ ("main_l17:" , "opup.ensure_budget(Int(2000))" ),
2145+ ("load 0" , "opup.ensure_budget(Int(2000))" ),
2146+ ("global OpcodeBudget" , "opup.ensure_budget(Int(2000))" ),
2147+ (">" , "opup.ensure_budget(Int(2000))" ),
2148+ ("bnz main_l19" , "opup.ensure_budget(Int(2000))" ),
2149+ (
2150+ "byte base64(iZWMx72KvU6Bw6sPAWQFL96YH+VMrBA0XKWD9XbZOZI=)" ,
2151+ "Bytes('base64', 'iZWMx72KvU6Bw6sPAWQFL96YH+VMrBA0XKWD9XbZOZI=')" ,
2152+ ),
2153+ (
2154+ "byte base64(if8ooA+32YZc4SQBvIDDY8tgTatPoq4IZ8Kr+We1t38LR2RuURmaVu9D4shbi4VvND87PUqq5/0vsNFEGIIEDA==)" ,
2155+ "Bytes('base64', 'if8ooA+32YZc4SQBvIDDY8tgTatPoq4IZ8Kr+We1t38LR2RuURmaVu9D4shbi4VvND87PUqq5/0vsNFEGIIEDA==')" ,
2156+ ),
2157+ (
2158+ "addr 7JOPVEP3ABJUW5YZ5WFIONLPWTZ5MYX5HFK4K7JLGSIAG7RRB42MNLQ224" ,
2159+ "Addr('7JOPVEP3ABJUW5YZ5WFIONLPWTZ5MYX5HFK4K7JLGSIAG7RRB42MNLQ224')" ,
2160+ ),
2161+ ("ed25519verify" , "Ed25519Verify(args[0], args[1], args[2])" ),
2162+ ("pop" , "Pop(Ed25519Verify(args[0], args[1], args[2]))" ),
2163+ ("b main_l1" , C ),
2164+ ("main_l19:" , "opup.ensure_budget(Int(2000))" ),
2165+ ("itxn_begin" , "opup.ensure_budget(Int(2000))" ),
2166+ ("int appl" , "opup.ensure_budget(Int(2000))" ),
2167+ ("itxn_field TypeEnum" , "opup.ensure_budget(Int(2000))" ),
2168+ ("int 1" , "Int(1)" ),
2169+ ("itxn_field ApplicationID" , "opup.ensure_budget(Int(2000))" ),
2170+ ("itxn_submit" , "opup.ensure_budget(Int(2000))" ),
2171+ ("b main_l17" , "opup.ensure_budget(Int(2000))" ),
2172+ ("main_l20:" , "opup.ensure_budget(Int(2000))" ),
2173+ ("int 1" , "Approve()" ),
2174+ ("return" , "Approve()" ),
2175+ ],
2176+ 6 ,
2177+ "Application" ,
2178+ ),
19852179]
19862180
19872181
0 commit comments