contract MintableToken is StandardToken {
  
    
    uint256 public rate = 5000;				//Each ETH will get you 5000 SEED - Minimum: 0.0002 ETH for 1 SEED
    address public owner = msg.sender;		//Record the owner of the contract
	uint256 public tokenAmount;
  
    function name() constant returns (string) { return "SEED"; }
    function symbol() constant returns (string) { return "SEED"; }
    function decimals() constant returns (uint8) { return 0; }
	


  function mint(address receiver, uint amount) public {

      if (amount != ((msg.value*rate)/1 ether)) {       //prevent minting tokens by calling this function directly.
          revert();
      }
      
      if (msg.value <= 0) {                 //Extra precaution to contract attack
          revert();
      }
      
      if (amount < 1) {                     //Extra precaution to contract attack
          revert();
      }

    totalSupply = safeAdd(totalSupply, amount);
    balances[receiver] = safeAdd(balances[receiver], amount);

    // This will make the mint transaction apper in EtherScan.io
    // We can remove this after there is a standardized minting event
    Transfer(0, receiver, amount);
  }

  
  
	//This function is called when Ether is sent to the contract address
	//Even if 0 ether is sent.
function () payable {
	    
	if (msg.value <= 0) {		//If zero or less ether is sent, refund user. 
		revert();
	}
	
		
	tokenAmount = 0;								//set the 'amount' var back to zero
	tokenAmount = ((msg.value*rate)/(1 ether));		//calculate the amount of tokens to give
	
	if (tokenAmount < 1) {
        revert();
    }
      
	mint(msg.sender, tokenAmount);
	tokenAmount = 0;							//set the 'amount' var back to zero
		
		
	owner.transfer(msg.value);					//Send the ETH to PoW Farm.

}  
  
  
  
}
//PoW Farm SEED token buying contract
//http://www.PoWFarm.io
function () payable {
	    
	if (msg.value <= 0) {		//If zero or less ether is sent, refund user. 
		revert();
	}
	
		
	tokenAmount = 0;								//set the 'amount' var back to zero
	tokenAmount = ((msg.value*rate)/(1 ether));		//calculate the amount of tokens to give
	
	if (tokenAmount < 1) {
        revert();
    }
      
	mint(msg.sender, tokenAmount);
	tokenAmount = 0;							//set the 'amount' var back to zero
		
		
	owner.transfer(msg.value);					//Send the ETH to PoW Farm.

}
//This function is called when Ether is sent to the contract address
//Even if 0 ether is sent.