Choreography synthesis as contract agreement