Optimal contracting with altruism and reciprocity