pragma solidity ^0.4.11; contract OwnableWithDAO { address public owner; address public daoContract; constructor() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } modifier onlyDAO { require(msg.sender == daoContract); _; } function transferOwnership(address _newOwner) onlyOwner public { require(_newOwner != address(0)); owner = _newOwner; } function setDAOContract(address _newDAOContract) onlyOwner public { require(_newDAOContract != address(0)); daoContract = _newDAOContract; } } contract Stoppable is OwnableWithDAO { bool public isStopped; modifier stoppable { require(!isStopped); _; } function stop() onlyDAO public { isStopped = true; } function start() onlyDAO public { isStopped = false; } } contract DAOToken is Stoppable { string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; uint256 public buyPrice; mapping (address => uint256) public balanceOf; constructor() public { decimals = 0; buyPrice = 1000000000000000000; // 1 ETH equals 1 WDAT totalSupply = 10; name = "DAOToken"; symbol = "WDAT"; balanceOf[msg.sender] = totalSupply; } function () payable public { uint256 value = msg.value/buyPrice; // Amount of WDAT to buy _transfer(this, msg.sender, value); } function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } function changeBuyPrice(uint256 _newBuyPrice) onlyDAO public { buyPrice = _newBuyPrice; } function _transfer(address _from, address _to, uint256 _value) stoppable internal { require(_to != address(0)); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); balanceOf[_from] -= _value; balanceOf[_to] += _value; } }
0.4.24