While I was searching for the German word for a contract (in the general meaning, as a binding agreement between any multiple entities, in any context) in my English-German dictionary I came across two German words: Vertrag and Auftrag. Both seem to translate to contract, so I would like to ask what the difference between the two words in terms of their meaning and other small nuances, or whether there are any other more widely used words for a contract.
In context, I’ve seen Vertrag used more for historical events (such as agreements between two countries) whereas Auftrag seems to be used in more everyday cases such as employment. However, I do not have a clue what specifically they refer to, or when to use which. For example, I’ve seen both Kaufvertrag and Kaufauftrag being used, although I’m not sure whether they mean the same thing. Which word for a contract is used more widely in everyday language? And apart from this, which one should I use in more specialized cases, for instance, for social contract (for which I encountered the use of both words) or for lease contract (which seems to be a Vertrag for some reason)?