// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;

import 'ERC20.sol';
import 'ERC20Mintable.sol';
import "ERC20Detailed.sol";

import 'MintedCrowdsale.sol';
import 'TimedCrowdsale.sol';


contract RegenToken is ERC20, ERC20Mintable, ERC20Detailed {
    constructor(uint256 initialSupply, address beneficiary) ERC20Detailed("Regen Space", "REGENS", 18) public {
        _mint(beneficiary, initialSupply);
    }
}

contract RegenCrowdsale is Crowdsale, MintedCrowdsale {
    constructor(uint256 rate, address payable wallet, IERC20 token) MintedCrowdsale() Crowdsale(rate, wallet, token) public {

    }

    function _forwardFunds() internal {
        (bool success, ) = wallet().call.value(msg.value).gas(200000)(""); // Due to gas limits happening when sending to Gnosis Safe
        require(success, "Transfer failed.");
    }
}

contract Deployer {
    constructor(address payable multisig) public {
        ERC20Mintable token = new RegenToken(1000000 ether, multisig);

        Crowdsale crowdsale = new RegenCrowdsale(1000, multisig, token);

        token.addMinter(address(crowdsale));
        token.renounceMinter();
    }
}
[{"inputs":[{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"address payable","name":"wallet","type":"address"},{"internalType":"contract IERC20","name":"token","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"purchaser","type":"address"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensPurchased","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[{"internalType":"address","name":"beneficiary","type":"address"}],"name":"buyTokens","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"rate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"wallet","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"weiRaised","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]