func InputOutputComparator(a, b InputOutput) int {
	if !a.InputAmount().Currency.Equals(b.InputAmount().Currency) ||
		!a.OutputAmount().Currency.Equals(b.OutputAmount().Currency) {
		panic(ErrInvalidCurrency)
	}
	if a.OutputAmount().EqualTo(b.OutputAmount().Fraction) {
		if a.InputAmount().EqualTo(b.InputAmount().Fraction) {
			return 0
		}
		if a.InputAmount().LessThan(b.InputAmount().Fraction) {
			return -1
		}
		return 1
	}
	if a.OutputAmount().LessThan(b.OutputAmount().Fraction) {
		return 1
	}
	return -1
}
comparator function that allows sorting trades by their output amounts, in decreasing order, and then input amounts
in increasing order. i.e. the best trades have the most outputs for the least inputs and are sorted first
package entities
import (
	"fmt"
	"github.com/miraclesu/uniswap-sdk-go/constants"
)
var (
	ErrInvalidOption    = fmt.Errorf("invalid maxHops")
	ErrInvalidRecursion = fmt.Errorf("invalid recursion")
)
type BestTradeOptions struct {
	MaxNumResults int
	MaxHops int
}
func NewDefaultBestTradeOptions() *BestTradeOptions {
	return &BestTradeOptions{
		MaxNumResults: 3,
		MaxHops:       3,
	}
}
func (o *BestTradeOptions) ReduceHops() *BestTradeOptions {
	return &BestTradeOptions{
		MaxNumResults: o.MaxNumResults,
		MaxHops:       o.MaxHops - 1,
	}
}
type InputOutput interface {
	InputAmount() *TokenAmount
	OutputAmount() *TokenAmount
}