Let’s consider a scenario: there’s a blockchain game with a battle system. The user is rewarded for winning by getting a certain amount of ERC-20 tokens. That means that the mint method in the smart contract has to be open to the public and not limited to the owner. How would you ensure, that someone won’t call this function from outside of the game? And even within the game, the user could just change the javascript to send different values.
The only idea I have about this is to move the entire battle processing from the cloud function to the smart contract but it doesn’t seem to be a good idea since there’s a lot of processing (but maybe I’m wrong and it’s not an issue) and that would make implementing changes in the battle system impossible.
Any ideas?