CosmWasm v1: Pass `is_caller_a_contract` in `Env`
@baedrik:
Will there be a way for a contract to create/sign its own permit to, for example, view its own snip20 balance, or will contracts always have to use viewing keys to view its own balances, histories, etc...?
Assaf:
That's a good question that I didn't think of. Contracts don't have wallets like users. Their account is created publicly on chain before they're instantiated, I think even without a private key... so they cannot sign anything. However, in future upgrades we could pass in env whether the caller is a contract. This can also be available to queries and authenticated inside the enclave.
I think there are cleaner ways to handle this specific issue, but it could be useful to pass this parameter (if it's verified by the enclave) in other scenarios (e.g. an application that doesn't want contracts interacting with it, only "real" users)
This issue is actually easy to do, we just have to extend the Env sturct and populate it somewhere in the vicinity of this.