contract BtzToken is Standard223Token {
  using SafeMath for *;
  address public owner;

  // BTZ Token parameters
  string public name = "BTZ by Bunz";
  string public symbol = "BTZ";
  uint8 public constant decimals = 18;
  uint256 public constant decimalFactor = 10 ** uint256(decimals);
  uint256 public constant totalSupply = 200000000000 * decimalFactor;

  // Variables for deposit functionality
  bool public prebridge;
  BtzReceiver receiverContract;
  address public receiverContractAddress = 0x0;

  event Deposit(address _to, uint _value);

  /**
  * @dev Constructor function for BTZ creation
  */
  constructor() public {
    owner = msg.sender;
    balances[owner] = totalSupply;
    prebridge = true;
    receiverContract = BtzReceiver(receiverContractAddress);

    Transfer(address(0), owner, totalSupply);
  }

  modifier onlyOwner() {
      require(msg.sender == owner);
      _;
  }

  function setOwner(address _addr) public onlyOwner {
      owner = _addr;
  }

  /**
  * @dev Gives admin the ability to switch prebridge states.
  *
  */
  function togglePrebrdige() onlyOwner {
      prebridge = !prebridge;
  }

  /**
  * @dev Gives admin the ability to update the address of reciever contract
  *
  * @param _newAddr The address of the new receiver contract
  */
  function setReceiverContractAddress(address _newAddr) onlyOwner {
      receiverContractAddress = _newAddr;
      receiverContract = BtzReceiver(_newAddr);
  }

  /**
  * @dev Deposit function for users to send tokens to Bunz Application
  *
  * @param _value A uint representing the amount of BTZ to deposit
  */
  function deposit(uint _id, uint _value) public {
      require(prebridge &&
              balances[msg.sender] >= _value);
      balances[msg.sender] = balances[msg.sender].sub(_value);
      balances[receiverContractAddress] = balances[receiverContractAddress].add(_value);
      emit Transfer(msg.sender, receiverContractAddress, _value);
      receiverContract.receiveDeposit(_id, _value);
  }
}
function togglePrebrdige() onlyOwner {
    prebridge = !prebridge;
}

/**
 * @dev Gives admin the ability to switch prebridge states.
 *
 */