Contract Risk Allocation and Sharing