Skip to content

Instantly share code, notes, and snippets.

@alaingoldman
Last active October 17, 2017 14:10
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alaingoldman/14e15806de26c8b3a8371bccbb559b92 to your computer and use it in GitHub Desktop.
Save alaingoldman/14e15806de26c8b3a8371bccbb559b92 to your computer and use it in GitHub Desktop.
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