I want to execute a contract using a transaction group. The idea is that one of the two transactions (1) in the group has the contract as a receiver, while the other one (0) has the caller as a receiver. is this possible? if so, in my teal contract I would want to ensure that the receiver of a payment is the contract itself. How do I do this? I’m aware of the receiver field, e.g. Assert(Gtxn[1].receiver() == 000000000000000000000000000000)
, but obviously can’t supply the hash of the contract within the contract.
You can use an app to check that.
See e.g. AlgoRealm, a NFT Royalty Game for a detailed description.
If you have a single such smart contract, @Maugli’s solution works well.
If you have many such smart contracts, you can actually compute the smart contract hash yourself, this is a much more advance pattern. See Bond Implementation - #2 by fabrice