A theory of retractable and speculative contracts