You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
792 B
38 lines
792 B
pragma solidity ^0.4.4;
|
|
|
|
|
|
import "./StandardToken.sol";
|
|
|
|
|
|
/*
|
|
* CrowdsaleToken
|
|
*
|
|
* Simple ERC20 Token example, with crowdsale token creation
|
|
*/
|
|
contract CrowdsaleToken is StandardToken {
|
|
|
|
string public name = "CrowdsaleToken";
|
|
string public symbol = "CRW";
|
|
uint public decimals = 18;
|
|
|
|
// 1 ether = 500 example tokens
|
|
uint PRICE = 500;
|
|
|
|
function () payable {
|
|
createTokens(msg.sender);
|
|
}
|
|
|
|
function createTokens(address recipient) payable {
|
|
if (msg.value == 0) throw;
|
|
|
|
uint tokens = safeMul(msg.value, getPrice());
|
|
|
|
totalSupply = safeAdd(totalSupply, tokens);
|
|
balances[recipient] = safeAdd(balances[recipient], tokens);
|
|
}
|
|
|
|
// replace this with any other price function
|
|
function getPrice() constant returns (uint result){
|
|
return PRICE;
|
|
}
|
|
}
|
|
|