protocol-v2
protocol-v2 copied to clipboard
feat: support same asset repay
Extension of https://github.com/aave/protocol-v2/pull/222 which is the version currently deployed to the Aave interface
Adds condition to allow for repay with collateral when aToken and debtToken have the same underlying asset:
Old
uint256 amountSold =
_buyOnParaSwap(
buyAllBalanceOffset,
paraswapData,
collateralAsset,
debtAsset,
collateralAmount,
debtRepayAmount
);
New
uint256 amountSold = debtRepayAmount;
if (collateralAsset != debtAsset) {
amountSold = _buyOnParaSwap(
buyAllBalanceOffset,
paraswapData,
collateralAsset,
debtAsset,
collateralAmount,
debtRepayAmount
);
}