Optimal financial contracts with unobservable investments