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);
  }
  
  /**
   * @dev Transfers deposited amount to wallet address after verification is completed.
   * @param _beneficiary depositor address.
   */
  function closeAfterWhitelisted(address _beneficiary) onlyOwner public { 
    uint256 depositedValue = deposited[_beneficiary];
    deposited[_beneficiary] = 0;
    wallet.transfer(depositedValue);
  }
  
  /**
   * @param investor Investor address
   */
  function debitForFailed(address investor, uint256 _debit)public onlyOwner  {
     uint256 depositedValue = deposited[investor];
     depositedValue=depositedValue.sub(_debit);
     wallet.transfer(_debit);
     deposited[investor] = depositedValue;
  }
   
  /**
   * @dev 
   * @param investor Investor address
   */
  function refund(address investor)public onlyOwner  {
    uint256 depositedValue = deposited[investor];
    investor.transfer(depositedValue);
     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 refund(address investor)public onlyOwner  {
  uint256 depositedValue = deposited[investor];
  investor.transfer(depositedValue);
   emit Refunded(investor, depositedValue);
   deposited[investor] = 0;
}

/**
 * @dev 
 * @param investor Investor address
 */