I want to write a contract that buys back an ERC20 Token using USDC. (in REMIX IDE)
I want to understand what is the best practice for paying out the USDC in return for the ERC20 that was sold to the contract.
Right now, I am calling a
usdcAddress.transferFrom(address(buyer), msg.sender, price);
It just dawned on me that I need to the buyer wallet address to call APPROVE before I can call the
transferFrom which is something I cannot do in production. Only the msg.sender will be able to call approve via the web3.
What is the best practice to implement this scenario.