here's my method to allow the user to sell "FRKC" ERC20 tokens to get ETH in return from my smart contract
When I log the allowance variable it stays at 0
On Remix I get the error: "Check the token allowance."
I made sure my user had enough tokens to sell and my contract has enough ETH to send Am I supposed to call the approve function somewhere? Couldn't find a good example
function sell(uint256 amount) public {
// Allowance
uint256 allowance = FrkcReserve.allowance(msg.sender, address(this));
require(allowance >= amount, "Check the token allowance.");
// Get tokens from the user
bool sent = FrkcReserve.transferFrom(msg.sender, address(this), amount);
require(sent, "Failed to transfer tokens from user to vendor");
// Sent ETH to the user
(sent, ) = msg.sender.call{value: amountOfETHToTransfer}("");
require(sent, "Failed to send ETH to the user");
emit Sold(amount);
}