Mechanical Contract Engineering