pragma solidity ^0.4.11; contract WorkshopWrongICOV6 { string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; uint public buyPrice; uint internal _icoStartTime; mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; event Transfer(address from, address to, uint256 value); event Approval(address from, address to, uint256 value); constructor() public { decimals = 8; totalSupply = 1000000 * (10 ** uint256(decimals)); buyPrice = 1000; _icoStartTime = now; name = "WRONG-ICO-V7"; symbol = "WRIC7"; balanceOf[msg.sender] = totalSupply; } function _transfer(address _from, address _to, uint256 _value) internal { require(_to != 0x0); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); balanceOf[_from] -= _value; balanceOf[_to] += _value; emit Transfer(_from, _to, _value); } function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } function transferFrom(address _from, address _to, uint256 _value) public { require(allowance[_from][_to] >= _value); allowance[_from][_to] -= _value; _transfer(_from, _to, _value); } function approve(address _to, uint256 _value) public { allowance[msg.sender][_to] = _value; emit Approval(msg.sender, _to, _value); } function () payable public { _buy(msg.sender, msg.value); } function buy() payable public { _buy(msg.sender, msg.value); } function _buy(address _from, uint256 _value) internal { if((now > _icoStartTime + 15 minutes) && (now < _icoStartTime + 30 minutes)) { buyPrice = buyPrice/2; } else if(now < _icoStartTime + 15 minutes) { buyPrice = buyPrice/3; } uint256 amount = _value/buyPrice; _transfer(this, _from, amount); } }
0.4.24