@@ -39,13 +39,13 @@ contract ParaSwapRepayAdapter is BaseParaSwapBuyAdapter, ReentrancyGuard {
3939 * The user should give this contract allowance to pull the ATokens in order to withdraw the underlying asset, swap it
4040 * and repay the flash loan.
4141 * Supports only one asset on the flash loan.
42- * @param assets Address of debt asset
43- * @param amounts Amount of the debt to be repaid, or maximum amount when repaying entire debt
42+ * @param assets Address of collateral asset(Flash loan asset)
43+ * @param amounts Amount of flash loan taken
4444 * @param premiums Fee of the flash loan
4545 * @param initiator Address of the user
4646 * @param params Additional variadic field to include extra params. Expected parameters:
47- * IERC20Detailed collateralAsset Address of the reserve to be swapped
48- * uint256 collateralAmount max Amount of the collateral to be swapped
47+ * IERC20Detailed debtAsset Address of the debt asset
48+ * uint256 debtAmount Amount of debt to be repaid
4949 * uint256 rateMode Rate modes of the debt to be repaid
5050 * uint256 deadline Deadline for the permit signature
5151 * uint256 debtRateMode Rate mode of the debt to be repaid
@@ -68,31 +68,20 @@ contract ParaSwapRepayAdapter is BaseParaSwapBuyAdapter, ReentrancyGuard {
6868 'FLASHLOAN_MULTIPLE_ASSETS_NOT_SUPPORTED '
6969 );
7070
71- uint256 debtRepayAmount = amounts[0 ];
71+ uint256 collateralAmount = amounts[0 ];
7272 uint256 premium = premiums[0 ];
7373 address initiatorLocal = initiator;
74+
7475
75- IERC20Detailed debtAsset = IERC20Detailed (assets[0 ]);
76- (
77- IERC20Detailed collateralAsset ,
78- uint256 collateralAmount ,
79- uint256 buyAllBalanceOffset ,
80- uint256 debtRateMode ,
81- bytes memory paraswapData ,
82- PermitSignature memory permitParams
83- ) = abi.decode (params, (IERC20Detailed , uint256 , uint256 , uint256 , bytes , PermitSignature));
76+ IERC20Detailed collateralAsset = IERC20Detailed (assets[0 ]);
77+
8478
8579 _swapAndRepay (
86- buyAllBalanceOffset,
87- paraswapData,
88- permitParams,
89- debtRepayAmount,
80+ params,
9081 premium,
9182 initiatorLocal,
9283 collateralAsset,
93- debtAsset,
94- collateralAmount,
95- debtRateMode
84+ collateralAmount
9685 );
9786
9887 return true ;
@@ -167,30 +156,29 @@ contract ParaSwapRepayAdapter is BaseParaSwapBuyAdapter, ReentrancyGuard {
167156
168157 /**
169158 * @dev Perform the repay of the debt, pulls the initiator collateral and swaps to repay the flash loan
170- * @param buyAllBalanceOffset Set to offset of fromAmount in Augustus calldata if wanting to swap all balance, otherwise 0
171- * @param paraswapData Paraswap data
172- * @param permitSignature struct containing the permit signature
173- * @param debtRepayAmount Amount of the debt to be repaid, or maximum amount when repaying entire debt
174159 * @param premium Fee of the flash loan
175160 * @param initiator Address of the user
176161 * @param collateralAsset Address of token to be swapped
177- * @param debtAsset Address of debt token to be received from the swap
178162 * @param collateralAmount Amount of the reserve to be swapped(flash loan amount)
179- * @param rateMode Rate mode of the debt to be repaid
180163 */
181164
182165 function _swapAndRepay (
183- uint256 buyAllBalanceOffset ,
184- bytes memory paraswapData ,
185- PermitSignature memory permitSignature ,
186- uint256 debtRepayAmount ,
166+ bytes calldata params ,
187167 uint256 premium ,
188168 address initiator ,
189169 IERC20Detailed collateralAsset ,
190- IERC20Detailed debtAsset ,
191- uint256 collateralAmount ,
192- uint256 rateMode
170+ uint256 collateralAmount
193171 ) private {
172+
173+ (
174+ IERC20Detailed debtAsset ,
175+ uint256 debtRepayAmount ,
176+ uint256 buyAllBalanceOffset ,
177+ uint256 rateMode ,
178+ bytes memory paraswapData ,
179+ PermitSignature memory permitSignature
180+ ) = abi.decode (params, (IERC20Detailed , uint256 , uint256 , uint256 , bytes , PermitSignature));
181+
194182 debtRepayAmount = getDebtRepayAmount (
195183 debtAsset,
196184 rateMode,
0 commit comments