Grouping Transaction Design Question - General - Algorand

Grouping Transaction Design Question

This may fit a common pattern, but I am not sure how to do it. My use case is:

I think I could do this using a stateful smart contract that groups transactions with an escrow account. The creator of the stateful smart contract can communicate with the oracle and they would update global state for the contract. Is this the correct way to do it? Is there a close example using pyteal?

Thank you!

post by JasonW on Mar 15, 2021

You could do it as you describe. Most of the logic required in the escrow is very similar to an htlc contract. If you did not have the requirement that the oracle be on chain, you could probably do it all in the escrow. Take a look at the htlc contract for more details on how your escrow should look. Algorand Developer Docs

That contract is only for version 1 of TEAL so if you plan on using version 2 of TEAL it should be updated with the guidelines described here: Algorand Developer Docs or just look at the sample shown here: Algorand Developer Docs.

For a reference of grouping escrow payments with stateful contract calls, look at the crowdfunding example described here: Algorand Developer Portal

post by JasonW on Mar 15, 2021

Here is an example htlc with PyTeal btw: pyteal/atomic_swap.py at master · algorand/pyteal · GitHub