I'm trying to design this: user clicks the button and the button calls approve for ERC20 and call contract function that requires those ERC20s. But what happens it's that approve function succeeds, but the other contract function call errors that the user hasn't approved the tokens. Is there something I can do?
1 Answer
I don't think it's possible, because with first call you are asking a ERC20 contract to allow your contract to spend funds and only after successful transaction you can call TransferFrom from your contract.