-
Notifications
You must be signed in to change notification settings - Fork 498
/
TokenCreation.sol
68 lines (56 loc) · 2.3 KB
/
TokenCreation.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
/*
This file is part of the DAO.
The DAO is free software: you can redistribute it and/or modify
it under the terms of the GNU lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The DAO is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU lesser General Public License for more details.
You should have received a copy of the GNU lesser General Public License
along with the DAO. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Token Creation contract, used by the DAO to create its tokens and initialize
* its ether. Feel free to modify the divisor method to implement different
* Token Creation parameters
*/
import "./Token.sol";
pragma solidity ^0.4.4;
contract TokenCreationInterface {
/// @dev Constructor setting the minimum fueling goal and the
/// end of the Token Creation
/// (the address can also create Tokens on behalf of other accounts)
// This is the constructor: it can not be overloaded so it is commented out
// function TokenCreation(
// string _tokenName,
// string _tokenSymbol,
// uint _decimalPlaces
// );
/// @notice Create Token with `_tokenHolder` as the initial owner of the Token
/// @param _tokenHolder The address of the Tokens's recipient
/// @return Whether the token creation was successful
function createTokenProxy(address _tokenHolder) payable returns (bool success);
event CreatedToken(address indexed to, uint amount);
}
contract TokenCreation is TokenCreationInterface, Token {
function TokenCreation(
string _tokenName,
string _tokenSymbol,
uint _decimalPlaces,
Plutocracy _plutocracy) Token(_plutocracy) {
name = _tokenName;
symbol = _tokenSymbol;
decimals = _decimalPlaces;
}
function createTokenProxy(address _tokenHolder) payable returns (bool success) {
if (msg.value > 0 && this.balance + msg.value > 100000 ether) {
balances[_tokenHolder] += msg.value;
totalSupply += msg.value;
CreatedToken(_tokenHolder, msg.value);
return true;
}
throw;
}
}