contract Strategy is ConvexMisc {
    address public constant usdc = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
    address public constant eurs = address(0xdB25f211AB05b1c97D595516F45794528a807ad8);

    constructor(address _vault) public ConvexMisc(_vault) {
        curve = address(0x0Ce6a5fF5217e38315f87032CF90686C96627CAA);
        id = 22;
        isClaimRewards = true; // default is true, turn off in emergency
        // isClaimExtras = true; // add this if there are extra rewards

        (address _lp,,,address _reward,,) = Booster(booster).poolInfo(id);
        require(_lp == address(want), "constructor: incorrect lp token");
        rewardContract = _reward;

        _approveBasic();

        dex = new address[](2);
        dex[0] = sushiswap; // crv
        dex[1] = sushiswap; // cvx
        _approveDex();
    }

    function _approveBasic() internal override {
        super._approveBasic();
        IERC20(eurs).safeApprove(curve, 0);
        IERC20(eurs).safeApprove(curve, type(uint256).max);
    }

    // >>> approve other rewards on dex
    function _approveDex() internal override {
        super._approveDex();
        IERC20(usdc).safeApprove(uniswapv3, 0);
        IERC20(usdc).safeApprove(uniswapv3, type(uint256).max);
    }

    // >>> include other rewards
    // function _migrateRewards(address _newStrategy) internal override { super._migrateRewards(_newStrategy); }

    // >>> include all other rewards in eth besides _claimableBasicInETH()
    // function _claimableInETH() internal override view returns (uint256 _claimable) { _claimable = super._claimableInETH(); }

    function prepareReturn(uint256 _debtOutstanding)
        internal
        override
        returns (
            uint256 _profit,
            uint256 _loss,
            uint256 _debtPayment
        )
    {
        uint before = balanceOfWant();
        Rewards(rewardContract).getReward(address(this), isClaimExtras);
        uint256 _crv = IERC20(crv).balanceOf(address(this));
        if (_crv > 0) {
            _crv = _adjustCRV(_crv);

            address[] memory path = new address[](3);
            path[0] = crv;
            path[1] = weth;
            path[2] = usdc;

            Uni(dex[0]).swapExactTokensForTokens(_crv, uint256(0), path, address(this), now);
        }
        uint256 _cvx = IERC20(cvx).balanceOf(address(this));
        if (_cvx > 0) {
            address[] memory path = new address[](3);
            path[0] = cvx;
            path[1] = weth;
            path[2] = usdc;

            Uni(dex[1]).swapExactTokensForTokens(_cvx, uint256(0), path, address(this), now);
        }
        uint256 _usdc = IERC20(usdc).balanceOf(address(this));
        if (_usdc > 0) {
            UniV3(uniswapv3).exactInput(UniV3.ExactInputParams(
                abi.encodePacked(
                    usdc, 
                    uint24(500), 
                    eurs
                ),
                address(this),
                now,
                _usdc,
                uint256(0)
            ));
        }
        uint256 _eurs = IERC20(eurs).balanceOf(address(this));
        if (_eurs > 0) {
            ICurveFi(curve).add_liquidity([_eurs, 0], 0);
        }
        _profit = balanceOfWant().sub(before);

        uint _total = estimatedTotalAssets();
        uint _debt = vault.strategies(address(this)).totalDebt;
        if(_total < _debt) {
            _loss = _debt - _total;
            _profit = 0;
        }

        if (_debtOutstanding > 0) {
            _withdrawSome(_debtOutstanding);
            _debtPayment = Math.min(_debtOutstanding, balanceOfWant().sub(_profit));
        }
    }

    function protectedTokens()
        internal
        view
        override
        returns (address[] memory)
    {
        address[] memory protected = new address[](2);
        protected[0] = crv;
        protected[1] = cvx;
        return protected;
    }
}
function prepareReturn(uint256 _debtOutstanding)
        internal
        override
        returns (
            uint256 _profit,
            uint256 _loss,
            uint256 _debtPayment
        )
    {
        uint before = balanceOfWant();
        Rewards(rewardContract).getReward(address(this), isClaimExtras);
        uint256 _crv = IERC20(crv).balanceOf(address(this));
        if (_crv > 0) {
            _crv = _adjustCRV(_crv);

            address[] memory path = new address[](3);
            path[0] = crv;
            path[1] = weth;
            path[2] = usdc;

            Uni(dex[0]).swapExactTokensForTokens(_crv, uint256(0), path, address(this), now);
        }
        uint256 _cvx = IERC20(cvx).balanceOf(address(this));
        if (_cvx > 0) {
            address[] memory path = new address[](3);
            path[0] = cvx;
            path[1] = weth;
            path[2] = usdc;

            Uni(dex[1]).swapExactTokensForTokens(_cvx, uint256(0), path, address(this), now);
        }
        uint256 _usdc = IERC20(usdc).balanceOf(address(this));
        if (_usdc > 0) {
            UniV3(uniswapv3).exactInput(UniV3.ExactInputParams(
                abi.encodePacked(
                    usdc, 
                    uint24(500), 
                    eurs
                ),
                address(this),
                now,
                _usdc,
                uint256(0)
            ));
        }
        uint256 _eurs = IERC20(eurs).balanceOf(address(this));
        if (_eurs > 0) {
            ICurveFi(curve).add_liquidity([_eurs, 0], 0);
        }
        _profit = balanceOfWant().sub(before);

        uint _total = estimatedTotalAssets();
        uint _debt = vault.strategies(address(this)).totalDebt;
        if(_total < _debt) {
            _loss = _debt - _total;
            _profit = 0;
        }

        if (_debtOutstanding > 0) {
            _withdrawSome(_debtOutstanding);
            _debtPayment = Math.min(_debtOutstanding, balanceOfWant().sub(_profit));
        }
    }
// >>> include other rewards
// function _migrateRewards(address _newStrategy) internal override { super._migrateRewards(_newStrategy); }
// >>> include all other rewards in eth besides _claimableBasicInETH()
// function _claimableInETH() internal override view returns (uint256 _claimable) { _claimable = super._claimableInETH(); }