mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
add ISwapAdapter interface
This commit is contained in:
parent
5c28bf5a49
commit
f1d3b8c9d6
20
contracts/interfaces/ISwapAdapter.sol
Normal file
20
contracts/interfaces/ISwapAdapter.sol
Normal 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;
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ import {UserConfiguration} from '../libraries/configuration/UserConfiguration.so
|
||||||
import {IStableDebtToken} from '../tokenization/interfaces/IStableDebtToken.sol';
|
import {IStableDebtToken} from '../tokenization/interfaces/IStableDebtToken.sol';
|
||||||
import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol';
|
import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol';
|
||||||
import {IFlashLoanReceiver} from '../flashloan/interfaces/IFlashLoanReceiver.sol';
|
import {IFlashLoanReceiver} from '../flashloan/interfaces/IFlashLoanReceiver.sol';
|
||||||
|
import {ISwapAdapter} from '../interfaces/ISwapAdapter.sol';
|
||||||
import {LendingPoolLiquidationManager} from './LendingPoolLiquidationManager.sol';
|
import {LendingPoolLiquidationManager} from './LendingPoolLiquidationManager.sol';
|
||||||
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
||||||
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.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);
|
fromReserveAToken.burn(msg.sender, receiverAddress, amountToSwap);
|
||||||
// Notifies the receiver to proceed, sending as param the underlying already transferred
|
// Notifies the receiver to proceed, sending as param the underlying already transferred
|
||||||
IFlashLoanReceiver(receiverAddress).executeOperation(
|
ISwapAdapter(receiverAddress).executeOperation(
|
||||||
fromAsset,
|
fromAsset,
|
||||||
// toAsset,
|
toAsset,
|
||||||
amountToSwap,
|
amountToSwap,
|
||||||
0,
|
address(this),
|
||||||
params
|
params
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user