Volatiles in the Earth and Moon: Constraints on planetary formation and evolution