Error [Reverted] --- Creating an ERC20 Crowdsale

I am trying to deploy a very simple smart contract with OpenZeppelin. It is just a basic ERC20Detailed token contract and a Crowdsale contract. I compile and migrate to Ropsten network.
The token works well.

When I try to test the Crowdsale I get an error. I use Metamask to send 1 Ropsten ETH to the Crowdsale contract. The tx fails with a Revert error:
“Warning! Error encountered during contract execution [Reverted[ :(”

Value: 1 Ether - [CANCELLED] - Value transfer did not complete from a contract.
Reverted.

Any help is apreciated!

GitHub code: https://github.com/DuqueKarl/CrowdsaleTRC20

Hello @dk7! Thanks for using the forum!

Just to make sure, are you a high enough gas limit on the value transfer to the Crowdsale contract?

Also to make sure it’s not a problem, have you sent a proper amount of tokens to the Crowdsale contract?

Hey @IvanTheGreatDev thanks for your reply!

I have tested sending 1 (Ropsten) ETH and using 0.2 - 1 ETH in gas fees from MetaMask to the Crowdsale contract. It fails.

Does the contract own any tokens? As in have you sent tokens to the contract prior to attempting to buy tokens?

@dk7 OpenZeppelin 2.3 now includes revert reasons. They would help understand what was going on here, exactly what error was being triggered.

2 Likes