The history of Martian volatiles