"VM Exception while processing transaction: revert" in Truffle test and Truffle dev in Crowdsale

Hi @Exctazy,

Welcome to the community :wave:

I assume that the issue is that the test changes the owner of the contract (using transferOwnership but doesn’t transfer any tokens to the crowdsale (using transfer). The crowdsale doesn’t have a supply of tokens to sell.

To see this in action, we can look at the OpenZeppelin Contract tests (using OpenZeppelin Test Environment)


As an aside, your ERC20 token could be simpler (I wasn’t sure of the code in the constructor). See the following example: Help me write an erc20 token and a crowdsale contract

Feel free to ask all the questions that you need.