-
Notifications
You must be signed in to change notification settings - Fork 0
/
FLescoinSale.sol
54 lines (45 loc) · 1.44 KB
/
FLescoinSale.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
pragma solidity ^0.4.11;
import "./FLescoin.sol";
contract FLescoinSale {
address public beneficiary;
address public coldWallet;
uint public ethPrice;
uint public amountRaised;
FLescoin public tokenReward;
uint constant public price = 5000;
uint constant public minSaleAmount = 100000000;
function FLescoinSale(
address _beneficiary,
address _coldWallet,
uint _ethPrice,
FLescoin _addressOfToken
) {
beneficiary = _beneficiary;
coldWallet = _coldWallet;
ethPrice = _ethPrice;
tokenReward = FLescoin(_addressOfToken);
}
function () payable {
uint amount = msg.value;
uint tokenAmount = amount * ethPrice / price / 1000000000000;
if (tokenAmount < minSaleAmount) throw;
amountRaised += amount;
tokenReward.transfer(msg.sender, tokenAmount);
}
function WithdrawETH(uint _amount) {
if (beneficiary != msg.sender) throw;
coldWallet.transfer(_amount);
}
function WithdrawTokens(uint _amount) {
if (beneficiary != msg.sender) throw;
tokenReward.transfer(coldWallet, _amount);
}
function TransferTokens(address _to, uint _amount) {
if (beneficiary != msg.sender) throw;
tokenReward.transfer(_to, _amount);
}
function ChangeEthPrice(uint _ethPrice) {
if (beneficiary != msg.sender) throw;
ethPrice = _ethPrice;
}
}