contract EscrowVault is Ownable {
  using SafeMath for uint256;
  mapping (address => uint256) public deposited;
  address public wallet;
  event Closed();
  event Refunded(address indexed beneficiary, uint256 weiAmount);
  /**
   * @param _wallet Vault address
   */
  function EscrowVault(address _wallet) public {
    require(_wallet != address(0));
    wallet = _wallet;
   
  }
  /**
   * @param investor Investor address
   */
  function deposit(address investor) onlyOwner  payable {
    deposited[investor] = deposited[investor].add(msg.value);
  }
   function closeAfterWhitelisted(address _beneficiary) onlyOwner public {
   
    uint256 depositedValue = deposited[_beneficiary];
    deposited[_beneficiary] = 0;
    wallet.transfer(depositedValue);
  }
   

  /**
   * @param investor Investor address
   */
  function refund(address investor, uint256 _percentage)onlyOwner  {
    uint256 depositedValue = deposited[investor];
    depositedValue=depositedValue.sub(_percentage);
   
    investor.transfer(depositedValue);
    wallet.transfer(_percentage);
    emit Refunded(investor, depositedValue);
     deposited[investor] = 0;
  }
}
/**
 * @title EscrowVault
 * @dev This contract is used for storing funds while a crowdsale
 * is in progress. Supports refunding the money if whitelist fails,
 * and forwarding it if whitelist is successful.
 */
function deposit(address investor) onlyOwner  payable {
  deposited[investor] = deposited[investor].add(msg.value);
}

/**
 * @param investor Investor address
 */