Tesla is struggling but it can still count on cash for selling carbon credits