Search code examples
ethereumsolidityerc20binance-smart-chainbep20

Token (solidity) - Reward a user X amount of token from main app wallet with user paying the gas


Hello Everything is fine?

I'm now starting to study Solidity, I'm making a centralized game, and after some successful missions, I want to give the user the option of "Claim tokens", where I would transfer from the game wallet to him, and the amount is the backend that define, how would I go about implementing this? (My question is how to create a function in the contract where the amount is authorized by the backend somehow)


Solution

  • After a lot of searching I found the answer in Solidity's documentation, what I wanted is item 3.3.4 (Micropayment channel) of the documentation (readthedocs.org/projects/solidity/downloads/pdf/v0.5.12), there it explains how to authorize a person to withdraw from the my wallet with signatures and hash, without me needing to call even a method of the contract