I am trying to simulate something like how Ethereum allows a contract to originate multiple transfers with an ASC1 contract.
I believe I can do this by having my ASC1 contract (written in TEAL) approve an atomic transaction group, with, for example, two transactions, T1 and T2, which would be prepared by my client (whereas in Ethereum, they’d be initiated by the contract itself.)
By my reading of the docs, my contract will run on each transaction separately and I can tell when I’m run on T1 vs T2 by looking at
txn GroupIndex which would return
1 respectively. So, I can independently approve each of the sub-transactions.
However, I do not understand how I can mandate (via the contract) that the two transactions are present in the group and would not be approved otherwise. I suspect it can’t be as simple as checking the global group size (i.e.
Maybe the real answer is that I should not look at
txn but look at
gtxn? Does that mean that my whole transaction set will be inspected by the contract running once? Or will it run N times for N transactions in a group?