-
Notifications
You must be signed in to change notification settings - Fork 0
/
KaseiCoinCrowdsale.sol
58 lines (45 loc) · 2.2 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
pragma solidity ^0.5.5;
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 {
// 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
}
}
// The deployer contract will create our new KaseiCoin and KaseiCoinCrowdsale contracts by calling the constructor functions of those contracts.
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 // this address will receive all Ether raised by the sale
) 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);
// Aassign 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();
}
}