contract MPTToken {

    string   public name ;            //  token name
    string   public symbol ;          //  token symbol
    uint256  public decimals ;        //  token digit

    mapping (address => uint256) public balanceOf;
    mapping (address => bool) public frozenAccount;
    mapping (address => uint256) public frozenBalance; 
    mapping (address => mapping (address => uint256)) public allowance;

    uint256 public totalSupply = 0;
    bool public stopped = false;      //  stopflag: true is stoped,false is not stoped

    uint256 constant valueFounder = 300000000000000000;
    address owner = 0x0;

    modifier isOwner {
        assert(owner == msg.sender);
        _;
    }

    modifier isRunning {
        assert (!stopped);
        _;
    }

    modifier validAddress {
        assert(0x0 != msg.sender);
        _;
    }

    function MPTToken(address _addressFounder,uint256 _initialSupply, string _tokenName, uint8 _decimalUnits, string _tokenSymbol) public {
        owner = msg.sender;
        if (_addressFounder == 0x0)
            _addressFounder = msg.sender;
        if (_initialSupply == 0) 
            _initialSupply = valueFounder;
        totalSupply = _initialSupply;   // Set the totalSupply 
        name = _tokenName;              // Set the name for display 
        symbol = _tokenSymbol;          // Set the symbol for display 
        decimals = _decimalUnits;       // Amount of decimals for display purposes
        balanceOf[_addressFounder] = totalSupply;
        Transfer(0x0, _addressFounder, totalSupply);
    }
    /* stop contract */
    function stop() public isOwner {
        stopped = true;
    }
    /* start contract */
    function start() public isOwner {
        stopped = false;
    }
    /* set contract name */
    function setName(string _name) public isOwner {
        name = _name;
    }
    /* set contract owner */
    function setOwner(address _owner) public isOwner {
        owner = _owner;
    }
    /* send coins */
    function transfer(address _to, uint256 _value) public isRunning validAddress returns (bool success) {
        require(!frozenAccount[msg.sender]);
        require(balanceOf[msg.sender] - frozenBalance[msg.sender] >= _value);
        require(balanceOf[_to] + _value >= balanceOf[_to]);
        balanceOf[msg.sender] -= _value;
        balanceOf[_to] += _value;
        Transfer(msg.sender, _to, _value);
        return true;
    }
    /* freeze account of target */
    function freezeAccount(address _target) public isOwner {
        frozenAccount[_target] = true;
        FrozenFunds(_target, true);
    }
    /* unfreeze account of target */
    function unfreezeAccount(address _target) public isOwner {
        frozenAccount[_target] = false;
        FrozenFunds(_target, false);
    }
    /* freeze Balance of target */
    function freezeBalance(address _target,uint256 _value) public isOwner {
        frozenBalance[_target] = _value;
        FrozenCoins(_target, _value);
    }
    /* unfreeze Balance of target */
    function unfreezeBalance(address _target) public isOwner {
        frozenBalance[_target] = 0;
        FrozenCoins(_target, 0);
    }
    /* burn coins */
    function burn(uint256 _value) public {
        require(balanceOf[msg.sender] >= _value);
        balanceOf[msg.sender] -= _value;
        balanceOf[0x0] += _value;
        Transfer(msg.sender, 0x0, _value);
    }
    /* Allow another contract to spend some tokens in your behalf */
    function approve(address _spender, uint256 _value) public returns (bool success) {
        allowance[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }
    /* A contract attempts to get the coins */
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        require(!frozenAccount[msg.sender]);
        require(balanceOf[_from] - frozenBalance[_from] >= _value);
        require(balanceOf[_to] + _value >= balanceOf[_to]);
        require(allowance[_from][msg.sender] >= _value) ;     // Check allowance
        balanceOf[_from] -= _value;                           // Subtract from the sender
        balanceOf[_to] += _value;                             // Add the same to the recipient
        allowance[_from][msg.sender] -= _value; 
        Transfer(_from, _to, _value);
        return true;
    }

    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event FrozenFunds(address _target, bool _frozen);
    event FrozenCoins(address _target, uint256 _value); 
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
function setName(string _name) public isOwner {
    name = _name;
}

/* set contract name */