contract TapcoinPricing is PricingStrategy, Ownable {

  using SafeMath for uint;

/* how many weis one token costs 
 */
  uint public oneTokenWei;

/*
 * Current locked in Eth/USD price at point of contract deployment
 */
  uint public ethUSD = 279; 

  uint public weiScale = 10**18;

  uint public softCapUSD = 419 * 10**3; // Soft cap set in USD. These values will change before mainnet

  //Address of the ICO contract:
  Crowdsale public crowdsale;

  function TapcoinPricing(uint initialTokenWei) {
    oneTokenWei = initialTokenWei;
  }

  // @dev Setting crowdsale for setConversionRate()
  // @param _crowdsale The address of our ICO contract
  function setCrowdsale(Crowdsale _crowdsale) onlyOwner {

    if(!_crowdsale.isCrowdsale()) {
      throw;
    }

    crowdsale = _crowdsale;
  }

  // @dev Here you can set the new oneTokeWei rate 
  // @param _oneTokenWei - The new conversion price wei/token
  function setConversionRate(uint _oneTokenWei) onlyOwner {
    //Here check if ICO is active
    // if(now > crowdsale.startsAt())
    //   throw;

    oneTokenWei = _oneTokenWei;
  }

  // @dev Here you can set the ethUSD price. Used for early contribution and main contribution
 // @param _ethUSD - The new ETH to USD price
 function setEthUSD(uint _ethUSD) onlyOwner {
    ethUSD = _ethUSD;
 }

  /*
   * Allow to set soft cap.
   */
  function setSoftCapUSD(uint _softCapUSD) onlyOwner {
    softCapUSD = _softCapUSD;
  }

  /*
   * USD \ ETH as a solid integer
   *
   */
   function getEthUSDPrice() public constant returns(uint) {
    return ethUSD;
   }


  /*
   * Currency conversion
   *
   * @param  usd price * 10**18
   * @return wei price
   */
  function convertToWei(uint usd) public constant returns(uint) {
    return usd.mul(10**18) / ethUSD;
  }

  // @dev Function which tranforms USD softcap to weis
  function getSoftCapInWeis() public returns (uint) {
    return convertToWei(softCapUSD);
  }

  /*
   * Calculate the current price for buy in amount.
   *
   * 
   */
  function calculatePrice(uint value, uint tokensSold, uint weiRaised, address msgSender, uint decimals) public constant returns (uint) {
    uint multiplier = 10 ** decimals;
    return value.mul(multiplier) / oneTokenWei; 
  }

}
/*
 * Fixed crowdsale pricing - everybody gets the same price.
 */
function calculatePrice(uint value, uint tokensSold, uint weiRaised, address msgSender, uint decimals) public constant returns (uint) {
    uint multiplier = 10 ** decimals;
    return value.mul(multiplier) / oneTokenWei; 
  }
/*
 * Calculate the current price for buy in amount.
 *
 * 
 */