Credit, contract and mechanism design of market transaction Legal logic and mechanisms for market regulation