Voltammetry and electrodeposition in the presence of attractive interactions: I. a mean-field approach