Can someone explain the difference between contract theory and mechanism design?
Contracts are a subset of all mechanisms where agreements are enforcable.
An example of a mechanism that is not a contract:
A second price auction (or Vickrey auction) is a truth-telling mechanism where the enforcability of contracts is not required. In the truth-telling equilibrium no one has any incentive to change their bid, no matter the outcome. This is not because changing the bid would be a violation of contract and result in penalties.
As the previous answer mentions Contract Theory is a subset of Mechanism Design. Contract Theory is the study of Mechanism Design restricted to a single agent, i.e how to incentivize a single agent to achieve a desirable outcome, when you allow for multiple agents, the same problem becomes a mechanism design problem.