Hi,
How can I only allow a particular smart contract instance (1) to invoke another smart contract (2)? So in 2 receive function, I can do sometime like in mint example:
ensure!(sender.matches_account(&owner), ContractError::Unauthorized);
I cannot use the hardcoded address of smart contract 1 for checking because at point of coding 2, 1 is not used instanstiated. Also that I can only deploy and instantiate 1 only when I have the address (so deployed and instantiated) of 2 because 1 needs it for invoking 2.
So if address check is not possible, any other way to do this, for example use some other metadata like sender or owner where at least I can enforce that both smart contract are instantiated by same owner? I’d like to avoid the Parameter route – passing the checkable info as part of Param – since that seems like a weak and hackable approach. Thanks!
Thanks.