I'm not surprised it's only 4 years. The Twins are buying his prime athletic years and nothing more. They always have the chance to add another extension if he still is pitching great near the end of that contract.
On the Lopez side, he gets good money and becomes a FA with another chance to cash in big if he wants.
This is a big win for both sides. Lopez probably get about $8M more than he'd get in arbitration, plus a decent rate for the next 3 years after. They Twins get a controllable pitcher with high upside at a reasonable price.
Needless to say that I'm excited about this deal.