-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
189 changed files
with
9,344 additions
and
3,164 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
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
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
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 |
---|---|---|
|
@@ -2,15 +2,15 @@ | |
pragma solidity >=0.8.0; | ||
import "openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol"; | ||
|
||
import { IRouter } from "../external/aerodrome/IRouter.sol"; | ||
import { IRouter_Aerodrome } from "../external/aerodrome/IRouter.sol"; | ||
|
||
/** | ||
* @title UniswapV2Liquidator | ||
* @notice Exchanges seized token collateral for underlying tokens via a Uniswap V2 router for use as a step in a liquidation. | ||
* @author David Lucid <[email protected]> (https://github.com/davidlucid) | ||
*/ | ||
contract AerodromeV2Liquidator { | ||
function _swap(IRouter router, uint256 inputAmount, IRouter.Route[] memory swapPath) internal { | ||
function _swap(IRouter_Aerodrome router, uint256 inputAmount, IRouter_Aerodrome.Route[] memory swapPath) internal { | ||
router.swapExactTokensForTokens(inputAmount, 0, swapPath, address(this), block.timestamp); | ||
} | ||
|
||
|
@@ -40,8 +40,14 @@ contract AerodromeV2Liquidator { | |
bytes memory strategyData | ||
) internal returns (IERC20Upgradeable outputToken, uint256 outputAmount) { | ||
// Get Uniswap router and path | ||
(IRouter router, IRouter.Route[] memory swapPath) = abi.decode(strategyData, (IRouter, IRouter.Route[])); | ||
require(swapPath.length >= 1 && swapPath[0].from == address(inputToken), "Invalid AerodromeV2Liquidator swap path."); | ||
(IRouter_Aerodrome router, IRouter_Aerodrome.Route[] memory swapPath) = abi.decode( | ||
strategyData, | ||
(IRouter_Aerodrome, IRouter_Aerodrome.Route[]) | ||
); | ||
require( | ||
swapPath.length >= 1 && swapPath[0].from == address(inputToken), | ||
"Invalid AerodromeV2Liquidator swap path." | ||
); | ||
|
||
// Swap underlying tokens | ||
inputToken.approve(address(router), inputAmount); | ||
|
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
Oops, something went wrong.