@@ -59,7 +59,7 @@ contract PositionsManager is IPositionsManager, PositionsManagerInternal {
5959
6060 Types.SupplyRepayVars memory vars = _executeSupply (underlying, amount, from, onBehalf, maxIterations, indexes);
6161
62- _pool.repayToPool (underlying, market.variableDebtToken, vars.toRepay);
62+ _pool.repayToPool (underlying, market.variableDebtToken, vars.toRepay, indexes.borrow.poolIndex );
6363 _pool.supplyToPool (underlying, vars.toSupply, indexes.supply.poolIndex);
6464
6565 return amount;
@@ -143,7 +143,7 @@ contract PositionsManager is IPositionsManager, PositionsManagerInternal {
143143 Types.SupplyRepayVars memory vars =
144144 _executeRepay (underlying, amount, repayer, onBehalf, _defaultIterations.repay, indexes);
145145
146- _pool.repayToPool (underlying, market.variableDebtToken, vars.toRepay);
146+ _pool.repayToPool (underlying, market.variableDebtToken, vars.toRepay, indexes.borrow.poolIndex );
147147 _pool.supplyToPool (underlying, vars.toSupply, indexes.supply.poolIndex);
148148
149149 return amount;
@@ -259,7 +259,12 @@ contract PositionsManager is IPositionsManager, PositionsManagerInternal {
259259 underlyingCollateral, vars.seized, borrower, liquidator, collateralIndexes.supply.poolIndex
260260 );
261261
262- _pool.repayToPool (underlyingBorrowed, _market[underlyingBorrowed].variableDebtToken, repayVars.toRepay);
262+ _pool.repayToPool (
263+ underlyingBorrowed,
264+ _market[underlyingBorrowed].variableDebtToken,
265+ repayVars.toRepay,
266+ borrowIndexes.borrow.poolIndex
267+ );
263268 _pool.supplyToPool (underlyingBorrowed, repayVars.toSupply, borrowIndexes.supply.poolIndex);
264269 _pool.withdrawFromPool (underlyingCollateral, _market[underlyingCollateral].aToken, vars.seized);
265270
0 commit comments