We investigate the mechanics of a nano logic gate, comprising a metallofullerene which is located inside a square-shaped single-walled carbon nanotorus involving non-metallic, single-walled carbon nanotubes with perfect nanotoroidal corners. These are highly novel and speculative nanodevices whose construction, no doubt, involves many technical challenges. The energy for the system is obtained from the 6–12 Lennard-Jones potential with the continuous approximation. Our approach shows that there is not much difference between the energy when the metallofullerene is located in the tubes compared to when it is at the corners, and therefore the metallofullerene may be controlled by a small voltage. By applying two voltage inputs to produce external electric fields, one for the left–right motion and the other for the top–bottom motion, the metallofullerene can be moved to one of the four corners. Assuming that at the four corners there are charge detectors, the proposed device can be designed as a logic gate with different signals corresponding to particular gates.