I have created a contract which is a ERC20 contract. Once the contract is created, I have specified some amount of ERC20 tokens to be minted and sent to the contract.
Moreover, I have defined that whenever someone sends funds to the contract, should be paid by some amount of tokens in proportion to the entered fund.
However, every time I try to send some amount of ethers to the contract in return for tokens, I am given this error: "Transfer amount exceeds allowance".
I guess it might be related to the Approve() or increaseAllowance() function of ERC20, but I am not sure. Does anyone know what should I do prior to the Transfer(), and discuss the difference between these two for me?
While intending to send Tokens, which are minted and kept in a contract, to an address which one should we use Transfer() or transferFrom() ?