Endogenous contest success functions: a mechanism design approach