As an adjunct to this, my math has the Sox on the hook for an AAV of $186.5MM + benefits, if they trade Hanley for Miggy straight-up.
Note this is not a total 2018 payroll calculation, just an estimate which ignores Pedroia's deferred comp, assumes Sale makes his CY option kicker, and chisels into stone that MLBTradeRumors gets every arbitration award estimate dead-on.
If the Sox actually did trade Hanley/Barnes/Johnson for Miggy and then dropped Holt and Wright and Workman off the 40-man roster, they'd probably just barely limbo under the CBT's bar. Of course, JWH said that DDski doesn't have to stay under the $197MM cap...plus Cora would have to plug Swihart or Brentz into the everyday lineup to stay under...but it's a nearer thing than I was imagining at first.
Of course, this math also means that if DDski were simply to re-sign Moreland to a 1-yr/$9M contract, the team might well be better off than by trading for Miggy.