How ERC20 approve function works?

Hi @pedromtelho,

You could look at the following simple example where the entire supply of tokens is transferred to the Crowdsale contract to sell: Simple ERC20 Crowdsale

Though you could send what ever amount of tokens you need to the Crowdsale, it doesn’t have to be the total supply.

As for the approve function, the holder of the tokens needs to call approve to set an allowance for another contract to use/spend. See the following example: Example on how to use ERC20 token in another contract