I solve for the optimal (state-contingent) contract and find that moral hazard friction is sufficient to explain capital outflows in low output states –- a defining feature of the emerging markets business cycles. On the other hand, the model that also includes limited enforcement is inconsistent with this fact. The model with moral hazard also performs well in explaining quantitative properties of Argentina's business cycle.