Solidity – Understanding ‘Low-Level Call Failed’ Error

go-ethereumopenzeppelin-contractssolidity

I'm using the crowdsale contract (https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/crowdsale/Crowdsale.sol). I have deployed a detailedERC20 smart contract. When I send the ether to the crowdsale contract it shows me the following error:
SafeERC20: low-level call failed

When I use transfer() externally it works fine.

computer Environment
Ganache-cli

Best Answer

Potential areas to look at which could be causing your problem when using the default emission Crowdsale:

  • Set an appropriate rate
  • Need to transfer (enough) tokens to the Crowdsale

For information on the rate: https://docs.openzeppelin.org/v2.3.0/crowdsales#crowdsale-rate

Understanding the rate of a crowdsale is super important, and mistakes here are a common source of bugs.

✨ HOLD UP FAM THIS IS IMPORTANT ✨

Firstly, all currency math is done in the smallest unit of that currency and converted to the correct decimal places when displaying the currency.

For information on default emission: https://docs.openzeppelin.org/v2.3.0/crowdsales#default-emission

In the default scenario, your crowdsale must own the tokens that are sold.

I recommend reading through the OpenZeppelin documentation on Crowdsales: https://docs.openzeppelin.org/v2.3.0/crowdsales

If you have more questions about OpenZeppelin you can always ask in the community forum

Related Topic