library BytesLib {
  /**
   * @notice Converts bytes to address
   * @param data data
   * @return address
   */
  function toAddress(
    bytes memory data
  )
    internal
    pure
    returns (address)
  {
    address result;

    require(
      data.length == 20,
      "BytesLib: invalid data length"
    );

    // solhint-disable-next-line no-inline-assembly
    assembly {
      result := div(mload(add(data, 0x20)), 0x1000000000000000000000000)
    }

    return result;
  }
}
/**
 * @title Bytes library
 *
 * @author Stanisław Głogowski <stan@pillarproject.io>
 */
function toAddress(
  bytes memory data
)
  internal
  pure
  returns (address)
{
  address result;

  require(
    data.length == 20,
    "BytesLib: invalid data length"
  );

  // solhint-disable-next-line no-inline-assembly
  assembly {
    result := div(mload(add(data, 0x20)), 0x1000000000000000000000000)
  }

  return result;
}

/**
 * @notice Converts bytes to address
 * @param data data
 * @return address
 */