Skip to content

Instantly share code, notes, and snippets.

@willwillis
Created January 18, 2020 05:02
Show Gist options
  • Save willwillis/579d0a2a07fa5b23ba2e3f667cbf5f63 to your computer and use it in GitHub Desktop.
Save willwillis/579d0a2a07fa5b23ba2e3f667cbf5f63 to your computer and use it in GitHub Desktop.
pragma solidity ^0.5.0;
import "./FDIC_Coin.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/crowdsale/Crowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/crowdsale/emission/MintedCrowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/crowdsale/validation/CappedCrowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/crowdsale/validation/TimedCrowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/crowdsale/distribution/RefundablePostDeliveryCrowdsale.sol";
// @TODO: Inherit the crowdsale contracts
contract MyCrowdsale is Crowdsale, MintedCrowdsale {
constructor(
uint256 rate, // rate in TKNbits
address payable wallet,
MyToken token
)
MintedCrowdsale()
Crowdsale(rate, wallet, token)
public
{
}
}
contract MyCrowdsaleDeployer {
constructor(
string memory name,
string memory symbol,
address payable wallet // this address will receive all Ether raised by the sale
)
public
{
// create a mintable token
MyToken token = new MyToken(name, symbol);
// address token_address = address(token);
// create the crowdsale and tell it about the token
Crowdsale crowdsale = new MyCrowdsale(
1, // rate, still in TKNbits
msg.sender, // send Ether to the deployer
token // the token
);
// transfer the minter role from this contract (the default)
// to the crowdsale, so it can mint tokens
token.addMinter(address(crowdsale));
token.renounceMinter();
// // create the ArcadeToken and keep its address handy
// ArcadeToken token = new ArcadeToken(name, symbol, 0);
// token_address = address(token);
// // create the ArcadeTokenSale and tell it about the token
// ArcadeTokenSale arcade_sale = new ArcadeTokenSale(1, wallet, token);
// arcade_sale_address = address(arcade_sale);
// // make the ArcadeTokenSale contract a minter, then have the ArcadeTokenSaleDeployer renounce its minter role
// token.addMinter(arcade_sale_address);
// token.renounceMinter();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment