    /*
        Integrate dodo curve from V1 to V2
        require V0>=V1>=V2>0
        res = (1-k)i(V1-V2)+ikV0*V0(1/V2-1/V1)
        let V1-V2=delta
        res = i*delta*(1-k+k(V0^2/V1/V2))

        i is the price of V-res trading pair

        support k=1 & k=0 case

        [round down]
    */
    function _GeneralIntegrate(uint256 V0, uint256 V1, uint256 V2, uint256 i, uint256 k) internal pure returns (uint256) {
        if (V0 == 0) {
            revert ErrIsZero();
        }

        uint256 fairAmount = i * (V1 - V2); // i*delta

        if (k == 0) {
            return fairAmount / DecimalMath.ONE;
        }

        uint256 V0V0V1V2 = DecimalMath.divFloor((V0 * V0) / V1, V2);
        uint256 penalty = DecimalMath.mulFloor(k, V0V0V1V2); // k(V0^2/V1/V2)
        return (((DecimalMath.ONE - k) + penalty) * fairAmount) / DecimalMath.ONE2;
    }
    function _GeneralIntegratePrecise(uint256 V0, uint256 V1, uint256 V2, uint256 i, uint256 k) public pure returns (uint256) {
        if (V0 == 0) {
            revert ErrIsZero();
        }

        uint256 fairAmount = i * (V1 - V2); // i*delta

        if (k == 0) {
            return fairAmount / 1e18;
        }

        uint256 V0V0V1V2 = (V0 * V0);
        uint256 penalty = (k * V0V0V1V2) / (V1 * V2); // k(V0^2/V1/V2)
        return (((1e18 - k) + penalty) * fairAmount) / 1e36;
    }
    V0 = 87461235449999999000
    V1 = 131454658215568436100
    V2 = 45632153140140545000
    i  = 200
    k  = 1000000000000000000
     Current Implementation  17164
     Precise Implementation  21888
    function _GeneralIntegrate(uint256 V0, uint256 V1, uint256 V2, uint256 i, uint256 k) public pure returns (uint256) {
        if (V0 == 0) {
            revert ErrIsZero();
        }

        uint256 fairAmount = i * (V1 - V2); // i*delta

        if (k == 0) {
            return fairAmount / 1e18;
        }

        uint256 V0V0V1V2 = (V0 * V0);
        uint256 penalty = (k * V0V0V1V2) / (V1 * V2); // k(V0^2/V1/V2)
        return (((1e18 - k) + penalty) * fairAmount) / 1e36;
    }
