Trade and insurance with moral hazard