This may fit a common pattern, but I am not sure how to do it. My use case is:
- Alice wants to fund a problem using Algos. The problem is verified solved using an offchain oracle. The receiver does not exist yet when Alice opts-in to fund the problem. If the problem is solved, the funds go to the receiver less the arbiter fee. If the problem is not solved within a period of time or Alice opts-out at any point, the funds are returned to Alice less the arbiter fee. Whether the problem is solved or not, the arbiter fee is sent once to a third account.
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?