Cocaine causes an outsized response from the brain's pleasure centre (the nucleus accumbens) leading to the brain producing around more than three times the normal amount of dopamine. The effects are supposed to die off after around 90 minutes at most, I think, so I don't know why it made you so happy throughout the rest of the day. Maybe the dopamine rush put you in a good mood, leading to a positive mindset that ended up remaining throughout the rest of the day. Either way, drugs that mess with the brain's pleasure centre, like cocaine, can cause a worsening of mental illness symptoms (depression, anxiety, PTSD) over time and they are chemically addictive so I wouldn't recommend using it too often.