Bond Buyback NPV analysis

Hi,

How can I determine the discount rate in the NPV analysis of a bond buyback? What’s the logic for choosing the WACC, the YTM of the new bond or the cost of equity?

Thanks!