/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

contract Escapable is Ownable, ReentrancyGuard {
  using SafeERC20 for IERC20;

  /// @notice The `escapeHatch()` should only be called as a last resort if a
  /// security issue is uncovered or something unexpected happened
  /// @param _token to transfer, use 0x0 for ether
  function escapeHatch(address _token, address payable _escapeHatchDestination) external onlyOwner nonReentrant {
    require(_escapeHatchDestination != address(0x0));

    uint256 balance;

    /// @dev Logic for ether
    if (_token == address(0x0)) {
      balance = address(this).balance;
      _escapeHatchDestination.transfer(balance);
      EscapeHatchCalled(_token, balance);
      return;
    }
    // Logic for tokens
    IERC20 token = IERC20(_token);
    balance = token.balanceOf(address(this));
    token.safeTransfer(_escapeHatchDestination, balance);
    emit EscapeHatchCalled(_token, balance);
  }

  event EscapeHatchCalled(address token, uint256 amount);
}

contract MultiTransfer is Pausable {
  using SafeMath for uint256;

  function multiTransfer_OST(address payable[] calldata _addresses, uint256 _amounts)
  payable external whenNotPaused returns(bool)
  {
    uint256 _value = msg.value;
    for (uint8 i; i < _addresses.length; i++) {
      _value = _value.sub(_amounts);

      // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
      /*(success, ) = */_addresses[i].call{ value: _amounts }("");
      // we do not care. caller should check sending results manually and re-send if needed.
    }
    return true;
  }
}

contract MultiSend is Pausable, Escapable,
  MultiTransfer
{
  /// @dev Emergency stop contract in a case of a critical security flaw discovered
  function emergencyStop() external onlyOwner {
      _pause();
  }

  /// @dev Default payable function to not allow sending to contract;
  receive() external payable {
    revert("Can not accept Ether directly.");
  }

  /// @dev Notice callers if functions that do not exist are called
  fallback() external payable { require(msg.data.length == 0); }
}
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EscapeHatchCalled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"emergencyStop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address payable","name":"_escapeHatchDestination","type":"address"}],"name":"escapeHatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable[]","name":"_addresses","type":"address[]"},{"internalType":"uint256","name":"_amounts","type":"uint256"}],"name":"multiTransfer_OST","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]