I need a very simple crowdsale contract. The user sends ETH and gets tokens in return during a timeframe. No caps, no minting, no refunds. Are there any available templates for this?
There is an earlier version for crowdsale
, you can have a check: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/d1158ea68c597075a5aec4a77a9c16f061beffd3/contracts/crowdsale/Crowdsale.sol
Hi @relapse42,
Welcome to the community
There is a simple example in the forum: Help me write an erc20 token and a crowdsale contract
Crowdsales are in OpenZeppelin Contracts 2.x (they were removed in 3.x). The documentation is here: https://docs.openzeppelin.com/contracts/2.x/crowdsales
If you are creating a token, I suggest looking at: Points to consider when creating a fungible token (ERC20, ERC777)
Great. Thanks! I already have the token created.
Remix unable to import. Files not found.
import "../GSN/Context.sol";
import "../token/ERC20/IERC20.sol";
import "../math/SafeMath.sol";
import "../token/ERC20/SafeERC20.sol";
import "../utils/ReentrancyGuard.sol";
Hi @relapse42,
With Remix you can use GitHub rather than npm imports.
So you can import from an official release of OpenZeppelin Contracts, e.g. 2.5.1.
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/crowdsale/Crowdsale.sol";
/**
* @title SimpleCrowdsale
* @dev This is an example of a fully fledged crowdsale.
*/
contract SimpleCrowdsale is Crowdsale {
constructor (
uint256 rate,
address payable wallet,
IERC20 token
)
public
Crowdsale(rate, wallet, token)
{
}
}