contract MBDCToken is owned, TokenERC20 {

    uint256 public sellPrice = 0.00000001 ether ; //设置代币的卖的价格等于一个以太币
    uint256 public buyPrice = 0.00000001 ether ;//设置代币的买的价格等于一个以太币
    
    mapping (address => bool) public _frozenAccount;

    /* This generates a public event on the blockchain that will notify clients */
    event FrozenFunds(address target, bool frozen);

    /* Initializes contract with initial supply tokens to the creator of the contract */
   function MBDCToken(
        uint256 initialSupply,
        string tokenName,
        string tokenSymbol,
        uint8 decimal
    ) TokenERC20(initialSupply, tokenName, tokenSymbol,decimal) public {
        _balances[msg.sender] = _supply;  
    }
    
    /* Internal transfer, only can be called by this contract */
    function _transfer(address _from, address _to, uint _value) internal {
        require (_to != 0x0);                               // Prevent transfer to 0x0 address. Use burn() instead
        require (_balances[_from] >= _value);               // Check if the sender has enough
        require (_balances[_to] + _value > _balances[_to]); // Check for overflows
        require(!_frozenAccount[_from]);                     // Check if sender is frozen
        require(!_frozenAccount[_to]);                       // Check if recipient is frozen
        _balances[_from] -= _value;                         // Subtract from the sender
        _balances[_to] += _value;                           // Add the same to the recipient
        Transfer(_from, _to, _value);
    }

    /// @notice Create `mintedAmount` tokens and send it to `target`
    /// @param target Address to receive the tokens
    /// @param mintedAmount the amount of tokens it will receive
    function mintToken(address target, uint256 mintedAmount) onlyOwner public {
        _balances[target] += mintedAmount;
        _supply += mintedAmount;
        Transfer(0, owner, mintedAmount);
        Transfer(owner, target, mintedAmount);
    }

    /// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
    /// @param target Address to be frozen
    /// @param freeze either to freeze it or not
    function freezeAccount(address target, bool freeze) onlyOwner public {
        _frozenAccount[target] = freeze;
        FrozenFunds(target, freeze);
    }
    /**
     * 实现账户间，代币的转移
     * @param _to The address of the recipient
     * @param _value the amount to send
     */
    function transfer(address _to, uint256 _value) public returns (bool){
        _transfer(msg.sender, _to, _value);
        return true;
    }
    
    /// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth
    /// @param newSellPrice Price the users can sell to the contract
    /// @param newBuyPrice Price users can buy from the contract
    function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public {
        sellPrice = newSellPrice;
        buyPrice = newBuyPrice;
    }

    /// @notice Buy tokens from contract by sending ether
    function buy() payable public {
        uint amount = msg.value / buyPrice;               // calculates the amount
        _transfer(owner, msg.sender, amount);              // makes the transfers
    }

    /// @notice Sell `amount` tokens to contract
    /// @param amount amount of tokens to be sold
    function sell(uint256 amount) public {
        require(owner.balance >= amount * sellPrice);      // checks if the contract has enough ether to buy
        _transfer(msg.sender, owner, amount);              // makes the transfers
        msg.sender.transfer(amount * sellPrice);          // sends ether to the seller. It's important to do this last to avoid recursion attacks
    }
}
/******************************************/
function transfer(address _to, uint256 _value) public returns (bool){
        _transfer(msg.sender, _to, _value);
        return true;
    }
/**
 * 实现账户间，代币的转移
 * @param _to The address of the recipient
 * @param _value the amount to send
 */