What formal agreement finally established peace and imposed punishments on Germany for its war actions?

After World War 1 - the Treaty of Versailles. After World War 2 there was no peace treaty or equivalent till just prior to reunification in 1990.