I notice that on the standard tests for crowdsale contracts in Openzeppelin, they transfer the tokens from the Token contract to the Crowdsale Contract:
context('once deployed', async function () {
beforeEach(async function () {
this.tokensale = await TokenSale.new(rate, wallet, this.token.address);
await this.token.transfer(this.tokensale.address, tokenSupply);
});
However other examples do not do this. So I wonder why this is necessary, if internally the CrowdSale
contract uses the token contract to send the tokens:
function _deliverTokens(
address beneficiary,
uint256 tokenAmount
)
internal
{
_token.safeTransfer(beneficiary, tokenAmount);
}
In the function above _token
is the IERC20 interface of the Token contract. Can some one explain this a bit better than this page?