Open adrianmcli opened 6 years ago
It seems like doing approve
and then transferFrom
is the best way.
Some ERC20 tokens have the approve and transferFrom functions. In those cases you can have the user approve some tokens to your contract. Then, they can call a function in your contract which will call transferFrom on the token contract.
This requires the user to execute at least two transactions: one to call approve on the token contract, and one to call a function in your contract which in turn will call transferFrom on the token contract.
I made this question: https://ethereum.stackexchange.com/questions/52713/how-to-validate-erc-20-payments-into-a-contract
And then I found these: