On April 2, 2012, Cain agreed to a five-year contract extension worth a guaranteed $112.5 million through 2017 with an option for 2018. Coupled with $15 million he was already scheduled to be paid, the extension made his total contract worth $127.5 million; at the time, this was the largest contract ever received by a right-handed pitcher. Cain earned a $5 million signing bonus, and earned $20 million each season from 2013 to 2017. His $21 million option for 2018 would vest automatically if he was not on the disabled list to an elbow or shoulder injury in 2017 and if he reached 400 innings in 2016 and 2017 combined. If the option failed to vest, the Giants could either pick up the $21 million option or pay a $7.5 million buyout. Cain was scheduled to become a free agent after the 2012 season.