We study dynamic contracts between a lender and a borrower in the presence of costly state verification and hidden effort. The optimal contract minimizes social losses by mediating dynamic incentives and monitoring. Along the efficiency frontier, the threat of early termination is unavoidable for low levels of the borrower's promised utility; as the level increases, preventive monitoring is used to avoid future inefficient termination of the contractual relationship due to asymmetric information; for high level of promised utility, the threat of termination of the contractual relationship is no longer a useful tool to align dynamic incentives, preventive monitoring loses its role, and termination never occurs. Thus, the efficient contract optimizes the tradeoff between dymanic incentievs and static incentives. Following the interpretaion of the costly state verification literature, we can distinguish two levels of bankruptcy: one that leads to monitoring and the other that leads to liquidation.