How can a function only be callable by the dapp itself.
Say you have an AMM and want only calls that originate from the AMM's backend to be accepted by the contract?
I understand that onlyOwner can be used normally, but in this case the user of the platform will be calling every time.. so many different addresses.
I thought about hashing a secret key with the data being sent and having the contract decrypt and check it before deciding to execute but:
a) I'm not sure if that's super expensive computationally or not.
b) The contract would also need the key to decrypt afaik, which would be stored and viewable.
Possibly creating a private variable with the key in it as bytes and then using that? But is there any way the key would leak into tx data and become public?