applications can create other contracts on the network this sound like factory pattern can be used here. any code example of app create app here since seem like this still a new things and haven’t been updated in the examples?
we can use this as example here for contract call contract using group inner txn: user A call contract B using group txn1. contract B call contract C using group txn2.
i see in the article that contract C can using CallerApplicationID and CalllerApplicationAddress in group txn2 to get the info of contract B. but any others way to do this? something like txn.sender in others platform?
in the contract C with group txn2 what is the value for Txn.sender() and Gtxn[index]? does it refer to group txn1 or group inner txn 2?
contract C if need to check group txn 2 field can using Gtxn[index]? or need to call others Pyteal opcode since i cant find it in the new version of pyteal (v10)? if does have pyteal corresponding to op code gitxn (to reveal inner group txn2) please let me know.
A minor caveat is that right now in many cases where Ethereum use a factory design, I personally believe it is cleaner on Algorand to use local storage of fresh accounts rekeyed to the application account address (or controlled by a LogicSig).
This is what tinyman is using for example: GitHub - tinymanorg/tinyman-contracts-v1: Tinyman AMM Contracts V1.1
I don’t think there is another way. Why do you want another way?
Apart from CallerApplicationID and CallerApplicationAddress, everything looks like the transaction was made at top-level from Contract C point of view. Txn and Gtxn refer to the inner transaction and inner transaction group that called Contract C (that is in your notation group txn2).
It can use gtxn. gitxn is to inspect inner transactions made by contract C.
i did see the tiny man design. logicSig is cool but i want to use the address of the app and building own inner txn to minimum the txn needed. what i need here is any example of app create app (in pyteal is great)
I don’t think there is another way. Why do you want another way?
so it would be the general case (for example to check if the sender is authoried, no matter of any address). and quick question here in my above B,C contract call example. in C contract, when i check Txn.sender, what will be the value? is that A?
It can use gtxn . gitxn is to inspect inner transactions made by contract C.
thank for your answer. i want to make thing clearer here. In contract C, i call gtxn to get the group txn2. In contract B, i call gitxn to get the groupt txn2.
If B used the default sender, it is the application account of B.
In general, it is the sender of the inner transaction as specified by B.
(It can either be the application account of B or any account rekeyed to that address.)
Intersting here since in contract C, CallerApplicationID and CalllerApplicationAddress could return B and B’s address.
So it still mean that (if all default, B does not change the sender group txn2) in contract C, get Txn.sender will return B’s address just like CalllerApplicationAddress?
So in C, how to get address of A? Is there anyway?
Hi i want to ask if i can query other transcation properties in group inner txn
for example 1 i got this group txn
txn1: call to contract A, then A call inner txn create contract B
txn2: call to contract C. in this contract, how can i get address/appId of B?
for example 2 i got this group txn
txn1: call to contract C. C then call contract A, A call inner txn create contract B. After call contract A, C want to call contract B. how C now can know address/appId of B?
Speaking to return value, are there any example of call inner txn, app call log and get the return value from that in pyteal?
This seem pretty new and give more flexibility.