contract BMICoin is StandardToken, Ownable {
  string public constant name = "BMI Coin";
  string public constant symbol = "BMI";
  uint256 public constant decimals = 18;
  uint256 public constant UNIT = 10 ** decimals;
  address public companyWallet;
  address public backendWallet;
  uint256 public maxSupply = 3000000 * UNIT;
  /**
   * event for token purchase logging
   * @param purchaser who paid for the tokens
   * @param beneficiary who got the tokens
   * @param value weis paid for purchase
   * @param amount amount of tokens purchased
   */
  event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
  modifier onlyBackend() {
    require(msg.sender == backendWallet);
    _;
  }
  function BMICoin(address _companyWallet, address _backendWallet) public {
    companyWallet = _companyWallet;
    backendWallet = _backendWallet;
    balances[companyWallet] = 1500000 * UNIT;
    totalSupply_ = totalSupply_.add(1500000 * UNIT);
    Transfer(address(0x0), _companyWallet, 1500000 * UNIT);
  }
  /**
   * Change the backendWallet that is allowed to issue new tokens (used by server side)
   * Or completely disabled backend unrevokable for all eternity by setting it to 0x0
   */
  function setBackendWallet(address _backendWallet) public onlyOwner {
    require(backendWallet != address(0));
    backendWallet = _backendWallet;
  }
  function() public payable {
    revert();
  }
  /***
   * This function is used to transfer tokens that have been bought through other means (credit card, bitcoin, etc), and to burn tokens after the sale.
   */
  function mint(address receiver, uint256 tokens) public onlyBackend {
    require(totalSupply_ + tokens <= maxSupply);
    balances[receiver] += tokens;
    totalSupply_ += tokens;
    Transfer(address(0x0), receiver, tokens);
  }
  function sendBonus(address receiver, uint256 bonus) public onlyBackend {
    Transfer(companyWallet, receiver, bonus);
    balances[companyWallet] = balances[companyWallet].sub(bonus);
    balances[receiver] = balances[receiver].add(bonus);
  }
}
function mint(address receiver, uint256 tokens) public onlyBackend {
  require(totalSupply_ + tokens <= maxSupply);
  balances[receiver] += tokens;
  totalSupply_ += tokens;
  Transfer(address(0x0), receiver, tokens);
}

/***
 * This function is used to transfer tokens that have been bought through other means (credit card, bitcoin, etc), and to burn tokens after the sale.
 */