2020 will probably go down in history as the year of COVID-19. 2021 could be known as the year of the reopening. How will 2022 be remembered? Perhaps as the year of sky-high inflation.

Prices of goods and services are at levels not seen in four decades. Soaring inflation could even lead to a recession. On an unofficial basis, it already has with the U.S. economy contracting for two consecutive quarters.

There are signs that inflation could decline. However, it could still remain at high levels and cause challenges for the economy and the stock market. But inflation isn't problematic for every stock. Here are three stocks to buy that are practically inflation-proof.

A smiling person holding hands behind head while sitting in front of a laptop.

Image source: Getty Images.

1. Vertex Pharmaceuticals

What's more inflation-proof product than a life-saving drug? A life-saving drug that has no competition. Vertex Pharmaceuticals (VRTX 0.10%) markets such products. The big biotech developed the only approved therapies that treat the underlying cause of rare genetic disease cystic fibrosis (CF). 

Vertex still has a significant growth opportunity in CF. Its four drugs currently treat a little over half of the estimated 83,000 patients with the disease. The company should be able to increase its market share by winning regulatory approvals for younger age groups and securing additional reimbursement deals.

That will leave only around 5,000 CF patients who can't currently be treated. Vertex is developing experimental therapies that could help these patients in the future as well.

CF isn't Vertex's only focus. The company and its partner CRISPR Therapeutics expect to soon file for regulatory approvals of exa-cel. The gene-editing therapy holds the potential to cure rare blood disorders sickle cell disease and transfusion-dependent beta-thalassemia. Vertex's pipeline also includes several other promising programs.

Even though the biotech stock has soared this year, it still appears to be a bargain. Vertex has a price-to-earnings-to-growth (PEG) ratio of only 0.45 -- a really attractive valuation.

2. Dollar General

Consumers must stretch every dollar they have when inflation runs rampant. As a result, they tend to shop more often at discount stores that offer lower prices on must-have products. And that's why Dollar General (DG 0.82%) is a practically inflation-proof stock.

Dollar General operates more than 18,000 stores that are strategically located within five miles of roughly three-quarters of the U.S. population. These stores sell a wide range of products but especially feature consumer staples.

The major market indexes remain in negative territory this year. However, Dollar General has delivered a positive return. In May, the company even raised its full-year 2022 sales guidance after reporting better-than-expected Q2 results. That's a surefire sign that inflation isn't hurting Dollar General.

This stock could be a lifeline for investors if high inflation leads to an official recession. Even if inflation wanes and the economy improves, though, Dollar General should still be able to beat the market.

3. Enterprise Products Partners

There are multiple causes of high inflation. However, high fuel prices particularly stand out as a culprit. But high fuel prices work to the benefit of Enterprise Products Partners (EPD 0.18%).

Sure, Enterprise charges the same amount to transport crude oil, natural gas, natural gas liquids, and petrochemicals through its pipelines regardless of the prices of the commodities. However, the dynamics that lead to higher prices for these products typically also mean higher demand. That results in more fuels and chemicals flowing through the company's pipelines and being processed in its facilities.

Unsurprisingly, Enterprise Products Partners stock has been a big winner this year. The Russian invasion of Ukraine disrupted global energy markets and drove demand for alternative sources of oil and gas.

Enterprise's long-term prospects could be better than many expect. Co-CEO Jim Teague stated in the company's Q2 conference call, "Oil and gas will be in high demand for decades." If he's right, Enterprise's pipelines and processing facilities will also be in high demand for a long time to come.