I wrote a smart contract which will be used in an ICO. The contract is an erc20 token but it also provides functionality to mint tokens so basically users can call the payable function. This in turn calls a internal function to calculate the number of tokens that should be minted for that amount of eth, mints the tokens and transfers them to the caller.
My question is, is this the way to go? Is having an erc20 token which also contains the crowdsale functionality good practice? The reason I am asking this is because I read about the possibility of having an erc20 contract and a crowdsale contract, but I do not see the point of having 2 seperate contracts rather than 1.
My contract also has logic that when the ICO is over, minting of new tokens and so on cannot occur anymore and the contract then simply acts as a ledger and to allow token transfers between accounts.
Any clarifications would be greatly appreciated.