contract MenloTokenSale is MenloSaleBase {

  // Timestamps for the bonus periods, set in the constructor
  uint256 public HOUR1;
  uint256 public WEEK1;
  uint256 public WEEK2;
  uint256 public WEEK3;
  uint256 public WEEK4;

  constructor(
    MenloToken _token,
    uint256 _startTime,
    uint256 _endTime,
    uint256 _cap,
    address _wallet
  ) MenloSaleBase(
    _token,
    _startTime,
    _endTime,
    _cap,
    _wallet
  ) public {
    HOUR1 = startTime + 1 hours;
    WEEK1 = startTime + 1 weeks;
    WEEK2 = startTime + 2 weeks;
    WEEK3 = startTime + 3 weeks;
  }

  // Hour 1: 30% Bonus
  // Week 1: 15% Bonus
  // Week 2: 10% Bonus
  // Week 3: 5% Bonus
  // Week 4: 0% Bonus
  function calculateBonusRate() public view returns (uint256) {
    uint256 _bonusRate = 12000;

    uint256 _currentTime = getBlockTimestamp();
    if (_currentTime > startTime && _currentTime <= HOUR1) {
      _bonusRate =  15600;
    } else if (_currentTime <= WEEK1) {
      _bonusRate =  13800; // week 1
    } else if (_currentTime <= WEEK2) {
      _bonusRate =  13200; // week 2
    } else if (_currentTime <= WEEK3) {
      _bonusRate =  12600; // week 3
    }
    return _bonusRate;
  }

  function buyTokensHook(uint256 _tokens) internal {
    token.transfer(msg.sender, _tokens);
    emit TokenRedeem(msg.sender, _tokens);
  }
}
function calculateBonusRate() public view returns (uint256) {
  uint256 _bonusRate = 12000;

  uint256 _currentTime = getBlockTimestamp();
  if (_currentTime > startTime && _currentTime <= HOUR1) {
    _bonusRate =  15600;
  } else if (_currentTime <= WEEK1) {
    _bonusRate =  13800; // week 1
  } else if (_currentTime <= WEEK2) {
    _bonusRate =  13200; // week 2
  } else if (_currentTime <= WEEK3) {
    _bonusRate =  12600; // week 3
  }
  return _bonusRate;
}

// Hour 1: 30% Bonus
// Week 1: 15% Bonus
// Week 2: 10% Bonus
// Week 3: 5% Bonus
// Week 4: 0% Bonus