add ISwapAdapter interface

This commit is contained in:
andyk 2020-09-07 12:54:38 +03:00
parent 5c28bf5a49
commit f1d3b8c9d6
2 changed files with 24 additions and 3 deletions

View File

@ -0,0 +1,20 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.6.8;
interface ISwapAdapter {
/**
* @dev Swaps an `amountToSwap` of an asset to another, approving a `fundsDestination` to pull the funds
* @param assetToSwapFrom Origin asset
* @param assetToSwapTo Destination asset
* @param amountToSwap How much `assetToSwapFrom` needs to be swapped
* @param fundsDestination Address that will be pulling the swapped funds
* @param params Additional variadic field to include extra params
*/
function executeOperation(
address assetToSwapFrom,
address assetToSwapTo,
uint256 amountToSwap,
address fundsDestination,
bytes calldata params
) external;
}

View File

@ -20,6 +20,7 @@ import {UserConfiguration} from '../libraries/configuration/UserConfiguration.so
import {IStableDebtToken} from '../tokenization/interfaces/IStableDebtToken.sol';
import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol';
import {IFlashLoanReceiver} from '../flashloan/interfaces/IFlashLoanReceiver.sol';
import {ISwapAdapter} from '../interfaces/ISwapAdapter.sol';
import {LendingPoolLiquidationManager} from './LendingPoolLiquidationManager.sol';
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
@ -499,11 +500,11 @@ contract LendingPool is VersionedInitializable, ILendingPool {
fromReserveAToken.burn(msg.sender, receiverAddress, amountToSwap);
// Notifies the receiver to proceed, sending as param the underlying already transferred
IFlashLoanReceiver(receiverAddress).executeOperation(
ISwapAdapter(receiverAddress).executeOperation(
fromAsset,
// toAsset,
toAsset,
amountToSwap,
0,
address(this),
params
);