The Bills and LeSean McCoy agreed upon a new five-year contract that will be signed when the trade with the Eagles is finalized on Tuesday, two NFL sources told The Inquirer.

McCoy had three years worth $25 million remaining in his existing deal with only $1 million of his $10.25 salary for 2015 guaranteed. With his new contract, the first year is guaranteed for $16 million and he will get a total of $26.5 million guaranteed of $40 million overall.

Neither the Eagles nor Bills has confirmed the trade, but it was pulled off on Tuesday with McCoy going to Buffalo for linebacker Kiki Alonso. The trade will become official when the new league year opens on Tuesday at 4 p.m.

McCoy was not initiallly pleased about the trade, per sources close to the running back. He wanted to finish his career in Philadelphia, they said. But after a few days to process the move and with the new contract he is ready to turn the page.