Hello,
as a beginner in solidity, I am writing to you to get some information about the error message which is the title of this topic "Fail with error 'Crowdsale: rate is 0'".
I am trying to set up a crowdsale with a token with 8 decimal. The problem is that when I calculate the rate, if I understand correctly, it must be 10^-8 which is impossible to configure (I try to make 1TKN == $10-$15).
However, I have already seen codes that allow the use of fractions to reduce the 18 decimal places.
(Here is a link to a code with which I was able to tweak fractions and thus perform negative rates: https://github.com/bitfwdcommunity/ICO-tutorial/blob/master/ico-contract.sol).
Do you think that with a code using Openzepplin it is possible to use negative rates?
here is my code (I use Remix.IDE):
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/crowdsale/Crowdsale.sol";
contract MyCrowdsale is Crowdsale {
constructor(
uint256 rate, // rate, in bits
address payable wallet, // wallet to send Ether
IERC20 token // the token
)
Crowdsale(rate, wallet, token)
public
{}
}
Kind regards.
Alex.