Tesla’s decision to offload most of its Bitcoin (BTC) treasuries netted the company a hefty profit in the second quarter, even as crypto prices plunged into a bear market.

In the first six months of 2022, Tesla recorded $170 million of impairment losses “resulting from changes to the carrying value” of its Bitcoin holdings, according to an official Form 10-Q filing with the United States Securities and Exchange Commission, or SEC. After selling 75% of its BTC stash for dollars in the second quarter, the company netted a realized gain of $64 million.

In finance, an impairment loss occurs when the fair value of an asset held by a company falls below the carrying value of the investment.

Tesla recorded per-share earnings of $2.27 in the second quarter on revenues of $16.93 billion. Although profitability was down compared with the first quarter, it was up over the levels of a year ago. However, company profitability was impacted by rising inflation and growing competition for battery cells. 

The electric vehicle maker still has 10,800 BTC on its books, according to Bitcoin Treasuries. At a current price of around $22,000 BTC, Tesla’s digital asset holdings are worth roughly $237 million.

Related: Experts reveal what Tesla’s $936M sell-off means for Bitcoin

The 10-K disclosure didn’t reveal any new insights about Tesla’s digital asset strategy. However, the company did state that it may increase or decrease its holdings over time:

“As with any investment and consistent with how we manage fiat-based cash and cash equivalent accounts, we may increase or decrease our holdings of digital assets at any time based on the needs of the business and on our view of market and environmental conditions.”