  Galaxies display several well-behaved scaling relations between their
properties, such as the star formation rate-stellar mass relation (the main
sequence) and the stellar mass-halo mass relation (SHMR). In principle, these
scaling relations could imply different star formation histories (SFHs) of
galaxies and different constraints on galaxy formation physics. In this paper,
we derive the SFHs of galaxies by assuming that they always follow the SHMRs at
different redshifts and use an empirical model to constrain key processes in
their baryon cycle. It is found that, besides cold accretion due to halo
growth, outflow of gas produced by stellar feedback has to be recycled to
sustain the derived SFHs of galaxies. The recycled fraction is strongly
affected by the baryon fraction in accreted low-mass haloes and the mass
loading factor which quantifies the ratio between the galactic outflow rate and
star formation rate. Our fiducial model predicts that around $20-60\%$ of
outflow is recycled in $\sim0.5-4Gyrs$, while simulations predict a slightly
higher recycle fraction and a lower recycle time. We argue that strong
constraints on the baryon cycle process can be obtained from future observation
of the circum-galactic medium (CGM) of galaxies, such as the gas cooling rate
of CGM. We also find that the implied SFHs from the SHMRs indicate that
galaxies stay on the main sequences only for part of their lifetimes. Our model
reproduces the evolution of the mass-metallicity relation as well.
