-
Notifications
You must be signed in to change notification settings - Fork 0
/
KaseiCoinCrowdsale.sol
60 lines (48 loc) · 2.17 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
pragma solidity ^0.5.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";
// Have the KaseiCoinCrowdsale contract inherit the following OpenZeppelin:
// * Crowdsale
// * MintedCrowdsale
contract KaseiCoinCrowdsale is Crowdsale, MintedCrowdsale { // UPDATE THE CONTRACT SIGNATURE TO ADD INHERITANCE
// Provide parameters for all of the features of your crowdsale, such as the `rate`, `wallet` for fundraising, and `token`.
constructor(
uint256 rate,
address payable wallet,
KaseiCoin token
)
Crowdsale(rate, wallet, token)
public
{
// constructor can stay empty
}
}
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
)
public
{
// Create a new instance of the KaseiCoin contract.
KaseiCoin 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 kasei_crowdsale =
new KaseiCoinCrowdsale (1, wallet, token);
// Assign the `KaseiCoinCrowdsale` contract’s address to the `kasei_crowdsale_address` variable.
kasei_crowdsale_address = address (kasei_crowdsale);
// Set the `KaseiCoinCrowdsale` contract as a minter
token.addMinter(kasei_crowdsale_address);
// Have the `KaseiCoinCrowdsaleDeployer` renounce its minter role.
token.renounceMinter();
}
}