This forum is a read-only archive. Posting, replying and signing in are disabled.

Pyteal contract

nikitagugale
@Subroutine(TealType.none)
    def closeAccountTo() -> Expr:
        #return If(Balance(Global.current_application_address()) != Int(0)).Then(
             return If(App.globalGet(PurchaserApprove) == Int(1)).Then(
             Seq(
                InnerTxnBuilder.Begin(),
                InnerTxnBuilder.SetFields(
                    {
                        TxnField.type_enum: TxnType.Payment,
                        TxnField.amount:App.globalGet(Amount),
                        TxnField.sender: Global.current_application_address(),
                        TxnField.receiver: App.globalGet(Seller_Address),
                    }
                ),
                InnerTxnBuilder.Submit(),
            )
       )
        return ElseIf(App.globalGet(PurchaserApprove) ==Int(0)).Then(

        Seq(
                InnerTxnBuilder.Begin(),
                InnerTxnBuilder.SetFields(
                    {
                        TxnField.type_enum: TxnType.Payment,
                        TxnField.amount:App.globalGet(Amount),
                        TxnField.sender: Global.current_application_address(),
                        TxnField.receiver: App.globalGet(Purchaser_key),
                    }
                ),
                InnerTxnBuilder.Submit(),
            )
        )

This is part of my contract where payment receiver changes on INT flag. Not sure what I am missing since its not working.
If anyone can help.
Thanks

edited
fabrice

What did you try to run this smart contract? (the goal commands you run on command line, or the Python/Java/JS/Go script using the SDK that you used)
What exactly where you expecting?
What did you get? (the exact error message or the link to transactions on a blockexplorer that did not do what you want)

PS: I’ve switched the quotes ‘’’ into triple backquotes ``` (this is a different key on the keyboard) to allow proper formatting.