We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
// SPDX-License-Identifier: MIT pragma solidity ^0.6.2;
import "../../openzeppelin-contracts/contracts/math/Math.sol"; import "../../openzeppelin-contracts/contracts/math/SafeMath.sol"; import "../../openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; import "../../openzeppelin-contracts/contracts/token/ERC20/SafeERC20.sol"; import "../../openzeppelin-contracts/contracts/utils/Address.sol";
import "./Strategy.sol"; import "../../interfaces/external/WETH.sol"; import "../../interfaces/external/KeeperDAO.sol";
contract StrategyKeeperDAO is Strategy_New { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256;
address public ktoken; address public liquiditypool; address public strategist; constructor(address _want, address _ktoken, address _liquiditypool, address _strategist) public Strategy_New(_want) { ktoken = _ktoken; liquiditypool = _liquiditypool; want = _want; strategist = _strategist; } function setStrategist(address _strategist) external { require(msg.sender == governance, "!governance"); strategist = _strategist; } function update(address _newStratrgy) public override { require(msg.sender == governance, "!governance"); withdraw(1e18); uint256 _balance = IERC20(want).balanceOf(address(this)); IERC20(want).safeTransfer(_newStratrgy, _balance); IVaultX(vaultX).setStrategy(_newStratrgy); IVaultY(vaultY).setStrategy(_newStratrgy); } function deposit(uint256 _ne18) public override { require(msg.sender == strategist || msg.sender == governance, "!authorized"); uint256 _amount = IERC20(want).balanceOf(address(this)); IERC20(want).approve(liquiditypool, _amount); ILiquidityPool(liquiditypool).deposit(want, _amount.mul(_ne18).div(1e18)); IERC20(want).safeTransferFrom(msg.sender,address(this), _amount.mul(_ne18).div(1e18).mul(64).div(10000)); } function withdraw(uint256 _ne18) public { require(msg.sender == governance, "!governance"); uint256 _amount = IKToken(ktoken).balanceOf(address(this)).mul(_ne18).div(1e18); IKToken(ktoken).approve(liquiditypool, _amount); ILiquidityPool(liquiditypool).withdraw(address(this), IKToken(ktoken), _amount); } function withdraw(address _to, uint256 _amount) public override { uint256 _balance = IERC20(want).balanceOf(address(this)); if (_balance < _amount){ ILiquidityPool(liquiditypool).withdraw(address(this), IKToken(ktoken), _amount.sub(_balance).mul(IKToken(ktoken).totalSupply()).div(IERC20(want).balanceOf(liquiditypool))); _amount = Math.min(IERC20(want).balanceOf(address(this)), _amount); } if (msg.sender == vaultX) { uint256 _fee = _amount.mul(feexe18).div(1e18); IERC20(want).safeTransfer(governance, _fee); IERC20(want).safeTransfer(_to, _amount.sub(_fee)); } else if (msg.sender == vaultY) { uint256 _fee = _amount.mul(feeye18).div(1e18); IERC20(want).safeTransfer(governance, _fee); IERC20(want).safeTransfer(_to, _amount.sub(_fee)); } } function balanceOfY() public view override returns (uint256) { return IERC20(want).balanceOf(address(this)).add(IKToken(ktoken).balanceOf(address(this)).mul(IKToken(ktoken).totalSupply()).div(IERC20(want).balanceOf(liquiditypool))).sub(IERC20(vaultX).totalSupply()); }
}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
import "../../openzeppelin-contracts/contracts/math/Math.sol";
import "../../openzeppelin-contracts/contracts/math/SafeMath.sol";
import "../../openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import "../../openzeppelin-contracts/contracts/token/ERC20/SafeERC20.sol";
import "../../openzeppelin-contracts/contracts/utils/Address.sol";
import "./Strategy.sol";
import "../../interfaces/external/WETH.sol";
import "../../interfaces/external/KeeperDAO.sol";
contract StrategyKeeperDAO is Strategy_New {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
}
The text was updated successfully, but these errors were encountered: