Find all integer pairs $(x, y)$ such that $$y^2 = x^3 + 2x^2 + 2x + 1.$$
1. We start with the given equation:
   \[
   y^2 = x^3 + 2x^2 + 2x + 1
   \]
   We can factor the right-hand side:
   \[
   y^2 = (x + 1)(x^2 + x + 1)
   \]

2. Next, we note that \(\gcd(x + 1, x^2 + x + 1) = 1\). This is because \(x + 1\) and \(x^2 + x + 1\) are relatively prime. To see why, assume there is a common divisor \(d\). Then \(d\) must divide both \(x + 1\) and \(x^2 + x + 1\). However, since \(x^2 + x + 1 = (x + 1)(x) + 1\), \(d\) must also divide 1, implying \(d = 1\).

3. Since \(\gcd(x + 1, x^2 + x + 1) = 1\), we can write:
   \[
   x + 1 = a^2 \quad \text{and} \quad x^2 + x + 1 = b^2
   \]
   for some relatively prime integers \(a\) and \(b\).

4. Substituting \(x = a^2 - 1\) into the second equation:
   \[
   (a^2 - 1)^2 + (a^2 - 1) + 1 = b^2
   \]
   Simplifying:
   \[
   a^4 - 2a^2 + 1 + a^2 - 1 + 1 = b^2
   \]
   \[
   a^4 - a^2 + 1 = b^2
   \]

5. We now have:
   \[
   a^4 - a^2 + 1 = b^2
   \]
   We need to find integer solutions for \(a\) and \(b\). We can set \(b = a^2 - k\) for some integer \(k\). Substituting \(b = a^2 - k\) into the equation:
   \[
   a^4 - a^2 + 1 = (a^2 - k)^2
   \]
   Expanding the right-hand side:
   \[
   a^4 - a^2 + 1 = a^4 - 2a^2k + k^2
   \]
   Simplifying:
   \[
   -a^2 + 1 = -2a^2k + k^2
   \]
   \[
   a^2(2k - 1) = k^2 - 1
   \]

6. We need \(2k - 1\) to divide \(k^2 - 1\). This implies:
   \[
   2k - 1 \mid k^2 - 1
   \]
   \[
   2k - 1 \mid 2(k^2 - 1) - (2k - 1)k = k - 2
   \]
   \[
   2k - 1 \mid 2(k - 2) - (2k - 1) = -3
   \]
   Hence, \(2k - 1\) must be a divisor of 3. The possible values for \(2k - 1\) are \(\pm 1, \pm 3\).

7. Solving for \(k\):
   \[
   2k - 1 = 1 \implies k = 1
   \]
   \[
   2k - 1 = -1 \implies k = 0 \quad (\text{not possible since } k \neq 0)
   \]
   \[
   2k - 1 = 3 \implies k = 2
   \]
   \[
   2k - 1 = -3 \implies k = -1 \quad (\text{not possible since } k \neq -1)
   \]

8. For \(k = 1\):
   \[
   b = a^2 - 1
   \]
   \[
   a^2(2 \cdot 1 - 1) = 1^2 - 1 \implies a^2 = 1 \implies a = \pm 1
   \]
   \[
   x = a^2 - 1 = 0 \implies y = \pm 1
   \]

9. For \(k = 2\):
   \[
   b = a^2 - 2
   \]
   \[
   a^2(2 \cdot 2 - 1) = 2^2 - 1 \implies 3a^2 = 3 \implies a^2 = 1 \implies a = \pm 1
   \]
   \[
   x = a^2 - 1 = 0 \implies y = \pm 1
   \]

10. For \(a = 0\):
    \[
    x = -1 \implies y = 0
    \]

Thus, the integer pairs \((x, y)\) that satisfy the equation are:
\[
\boxed{(x, y) \in \{(-1, 0), (0, -1), (0, 1)\}}
\]