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
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
45 changes: 45 additions & 0 deletions contracts/strategies/1inch/OneInchStrategyMainnet_DAI_LDO.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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(0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32);
bytes32 sushiDex = bytes32(0xcb2d20206d906069351c89a2cb7cdbd96c71998717cd5a82e724d955b654f67a);
bytes32 uniV3Dex = bytes32(0x8f78a54cb77f4634a5bf3dd452ed6a2e33432c73821be59208661199511cd94f);
bergben marked this conversation as resolved.
Show resolved Hide resolved
OneInchStrategy_DAI_X.initializeBaseStrategy(
_storage,
underlying,
_vault,
rewardPool, //rewardPool
300 // profit sharing numerator
bergben marked this conversation as resolved.
Show resolved Hide resolved
);
rewardTokens = [oneInch, ldo];
storedLiquidationPaths[oneInch][weth] = [oneInch, weth];
storedLiquidationDexes[oneInch][weth] = [uniV3Dex];
storedLiquidationPaths[ldo][weth] = [ldo, weth];
storedLiquidationDexes[ldo][weth] = [sushiDex];
storedLiquidationPaths[weth][dai] = [weth, dai];
storedLiquidationDexes[weth][dai] = [sushiDex];
storedLiquidationPaths[weth][stEth] = [weth, dai];
// TODO: stEth has liquidity almost exclusively on curve.
// Have to use curve here for buying the token
storedLiquidationDexes[weth][stEth] = [sushiDex];
}
}
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