Created
July 27, 2023 23:01
-
-
Save manishrjain/1a4083e42a2368efa1aef1dc384c80ec to your computer and use it in GitHub Desktop.
Revisions
-
manishrjain created this gist
Jul 27, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ Let's test this thing: ``` python from pyteal import * def smart_contract(): on_creation = Seq([ App.globalPut(Bytes("required_arg"), Txn.application_args[0]), App.globalPut(Bytes("optional_arg"), If(Txn.application_args.length() > Int(1), Txn.application_args[1], Bytes("default_value"))), Int(1) ]) program = Cond( [Txn.application_id() == Int(0), on_creation] ) return program if __name__ == "__main__": with open("smart_contract.teal", "w") as f: compiled = compileTeal(smart_contract(), mode=Mode.Application, version=4) f.write(compiled) ```