Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(1inch): add generic DAI_X base strategy and implement DAI_LDO #52

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions contracts/base/interface/oneInch/IOneInchLiquidator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.5.16;

interface IOneInchLiquidator {
function changeReferral(address newReferral) external;

function doSwap(
uint256 amountIn,
uint256 minAmountOut,
address spender,
address target,
address[] calldata path
) external;

function changePool(
address _token0,
address _token1,
address _pool
) external;

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity 0.5.16;

import "./OneInchStrategy_1INCH_X.sol";
import "./base/OneInchStrategy_1INCH_X.sol";


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity 0.5.16;

import "./OneInchStrategy_1INCH_X.sol";
import "./base/OneInchStrategy_1INCH_X.sol";


/**
Expand Down
43 changes: 43 additions & 0 deletions contracts/strategies/1inch/OneInchStrategyMainnet_DAI_LDO.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
pragma solidity 0.5.16;

import "./base/OneInchStrategy_DAI_X.sol";

/**
* This strategy is for the DAI/LDO LP token on 1inch
*/
contract OneInchStrategy_DAI_LDO is OneInchStrategy_DAI_X {

address public dai_ldo_unused; // just a differentiator for the bytecode

constructor() public {}

function initializeStrategy(
address _storage,
address _vault
) public initializer {
address underlying = address(0xC1A900Ae76dB21dC5aa8E418Ac0F4E888A4C7431);
address rewardPool = address(0xd7012cDeBF10d5B352c601563aA3A8D1795A3F52);
address oneInch = address(0x111111111117dC0aa78b770fA6A738034120C302);
address ldo = address(0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32);
address stEth = address(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);
bytes32 sushiDex = bytes32(0xcb2d20206d906069351c89a2cb7cdbd96c71998717cd5a82e724d955b654f67a);
bytes32 oneInchDex = bytes32(0xd9bf0c0ec020d1a26ba6698a24db3a538215d8fbf30588bddde694887c4cb55e);

OneInchStrategy_DAI_X.initializeBaseStrategy(
_storage,
underlying,
_vault,
rewardPool //rewardPool
);

rewardTokens = [oneInch, ldo];
storedLiquidationPaths[oneInch][weth] = [oneInch, weth];
storedLiquidationDexes[oneInch][weth] = [oneInchDex];
storedLiquidationPaths[ldo][weth] = [ldo, weth];
storedLiquidationDexes[ldo][weth] = [sushiDex];
storedLiquidationPaths[weth][dai] = [weth, dai];
storedLiquidationDexes[weth][dai] = [sushiDex];
storedLiquidationPaths[weth][stEth] = [weth, dai, stEth];
storedLiquidationDexes[weth][stEth] = [sushiDex, oneInchDex];
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity 0.5.16;

import "./OneInchStrategy_ETH_X.sol";
import "./base/OneInchStrategy_ETH_X.sol";


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity 0.5.16;

import "./OneInchStrategy_ETH_X_V2.sol";
import "./base/OneInchStrategy_ETH_X_V2.sol";


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity 0.5.16;

import "./OneInchStrategy_ETH_X.sol";
import "./base/OneInchStrategy_ETH_X.sol";


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity 0.5.16;

import "./OneInchStrategy_ETH_X.sol";
import "./base/OneInchStrategy_ETH_X.sol";


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity 0.5.16;

import "./OneInchStrategy_ETH_X.sol";
import "./base/OneInchStrategy_ETH_X.sol";


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interface/IMooniswap.sol";
import "./interface/IFarmingRewardsV2.sol";
import "../interface/IMooniswap.sol";
import "../interface/IFarmingRewardsV2.sol";

import "../../base/interface/uniswap/IUniswapV2Router02.sol";
import "../../base/interface/IStrategy.sol";
import "../../base/interface/IVault.sol";
import "../../base/interface/weth/Weth9.sol";
import "../../../base/interface/uniswap/IUniswapV2Router02.sol";
import "../../../base/interface/IStrategy.sol";
import "../../../base/interface/IVault.sol";
import "../../../base/interface/weth/Weth9.sol";

import "../../base/StrategyBase.sol";
import "../../../base/StrategyBase.sol";

/**
* This strategy is for 1INCH / X 1inch LP tokens
Expand Down Expand Up @@ -42,7 +42,7 @@ contract OneInchStrategy_1INCH_X is StrategyBase {
address public oneInchEthLP;
address[] public uniswap_WETH2Token1;

// token0 is ETH
// token0 is 1inch
address public token1;

uint256 slippageNumerator = 9;
Expand Down
Loading