We develop an agency model of financial contracting. We derive long-term debt, a line of credit, and equity as optimal securities, capturing the debt coupon and maturity; the interest rate and limits on the credit line; inside versus outside equity; dividend policy; and capital structure...