The European Stability Mechanism ( ESM ) , commonly referred to as the EU `` rescue funding programme , was designed to stabilize the European economic and currency union and to avert `` state bankruptcy '' and any negative consequences to the common currency .