  Gauging introduces gauge fields in order to localize an existing global
symmetry, resulting in a dual global symmetry on the gauge fields that can be
gauged again. By iterating the gauging process on spin chains with Abelian
group symmetries and arranging the gauge fields in a 2D lattice, the local
symmetries become the stabilizer of the $XZZX$-code for any Abelian group. By
twisting the gauging map we obtain new codes that explicitly confine anyons,
which violate an odd number of plaquette terms and whose fusion results in
mobile dipole excitations. Our construction naturally realizes any gapped
boundary by taking different quantum phases of the initial (1+1)D globally
symmetric system. Our method establishes a new route to obtain higher
dimensional topological codes from lower ones, to identify their gapped
boundaries and their tensor network representations.
