Gearbox V2
Credit accounts
Debt management

Debt management

User can manage debt size using 2 methods in ICreditFacade:

Increase debt

function increaseDebt(uint256 amount) external;

Increases debt by tranferring funds from the pool. To account increased debt, it updates cumulativeIndexAtOpen parameter.

ParameterDescription
amountAmount to increase borrowed amount

Decrease debt

Decreases debt by paying funds back to pool. The payment also include interest rate accrued at the moment and fees for whole debt. So, you would be charged for: amount + interestAccrued + fees.

    function decreaseDebt(uint256 amount) external;
ParameterDescription
amountAmount to descrease borrowed amount

How to compute the total?

/// NEED TO ADD COMPUTATION CODE HERE