generated from bgd-labs/bgd-forge-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: revamp of paraswap adapters (#12)
Co-authored-by: Parth Patel <[email protected]>
- Loading branch information
1 parent
e9c96e4
commit 744e1ee
Showing
126 changed files
with
6,120 additions
and
856 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ node_modules | |
|
||
# ignore foundry deploy artifacts | ||
broadcast/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule aave-address-book
updated
218 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.10; | ||
|
||
import {IPoolAddressesProvider} from '@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol'; | ||
import {DataTypes, ILendingPool} from 'aave-address-book/AaveV2.sol'; | ||
import {IParaSwapAugustusRegistry} from './dependencies/paraswap/IParaSwapAugustusRegistry.sol'; | ||
import {BaseParaSwapAdapter} from './base/BaseParaSwapAdapter.sol'; | ||
import {ParaSwapLiquiditySwapAdapter} from './base/ParaSwapLiquiditySwapAdapter.sol'; | ||
|
||
/** | ||
* @title ParaSwapLiquiditySwapAdapterV2 | ||
* @notice ParaSwap Adapter to perform a swap of collateral from one asset to another. | ||
* @dev It is specifically designed for Aave V2 | ||
* @author Aave Labs | ||
**/ | ||
contract ParaSwapLiquiditySwapAdapterV2 is ParaSwapLiquiditySwapAdapter { | ||
/** | ||
* @dev Constructor | ||
* @param addressesProvider The address of the Aave PoolAddressesProvider contract | ||
* @param pool The address of the Aave Pool contract | ||
* @param augustusRegistry The address of the Paraswap AugustusRegistry contract | ||
* @param owner The address of the owner | ||
*/ | ||
constructor( | ||
IPoolAddressesProvider addressesProvider, | ||
address pool, | ||
IParaSwapAugustusRegistry augustusRegistry, | ||
address owner | ||
) ParaSwapLiquiditySwapAdapter(addressesProvider, pool, augustusRegistry, owner) { | ||
// Intentionally left blank | ||
} | ||
|
||
/// @inheritdoc BaseParaSwapAdapter | ||
function _getReserveData( | ||
address asset | ||
) internal view override returns (address, address, address) { | ||
DataTypes.ReserveData memory reserveData = ILendingPool(address(POOL)).getReserveData(asset); | ||
return ( | ||
reserveData.variableDebtTokenAddress, | ||
reserveData.stableDebtTokenAddress, | ||
reserveData.aTokenAddress | ||
); | ||
} | ||
|
||
/// @inheritdoc BaseParaSwapAdapter | ||
function _supply( | ||
address asset, | ||
uint256 amount, | ||
address to, | ||
uint16 referralCode | ||
) internal override { | ||
ILendingPool(address(POOL)).deposit(asset, amount, to, referralCode); | ||
} | ||
} |
Oops, something went wrong.