Simple ERC20 Crowdsale contract

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?

1 Like

There is an earlier version for crowdsale, you can have a check:

1 Like

Hi @relapse42,

Welcome to the community :wave:

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:

If you are creating a token, I suggest looking at: Points to consider when creating a fungible token (ERC20, ERC777)

1 Like

Great. Thanks! I already have the token created.

1 Like

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";
1 Like

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 "";

 * @title SimpleCrowdsale
 * @dev This is an example of a fully fledged crowdsale.
contract SimpleCrowdsale is Crowdsale {
    constructor (
        uint256 rate,
        address payable wallet,
        IERC20 token
        Crowdsale(rate, wallet, token)