-
Notifications
You must be signed in to change notification settings - Fork 0
/
KaseiCoinCrowdsale.sol
69 lines (57 loc) · 2.95 KB
/
KaseiCoinCrowdsale.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0<0.9.0;
import "./KaseiCoin.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/crowdsale/Crowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/crowdsale/emission/MintedCrowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/crowdsale/validation/CappedCrowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/crowdsale/validation/TimedCrowdsale.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/crowdsale/distribution/RefundablePostDeliveryCrowdsale.sol";
/* KaseiCoinCrowdsale contract
* OpenZeppelin import inheritance - Crowdsale, MintedCrowdsale
*/
contract KaseiCoinCrowdsale is Crowdsale, MintedCrowdsale, CappedCrowdsale, TimedCrowdsale, RefundableCrowdsale {
// UPDATE THE CONTRACT SIGNATURE TO ADD INHERITANCE
// Provide parameters for all of the features of Crowdsale; `rate`, `wallet` for fundraising, and `token`.
constructor(
uint rate,
address payable wallet, // collector of sales
KaseiCoin token, // actual 'KaseiCoin' token for crowdsale
uint goal, // goal for crowdsale
uint open, // open of crowdsale
uint close // close of crowdsale
) public
Crowdsale(rate, wallet, token)
CappedCrowdsale(goal)
TimedCrowdsale(open, close)
RefundableCrowdsale(goal)
{}
}
contract KaseiCoinCrowdsaleDeployer {
// Create an `address public` variable called `kasei_token_address`.
address public kasei_token_address;
// Create an `address public` variable called `kasei_crowdsale_address`.
address public kasei_crowdsale_address;
// Add the constructor.
constructor(
string memory name,
string memory symbol,
address payable wallet,
// uint initialSupply
uint goal
) public {
// Create a new instance of the KaseiCoin contract.
KaseiCoin token;
token = new KaseiCoin(name, symbol, 0);
// Assign the token contract’s address to the `kasei_token_address` variable.
kasei_token_address = address(token);
// Create a new instance of the `KaseiCoinCrowdsale` contract
KaseiCoinCrowdsale kCrowdSale;
kCrowdSale = new KaseiCoinCrowdsale(1, wallet, token, goal, now, now + 30 minutes);
// Assign the `KaseiCoinCrowdsale` contract’s address to the `kasei_crowdsale_address` variable.
kasei_crowdsale_address = address (kCrowdSale);
// Set the `KaseiCoinCrowdsale` contract as a minter
token.addMinter(kasei_crowdsale_address);
// Have the `KaseiCoinCrowdsaleDeployer` renounce its minter role.
token.renounceMinter();
}
}