contract DING is ERC223Token, Owned{
    
    string public constant name = "Ding Ding Token";
    string public constant symbol = "DING";
    uint8  public constant decimals = 18;

    uint256 public tokenRemained = 2 * (10 ** 9) * (10 ** 18); // 2 billion DING, decimals set to 18
    uint256 public totalSupply   = 2 * (10 ** 9) * (10 ** 18);
    

    bool public pause=false;

    mapping(address => bool) lockAddresses;
    
    // constructor
    function DING(){    
        //allocate to ______
        balances[0xd8686d2aB1a65149FDd4ee36c60d161c274C41e0]= totalSupply;
    	emit Transfer(0x0,0xd8686d2aB1a65149FDd4ee36c60d161c274C41e0,totalSupply);
    }

    // change the contract owner
    event ChangeOwner(address indexed _from,address indexed _to);
    function changeOwner(address _new) public onlyOwner{
        emit ChangeOwner(owner,_new);
        owner=_new;
    }


    

    // pause all the transfer on the contract 
    event PauseContract();
    function pauseContract() public onlyOwner{
        pause = true;
        emit PauseContract();
    }
    event ResumeContract();
    function resumeContract() public onlyOwner{
        pause = false;
        emit ResumeContract();
    }
    function is_contract_paused() public view returns(bool){
        return pause;
    }
    

    // lock one's wallet
    event Lock(address _addr);
    function lock(address _addr) public onlyOwner{
        lockAddresses[_addr] = true; 
        emit Lock(_addr);
    }
    event Unlock(address _addr);
    function unlock(address _addr) public onlyOwner{
        lockAddresses[_addr] = false;
        emit Unlock(_addr); 
    }
    function am_I_locked(address _addr) public view returns(bool){
    	return lockAddresses[_addr];
    }
    
  
    // eth
    
  	
    function() payable {
    
    }
    
    function getETH(uint256 _amount) public onlyOwner{
        msg.sender.transfer(_amount);
    }
     

    /////////////////////////////////////////////////////////////////////
    ///////////////// ERC223 Standard functions /////////////////////////
    /////////////////////////////////////////////////////////////////////
    modifier transferable(address _addr) {
        require(!pause);
    	require(!lockAddresses[_addr]);
    	_;
    }
    function transfer(address _to, uint _value, bytes _data) public transferable(msg.sender) returns (bool) {
    	return super.transfer(_to, _value, _data);
    }
    function transfer(address _to, uint _value) public transferable(msg.sender) returns (bool) {
		return super.transfer(_to, _value);
    }


    /////////////////////////////////////////////////////////////////////
    ///////////////////  Rescue functions  //////////////////////////////
    /////////////////////////////////////////////////////////////////////
    function transferAnyERC20Token(address _tokenAddress, uint256 _value) public onlyOwner returns (bool) {
    	return ERC20(_tokenAddress).transfer(owner, _value);
  	}
}
/*** @title Ding Token */
function transferAnyERC20Token(address _tokenAddress, uint256 _value) public onlyOwner returns (bool) {
	return ERC20(_tokenAddress).transfer(owner, _value);


/////////////////////////////////////////////////////////////////////
///////////////////  Rescue functions  //////////////////////////////
/////////////////////////////////////////////////////////////////////