Commit ab9eecb1 by Manuel Araoz

6.1 fix stuck Ether in Crowdsale contract

parent 52120a8c
...@@ -8,15 +8,20 @@ import "./StandardToken.sol"; ...@@ -8,15 +8,20 @@ import "./StandardToken.sol";
* CrowdsaleToken * CrowdsaleToken
* *
* Simple ERC20 Token example, with crowdsale token creation * Simple ERC20 Token example, with crowdsale token creation
* IMPORTANT NOTE: do not use or deploy this contract as-is.
* It needs some changes to be production ready.
*/ */
contract CrowdsaleToken is StandardToken { contract CrowdsaleToken is StandardToken {
string public name = "CrowdsaleToken"; string public constant name = "CrowdsaleToken";
string public symbol = "CRW"; string public constant symbol = "CRW";
uint public decimals = 18; uint public constant decimals = 18;
// replace with your fund collection multisig address
address public constant multisig = 0x0;
// 1 ether = 500 example tokens // 1 ether = 500 example tokens
uint PRICE = 500; uint public constant PRICE = 500;
function () payable { function () payable {
createTokens(msg.sender); createTokens(msg.sender);
...@@ -28,9 +33,13 @@ contract CrowdsaleToken is StandardToken { ...@@ -28,9 +33,13 @@ contract CrowdsaleToken is StandardToken {
} }
uint tokens = safeMul(msg.value, getPrice()); uint tokens = safeMul(msg.value, getPrice());
totalSupply = safeAdd(totalSupply, tokens); totalSupply = safeAdd(totalSupply, tokens);
balances[recipient] = safeAdd(balances[recipient], tokens); balances[recipient] = safeAdd(balances[recipient], tokens);
if (!multisig.send(msg.value)) {
throw;
}
} }
// replace this with any other price function // replace this with any other price function
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment