The Toronto Raptors have reached agreement with the Indiana Pacers on a sign-and-trade to acquire free-agent guard C.J. Miles for Cory Joseph, league sources told ESPN.

Miles will sign a three-year, $25 million contract, which will include a player option on the third year, league sources told ESPN.

The deal is pending completion of the Raptors' trade with the Brooklyn Nets that will send DeMarre Carroll and two draft picks to Brooklyn for Justin Hamilton, league sources said. That transaction is pending the completion of the Washington Wizards matching Brooklyn's $106 million offer sheet for Otto Porter Jr.

Miles, 30, gives the Raptors an athletic, scoring wing player who can share minutes with the developing Norman Powell. Miles shot 41 percent on 3-pointers last season, his 12th year in the league. The contract is expected to allow the Raptors to stay out of the luxury tax.

Joseph, 25, has been a supremely consistent backup guard for the Raptors who'll fit well into the Pacers' plan to go younger and start rebuilding the roster post-Paul George.

Joseph, who averaged 9.3 points and 3.3 assists in 80 games last season, has excelled at the defensive end. He started his career in San Antonio before signing a free-agent deal in Toronto two years ago.