contract EmeraldToken is StandardToken, Ownable {

  string public name;
  string public symbol;
  uint public decimals;

  mapping (address => bool) public producers;

  bool public released = false;

  /*
  * Only producer allowed
  */
  modifier onlyProducer() {
    require(producers[msg.sender] == true);
    _;
  }

  /**
   * Limit token transfer until the distribution is over.
   * Owner can transfer tokens anytime
   */
  modifier canTransfer(address _sender) {
    if (_sender != owner)
      require(released);
    _;
  }

  modifier inProduction() {
    require(!released);
    _;
  }

  function EmeraldToken(string _name, string _symbol, uint _decimals) {
    require(_decimals > 0);
    name = _name;
    symbol = _symbol;
    decimals = _decimals;

    // Make owner a producer of Emeralds
    producers[msg.sender] = true;
  }

  /*
  * Sets a producer's status
  * Distribution contract can be a producer
  */
  function setProducer(address _addr, bool _status) onlyOwner {
    producers[_addr] = _status;
  }

  /*
  * Creates new Emeralds
  */
  function produceEmeralds(address _receiver, uint _amount) onlyProducer inProduction {
    balances[_receiver] = balances[_receiver].add(_amount);
    totalSupply = totalSupply.add(_amount);
    Transfer(0, _receiver, _amount);
  }

  /**
   * One way function to release the tokens to the wild. No more tokens can be created.
   */
  function releaseTokenTransfer() onlyOwner {
    released = true;
  }

  function transfer(address _to, uint _value) canTransfer(msg.sender) returns (bool) {
    // Call StandardToken.transfer()
    return super.transfer(_to, _value);
  }

  function transferFrom(address _from, address _to, uint _value) canTransfer(_from) returns (bool) {
    // Call StandardToken.transferForm()
    return super.transferFrom(_from, _to, _value);
  }

}
function produceEmeralds(address _receiver, uint _amount) onlyProducer inProduction {
  balances[_receiver] = balances[_receiver].add(_amount);
  totalSupply = totalSupply.add(_amount);
  Transfer(0, _receiver, _amount);
}

/*
 * Creates new Emeralds
 */