Transaction 1:
Amount received = 600
Basis = 500
Gain/Loss=600-500=100
Transaction 2:
Amt received = 800
Basis = 700
G/L = 800-700=100
Total Profit = 200
Debt is not part of income statement, it is on the balance sheet. The increase in debt only increases the basis in the 2nd transaction. It does not affect the profit afterwards.