I have an ERC20 Mintable+Burnable Token created on solidity 6.11 and a sale contract on solidity 5.0 I am getting error when i send ETH to the sale contract.


I have given minter role to sale contract.

This is the sale contract code:

pragma solidity ^0.5.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/tree/v2.5.1/contracts/crowdsale/emission/MintedCrowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/tree/v2.5.1/contracts/crowdsale/validation/CappedCrowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/tree/v2.5.1/contracts/crowdsale/Crowdsale.sol";

contract BotSale is Crowdsale, MintedCrowdsale, CappedCrowdsale {
constructor (
uint256 rate,
address payable wallet,
IERC20 token,
uint256 cap
Crowdsale(rate, wallet, token)
// solhint-disable-previous-line no-empty-blocks

I have set Rate: 1000000000000000000 and Cap to: 9600000000000000000000000

Just incase if that helps. Though i want to ask, this cap is of tokens or ETH? and should i add decimals to cap? Also i have read on openzeppelin docs to set rate as 1 if i want to give 1 token in exchange of 1 ETH. So should i add decimals in rate or not?

1 Answer 1


If you want to issue someone “1 TKNfor every 1 ETH”, and your decimals are 18, your rate is 1 .

To calculate rate please see the OpenZeppelin Contracts documentation: https://docs.openzeppelin.com/contracts/2.x/crowdsales#crowdsale-rate

If you have questions on using OpenZeppelin you can ask in the Community Forum: https://forum.openzeppelin.com/

Disclosure: I am the Community Manager at OpenZeppelin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.