Last active
October 17, 2017 14:10
-
-
Save alaingoldman/14e15806de26c8b3a8371bccbb559b92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
contract myico { | |
address public admin; | |
mapping(address => uint) balance; | |
uint public initial_supply = 1000000; | |
string public tokenName = "ICO"; | |
function myico() public{ | |
admin = msg.sender; | |
} | |
modifier admin_only(){ | |
require(admin == msg.sender); | |
_; | |
} | |
function printMoreMoney(uint x) admin_only public{ | |
initial_supply += x; | |
warningUsers(msg.sender, "is printing ...", x); | |
} | |
event warningUsers(address, string, uint); | |
function givemeyourmoney() public payable{ | |
uint tempValue = (msg.value / 1 ether); | |
require(msg.value >= 1 ether); | |
require(initial_supply >= tempValue); | |
initial_supply -= tempValue; | |
balance[msg.sender] += tempValue; | |
} | |
function coinbalance() constant public returns(uint){ | |
return balance[msg.sender]; | |
} | |
function contractBalance() constant public returns(uint){ | |
require(admin == msg.sender); | |
return this.balance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment